ModelClientV2

class ModelClientV2(httpClient: HttpClient, val baseUrl: String, clientProvidedUserId: String?) : IModelClientV2, IModelClientV2Internal, Closable

Constructors

Link copied to clipboard
constructor(httpClient: HttpClient, baseUrl: String, clientProvidedUserId: String?)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend override fun deleteBranch(branch: BranchReference): Boolean

Deletes a branch from a repository if it exists.

Link copied to clipboard
open suspend override fun deleteRepository(repository: RepositoryId): Boolean
Link copied to clipboard
open override fun getClientId(): Int
Link copied to clipboard
open override fun getIdGenerator(): IIdGenerator
Link copied to clipboard
open suspend override fun getObjects(repository: RepositoryId, keys: Sequence<ObjectHash>): Map<ObjectHash, SerializedObject>

Required for lazy loading. Use IModelClientV2.lazyLoadVersion

Link copied to clipboard
open override fun getUserId(): String?
Link copied to clipboard
suspend fun init()
Link copied to clipboard
open suspend override fun initRepository(repository: RepositoryId, useRoleIds: Boolean): IVersion
suspend fun initRepository(repository: RepositoryId, useRoleIds: Boolean = false, legacyGlobalStorage: Boolean = false): IVersion
Link copied to clipboard
open suspend override fun initRepositoryWithLegacyStorage(repository: RepositoryId): IVersion
Link copied to clipboard
suspend fun IModelClientV2.lazyLoadVersion(branchRef: BranchReference, config: CacheConfiguration = CacheConfiguration()): IVersion

An overload of IModelClientV2.lazyLoadVersion that reads the current version hash of the branch from the server and then loads that version with lazy loading support.

fun IModelClientV2.lazyLoadVersion(repositoryId: RepositoryId, versionHash: String, config: CacheConfiguration = CacheConfiguration()): IVersion

This function loads parts of the model lazily while it is iterated and limits the amount of data that is cached on the client side.

Link copied to clipboard
open suspend override fun listBranches(repository: RepositoryId): List<BranchReference>
Link copied to clipboard
open suspend override fun listRepositories(): List<RepositoryId>
Link copied to clipboard
open suspend override fun loadVersion(versionHash: String, baseVersion: IVersion?): IVersion
open suspend override fun loadVersion(repositoryId: RepositoryId, versionHash: String, baseVersion: IVersion?): IVersion
Link copied to clipboard
open suspend override fun poll(branch: BranchReference, lastKnownVersion: IVersion?): IVersion

While pull returns immediately poll returns as soon as a new version, that is different from the given lastKnownVersion, is pushed to the server or after some timeout specified by the server (usually ~30 seconds).

Link copied to clipboard
open suspend override fun pollHash(branch: BranchReference, lastKnownHash: String?): String
open suspend override fun pollHash(branch: BranchReference, lastKnownVersion: IVersion?): String
Link copied to clipboard
open suspend override fun pull(branch: BranchReference, lastKnownVersion: IVersion?): IVersion
Link copied to clipboard
open suspend override fun pullHash(branch: BranchReference): String
Link copied to clipboard
open suspend override fun pullIfExists(branch: BranchReference): IVersion?
Link copied to clipboard
open suspend override fun push(branch: BranchReference, version: IVersion, baseVersion: IVersion?): IVersion

The pushed version is merged automatically by the server with the current head. The merge result is returned.

Link copied to clipboard
open suspend override fun pushObjects(repository: RepositoryId, objects: Sequence<ObjectHashAndSerializedObject>)

Required for lazy loading. Use IModelClientV2.lazyLoadVersion

Link copied to clipboard
open suspend override fun <R> query(branch: BranchReference, body: (IMonoStep<INode>) -> IMonoStep<R>): R
open suspend override fun <R> query(repositoryId: RepositoryId, versionHash: String, body: (IMonoStep<INode>) -> IMonoStep<R>): R
Link copied to clipboard
suspend fun <T> IModelClientV2.runWrite(branchRef: BranchReference, body: (INode) -> T): T

Performs a write transaction on the root node of the given branch.

Link copied to clipboard
suspend fun <T> IModelClientV2.runWriteOnBranch(branchRef: BranchReference, body: (IBranch) -> T): T

Performs a write transaction on the root node of the given branch.

Link copied to clipboard

Set or remove the client provided user ID.

Link copied to clipboard
suspend fun updateUserId()