From 6370562dbc4807e9bc6bd83d241010be01fc6db5 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 1 Apr 2024 18:12:25 +0600 Subject: [PATCH 1/2] start 0.20.41 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e809c3537ed..89b6198980b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.20.41 + ## 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 From 4f7f8abec4274e4d53cf8ae5bd317b1530f609c5 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 1 Apr 2024 18:20:05 +0600 Subject: [PATCH 2/2] improve exposed repos --- CHANGELOG.md | 4 ++++ .../exposed/keyvalue/AbstractExposedKeyValueRepo.kt | 9 ++++++--- .../repos/exposed/keyvalue/ExposedKeyValueRepo.kt | 9 ++++++--- .../exposed/onetomany/AbstractExposedKeyValuesRepo.kt | 11 +++++++---- .../repos/exposed/onetomany/ExposedKeyValuesRepo.kt | 11 +++++++---- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89b6198980b..6ddc4552f01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 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/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