diff --git a/CHANGELOG.md b/CHANGELOG.md index e809c3537ed..6ddc4552f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.20.41 + +* `Repos`: + * `Exposed`: + * `AbstractExposedKeyValueRepo`, `ExposedKeyValueRepo`, `AbstractExposedKeyValuesRepo`, `ExposedKeyValuesRepo` got opportunity to setup some part of their flows + ## 0.20.40 * `Versions`: diff --git a/gradle.properties b/gradle.properties index 7d58add5a9c..f4122ea9eb3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,5 +15,5 @@ crypto_js_version=4.1.1 # Project data group=dev.inmo -version=0.20.40 -android_code_version=246 +version=0.20.41 +android_code_version=247 diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedKeyValueRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedKeyValueRepo.kt index aade9f36a6e..a5a939c1b10 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedKeyValueRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedKeyValueRepo.kt @@ -1,6 +1,7 @@ package dev.inmo.micro_utils.repos.exposed.keyvalue import dev.inmo.micro_utils.repos.KeyValueRepo +import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.* import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.statements.* @@ -8,13 +9,15 @@ import org.jetbrains.exposed.sql.transactions.transaction abstract class AbstractExposedKeyValueRepo( override val database: Database, - tableName: String? = null + tableName: String? = null, + flowsExtraBufferCapacity: Int = Int.MAX_VALUE, + flowsBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND ) : KeyValueRepo, AbstractExposedReadKeyValueRepo( database, tableName ) { - protected val _onNewValue = MutableSharedFlow>() - protected val _onValueRemoved = MutableSharedFlow() + protected val _onNewValue = MutableSharedFlow>(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) + protected val _onValueRemoved = MutableSharedFlow(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) override val onNewValue: Flow> = _onNewValue.asSharedFlow() override val onValueRemoved: Flow = _onValueRemoved.asSharedFlow() diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/ExposedKeyValueRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/ExposedKeyValueRepo.kt index 3bfe88f1dcd..491d04a96d8 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/ExposedKeyValueRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/ExposedKeyValueRepo.kt @@ -2,6 +2,7 @@ package dev.inmo.micro_utils.repos.exposed.keyvalue import dev.inmo.micro_utils.repos.KeyValueRepo import dev.inmo.micro_utils.repos.exposed.ColumnAllocator +import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.* import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq @@ -13,15 +14,17 @@ open class ExposedKeyValueRepo( database: Database, keyColumnAllocator: ColumnAllocator, valueColumnAllocator: ColumnAllocator, - tableName: String? = null + tableName: String? = null, + flowsExtraBufferCapacity: Int = Int.MAX_VALUE, + flowsBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND ) : KeyValueRepo, ExposedReadKeyValueRepo( database, keyColumnAllocator, valueColumnAllocator, tableName ) { - protected val _onNewValue = MutableSharedFlow>() - protected val _onValueRemoved = MutableSharedFlow() + protected val _onNewValue = MutableSharedFlow>(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) + protected val _onValueRemoved = MutableSharedFlow(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) override val onNewValue: Flow> = _onNewValue.asSharedFlow() override val onValueRemoved: Flow = _onValueRemoved.asSharedFlow() diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedKeyValuesRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedKeyValuesRepo.kt index 736860575e5..f7d0fb5e3c6 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedKeyValuesRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedKeyValuesRepo.kt @@ -1,6 +1,7 @@ package dev.inmo.micro_utils.repos.exposed.onetomany import dev.inmo.micro_utils.repos.KeyValuesRepo +import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.* import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.statements.InsertStatement @@ -8,18 +9,20 @@ import org.jetbrains.exposed.sql.transactions.transaction abstract class AbstractExposedKeyValuesRepo( override val database: Database, - tableName: String? = null + tableName: String? = null, + flowsExtraBufferCapacity: Int = Int.MAX_VALUE, + flowsBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND ) : KeyValuesRepo, AbstractExposedReadKeyValuesRepo( database, tableName ) { - protected val _onNewValue: MutableSharedFlow> = MutableSharedFlow() + protected val _onNewValue: MutableSharedFlow> = MutableSharedFlow(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) override val onNewValue: Flow> get() = _onNewValue.asSharedFlow() - protected val _onValueRemoved: MutableSharedFlow> = MutableSharedFlow() + protected val _onValueRemoved: MutableSharedFlow> = MutableSharedFlow(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) override val onValueRemoved: Flow> get() = _onValueRemoved.asSharedFlow() - protected val _onDataCleared: MutableSharedFlow = MutableSharedFlow() + protected val _onDataCleared: MutableSharedFlow = MutableSharedFlow(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) override val onDataCleared: Flow get() = _onDataCleared.asSharedFlow() diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/ExposedKeyValuesRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/ExposedKeyValuesRepo.kt index 1688a52503e..da7a46cde7b 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/ExposedKeyValuesRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/ExposedKeyValuesRepo.kt @@ -2,6 +2,7 @@ package dev.inmo.micro_utils.repos.exposed.onetomany import dev.inmo.micro_utils.repos.KeyValuesRepo import dev.inmo.micro_utils.repos.exposed.ColumnAllocator +import kotlinx.coroutines.channels.BufferOverflow import kotlinx.coroutines.flow.* import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq @@ -13,20 +14,22 @@ open class ExposedKeyValuesRepo( database: Database, keyColumnAllocator: ColumnAllocator, valueColumnAllocator: ColumnAllocator, - tableName: String? = null + tableName: String? = null, + flowsExtraBufferCapacity: Int = Int.MAX_VALUE, + flowsBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND ) : KeyValuesRepo, ExposedReadKeyValuesRepo( database, keyColumnAllocator, valueColumnAllocator, tableName ) { - protected val _onNewValue: MutableSharedFlow> = MutableSharedFlow() + protected val _onNewValue: MutableSharedFlow> = MutableSharedFlow(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) override val onNewValue: Flow> get() = _onNewValue - protected val _onValueRemoved: MutableSharedFlow> = MutableSharedFlow() + protected val _onValueRemoved: MutableSharedFlow> = MutableSharedFlow(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) override val onValueRemoved: Flow> get() = _onValueRemoved - protected val _onDataCleared: MutableSharedFlow = MutableSharedFlow() + protected val _onDataCleared: MutableSharedFlow = MutableSharedFlow(extraBufferCapacity = flowsExtraBufferCapacity, onBufferOverflow = flowsBufferOverflow) override val onDataCleared: Flow get() = _onDataCleared