diff --git a/model-server/src/main/kotlin/org/modelix/model/server/store/IImmutableStore.kt b/model-server/src/main/kotlin/org/modelix/model/server/store/IImmutableStore.kt index ac21f13fa9..220ce1ea6e 100644 --- a/model-server/src/main/kotlin/org/modelix/model/server/store/IImmutableStore.kt +++ b/model-server/src/main/kotlin/org/modelix/model/server/store/IImmutableStore.kt @@ -7,7 +7,7 @@ import org.modelix.model.IGenericKeyListener * Doesn't require transactions. */ interface IImmutableStore { - fun getAll(keys: Set): Map + fun getAll(keys: Set): Map fun addAll(entries: Map) fun getIfCached(key: KeyT): String? } diff --git a/model-server/src/main/kotlin/org/modelix/model/server/store/IgniteStoreClient.kt b/model-server/src/main/kotlin/org/modelix/model/server/store/IgniteStoreClient.kt index de3642b3fc..fb5d3aeeff 100644 --- a/model-server/src/main/kotlin/org/modelix/model/server/store/IgniteStoreClient.kt +++ b/model-server/src/main/kotlin/org/modelix/model/server/store/IgniteStoreClient.kt @@ -248,13 +248,9 @@ class IgniteStoreClient(jdbcProperties: Properties? = null, private val inmemory override fun getImmutableStore(): IImmutableStore { return object : IImmutableStore { - override fun getAll(keys: Set): Map { + override fun getAll(keys: Set): Map { keys.forEach { require(HashUtil.isSha256(it.key)) { "Not an immutable object: $it" } } - return cache.getAll(keys).mapValues { - val value = it.value - if (value == null) throw ObjectValueNotFoundException(it.key.key) - value - } + return cache.getAll(keys) } override fun addAll(entries: Map) { diff --git a/model-server/src/main/kotlin/org/modelix/model/server/store/InMemoryStoreClient.kt b/model-server/src/main/kotlin/org/modelix/model/server/store/InMemoryStoreClient.kt index bcb1520bc8..379b78653d 100644 --- a/model-server/src/main/kotlin/org/modelix/model/server/store/InMemoryStoreClient.kt +++ b/model-server/src/main/kotlin/org/modelix/model/server/store/InMemoryStoreClient.kt @@ -138,14 +138,10 @@ class InMemoryStoreClient : IsolatingStore, ITransactionManager, IRepositoryAwar override fun getImmutableStore(): IImmutableStore { return object : IImmutableStore { - override fun getAll(keys: Set): Map { + override fun getAll(keys: Set): Map { keys.forEach { require(HashUtil.isSha256(it.key)) { "Not an immutable object: $it" } } @OptIn(RequiresTransaction::class) - return runRead { this@InMemoryStoreClient.getAll(keys) }.mapValues { - val value = it.value - if (value == null) throw ObjectValueNotFoundException(it.key.key) - value - } + return runRead { this@InMemoryStoreClient.getAll(keys) } } override fun addAll(entries: Map) { diff --git a/model-server/src/main/kotlin/org/modelix/model/server/store/StoreClientAdapter.kt b/model-server/src/main/kotlin/org/modelix/model/server/store/StoreClientAdapter.kt index 4e358e6a47..9b0cba96c0 100644 --- a/model-server/src/main/kotlin/org/modelix/model/server/store/StoreClientAdapter.kt +++ b/model-server/src/main/kotlin/org/modelix/model/server/store/StoreClientAdapter.kt @@ -90,7 +90,7 @@ abstract class StoreClientAdapter(val client: IsolatingStore) : IStoreClient { override fun getImmutableStore(): IImmutableStore { val immutableStore = client.getImmutableStore() return object : IImmutableStore { - override fun getAll(keys: Set): Map { + override fun getAll(keys: Set): Map { val fromRepository = immutableStore.getAll(keys.map { it.withRepoScope() }.toSet()).mapKeys { it.key.key } if (getRepositoryId() == null) return fromRepository