Skip to content

Commit

Permalink
Merge pull request #1274 from modelix/fix/for-legacy-sync-plugin
Browse files Browse the repository at this point in the history
Fixes for the legacy-sync-plugin
  • Loading branch information
slisson authored Dec 20, 2024
2 parents 545c046 + 3052d4b commit 5ed06af
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ actual open class ReplicatedRepository actual constructor(
var initialVersion = if (versionHash.isNullOrEmpty()) null else loadFromHash(versionHash, store)
val initialTree = MutableObject<CLTree>()
if (initialVersion == null) {
initialTree.setValue(CLTree.builder(store).repositoryId(branchReference.repositoryId).build())
initialTree.setValue(CLTree.builder(store).useRoleIds(false).repositoryId(branchReference.repositoryId).build())
initialVersion = createVersion(initialTree.value, arrayOf(), null)
client.asyncStore.put(branchReference.getKey(), initialVersion.getContentHash())
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import org.modelix.model.api.ITree
import org.modelix.model.api.async.getAncestors
import org.modelix.model.api.async.getDescendants
import org.modelix.model.async.AsyncAsSynchronousTree
import org.modelix.model.async.AsyncStoreAsLegacyDeserializingStore
import org.modelix.model.async.AsyncTree
import org.modelix.model.async.IAsyncObjectStore
import org.modelix.model.persistent.CPHamtInternal
Expand Down Expand Up @@ -58,7 +57,7 @@ class CLTree(val data: CPTree, val asyncStore: IAsyncObjectStore) : ITree by Asy
store,
)

val store: IDeserializingKeyValueStore = AsyncStoreAsLegacyDeserializingStore(asyncStore)
val store: IDeserializingKeyValueStore = asyncStore.getLegacyObjectStore()

override fun getId(): String = data.id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import org.modelix.model.api.PNodeReference
import org.modelix.model.api.TreePointer
import org.modelix.model.api.async.getDescendants
import org.modelix.model.async.AsyncAsSynchronousTree
import org.modelix.model.async.AsyncStoreAsLegacyDeserializingStore
import org.modelix.model.async.AsyncTree
import org.modelix.model.async.BulkQueryAsAsyncStore
import org.modelix.model.async.IAsyncObjectStore
Expand Down Expand Up @@ -277,7 +276,7 @@ class CLVersion : IVersion {
}

fun tryLoadFromHash(hash: String, store: IAsyncObjectStore): Maybe<CLVersion> {
return KVEntryReference(hash, CPVersion.DESERIALIZER).getValue(store).notNull().map { CLVersion(it, AsyncStoreAsLegacyDeserializingStore(store)) }
return KVEntryReference(hash, CPVersion.DESERIALIZER).getValue(store).notNull().map { CLVersion(it, store) }
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.modelix.model.lazy

import com.badoo.reaktive.single.Single
import org.modelix.model.async.AsyncStoreAsLegacyDeserializingStore
import org.modelix.model.async.IAsyncObjectStore
import org.modelix.model.persistent.IKVValue

Expand All @@ -13,5 +12,5 @@ interface IKVEntryReference<out E : IKVValue> {
fun getUnwrittenValue(): E
fun getDeserializer(): (String) -> E
fun write(store: IDeserializingKeyValueStore)
fun write(store: IAsyncObjectStore) = write(AsyncStoreAsLegacyDeserializingStore(store))
fun write(store: IAsyncObjectStore) = write(store.getLegacyObjectStore())
}

0 comments on commit 5ed06af

Please sign in to comment.