Skip to content

Commit 3052d4b

Browse files
committed
fix(model-datastructure): repeated wrapping with AsyncStoreAsLegacyDeserializingStore
`AsyncStoreAsLegacyDeserializingStore` and are adapters `LegacyDeserializingStoreAsAsyncStore` that convert between `IDeserializingKeyValueStore` and `IAsyncObjectStore`. While converting between these two interfaces, another adapter was added instead of unwrapping an existing one, causing the call stack to keep growing util it was to large (StackOverflowError).
1 parent 1d3f559 commit 3052d4b

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

model-datastructure/src/commonMain/kotlin/org/modelix/model/lazy/CLTree.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import org.modelix.model.api.ITree
1212
import org.modelix.model.api.async.getAncestors
1313
import org.modelix.model.api.async.getDescendants
1414
import org.modelix.model.async.AsyncAsSynchronousTree
15-
import org.modelix.model.async.AsyncStoreAsLegacyDeserializingStore
1615
import org.modelix.model.async.AsyncTree
1716
import org.modelix.model.async.IAsyncObjectStore
1817
import org.modelix.model.persistent.CPHamtInternal
@@ -58,7 +57,7 @@ class CLTree(val data: CPTree, val asyncStore: IAsyncObjectStore) : ITree by Asy
5857
store,
5958
)
6059

61-
val store: IDeserializingKeyValueStore = AsyncStoreAsLegacyDeserializingStore(asyncStore)
60+
val store: IDeserializingKeyValueStore = asyncStore.getLegacyObjectStore()
6261

6362
override fun getId(): String = data.id
6463

model-datastructure/src/commonMain/kotlin/org/modelix/model/lazy/CLVersion.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import org.modelix.model.api.PNodeReference
2222
import org.modelix.model.api.TreePointer
2323
import org.modelix.model.api.async.getDescendants
2424
import org.modelix.model.async.AsyncAsSynchronousTree
25-
import org.modelix.model.async.AsyncStoreAsLegacyDeserializingStore
2625
import org.modelix.model.async.AsyncTree
2726
import org.modelix.model.async.BulkQueryAsAsyncStore
2827
import org.modelix.model.async.IAsyncObjectStore
@@ -277,7 +276,7 @@ class CLVersion : IVersion {
277276
}
278277

279278
fun tryLoadFromHash(hash: String, store: IAsyncObjectStore): Maybe<CLVersion> {
280-
return KVEntryReference(hash, CPVersion.DESERIALIZER).getValue(store).notNull().map { CLVersion(it, AsyncStoreAsLegacyDeserializingStore(store)) }
279+
return KVEntryReference(hash, CPVersion.DESERIALIZER).getValue(store).notNull().map { CLVersion(it, store) }
281280
}
282281
}
283282

model-datastructure/src/commonMain/kotlin/org/modelix/model/lazy/IKVEntryReference.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.modelix.model.lazy
22

33
import com.badoo.reaktive.single.Single
4-
import org.modelix.model.async.AsyncStoreAsLegacyDeserializingStore
54
import org.modelix.model.async.IAsyncObjectStore
65
import org.modelix.model.persistent.IKVValue
76

@@ -13,5 +12,5 @@ interface IKVEntryReference<out E : IKVValue> {
1312
fun getUnwrittenValue(): E
1413
fun getDeserializer(): (String) -> E
1514
fun write(store: IDeserializingKeyValueStore)
16-
fun write(store: IAsyncObjectStore) = write(AsyncStoreAsLegacyDeserializingStore(store))
15+
fun write(store: IAsyncObjectStore) = write(store.getLegacyObjectStore())
1716
}

0 commit comments

Comments
 (0)