small refactoring
This commit is contained in:
parent
f685175285
commit
4986bed5bc
@ -11,8 +11,8 @@ import kotlinx.serialization.json.Json
|
|||||||
private val format = Json { ignoreUnknownKeys = true }
|
private val format = Json { ignoreUnknownKeys = true }
|
||||||
|
|
||||||
class BinaryBusinessContentRepoContentAdapter(
|
class BinaryBusinessContentRepoContentAdapter(
|
||||||
private val dataStore: KeyValueRepo<String, String>,
|
private val dataStore: KeyValueRepo<ContentId, String>,
|
||||||
private val filesStore: KeyValueRepo<String, ByteArray>,
|
private val filesStore: KeyValueRepo<ContentId, ByteArray>,
|
||||||
private val removeOnAbsentInOneOfStores: Boolean = false
|
private val removeOnAbsentInOneOfStores: Boolean = false
|
||||||
) : BusinessContentRepoContentAdapter {
|
) : BusinessContentRepoContentAdapter {
|
||||||
override val type: AdapterType
|
override val type: AdapterType
|
||||||
@ -20,7 +20,7 @@ class BinaryBusinessContentRepoContentAdapter(
|
|||||||
|
|
||||||
override suspend fun storeContent(contentId: ContentId, content: Content): Boolean {
|
override suspend fun storeContent(contentId: ContentId, content: Content): Boolean {
|
||||||
(content as? BinaryContent) ?.also {
|
(content as? BinaryContent) ?.also {
|
||||||
filesStore.set(it.originalFileName, it.dataAllocator())
|
filesStore.set(contentId, it.dataAllocator())
|
||||||
dataStore.set(
|
dataStore.set(
|
||||||
contentId,
|
contentId,
|
||||||
format.encodeToString(BinaryContent.serializer(), it.copy { ByteArray(0) })
|
format.encodeToString(BinaryContent.serializer(), it.copy { ByteArray(0) })
|
||||||
|
Loading…
Reference in New Issue
Block a user