Skip to content

Commit

Permalink
Merge pull request #232 from modelix/MODELIX-524
Browse files Browse the repository at this point in the history
MODELIX-524 unstable ReplicatedRepositoryTest
  • Loading branch information
slisson authored Sep 22, 2023
2 parents 3437608 + 35a0129 commit 2049ba0
Show file tree
Hide file tree
Showing 9 changed files with 529 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import org.modelix.model.IVersion
import org.modelix.model.api.IIdGenerator
import org.modelix.model.lazy.BranchReference
import org.modelix.model.lazy.RepositoryId
import org.modelix.model.server.api.ModelQuery

/**
* This interface is meant exclusively for model client usage.
Expand Down Expand Up @@ -53,8 +52,6 @@ interface IModelClientV2 {
suspend fun push(branch: BranchReference, version: IVersion, baseVersion: IVersion?): IVersion

suspend fun pull(branch: BranchReference, lastKnownVersion: IVersion?): IVersion
suspend fun pull(branch: BranchReference, lastKnownVersion: IVersion?, filter: ModelQuery): IVersion

suspend fun poll(branch: BranchReference, lastKnownVersion: IVersion?): IVersion
suspend fun poll(branch: BranchReference, lastKnownVersion: IVersion?, filter: ModelQuery): IVersion
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ import org.modelix.model.lazy.ObjectStoreCache
import org.modelix.model.lazy.RepositoryId
import org.modelix.model.lazy.computeDelta
import org.modelix.model.persistent.HashUtil
import org.modelix.model.persistent.MapBaseStore
import org.modelix.model.server.api.ModelQuery
import org.modelix.model.persistent.MapBasedStore
import org.modelix.model.server.api.v2.VersionDelta
import kotlin.time.Duration.Companion.seconds

Expand All @@ -54,7 +53,7 @@ class ModelClientV2(
private var clientId: Int = 0
private var idGenerator: IIdGenerator = IdGeneratorDummy()
private var userId: String? = null
private val kvStore = MapBaseStore()
private val kvStore = MapBasedStore()
val store = ObjectStoreCache(kvStore) // TODO the store will accumulate garbage

suspend fun init() {
Expand Down Expand Up @@ -168,6 +167,7 @@ class ModelClientV2(

override suspend fun poll(branch: BranchReference, lastKnownVersion: IVersion?): IVersion {
require(lastKnownVersion is CLVersion?)
LOG.debug { "${clientId.toString(16)}.poll($branch, $lastKnownVersion)" }
val response = httpClient.get {
url {
takeFrom(baseUrl)
Expand All @@ -182,14 +182,6 @@ class ModelClientV2(
return receivedVersion
}

override suspend fun pull(branch: BranchReference, lastKnownVersion: IVersion?, filter: ModelQuery): IVersion {
TODO("Not yet implemented")
}

override suspend fun poll(branch: BranchReference, lastKnownVersion: IVersion?, filter: ModelQuery): IVersion {
TODO("Not yet implemented")
}

override fun close() {
httpClient.close()
}
Expand Down
Loading

0 comments on commit 2049ba0

Please sign in to comment.