Builder

class Builder

Used to create a SyncConfiguration. For common use cases, a SyncConfiguration can be created using the SyncConfiguration.create function.

Constructors

Builder
Link copied to clipboard
fun Builder(user: User, schema: Set<KClass<out <ERROR CLASS>>>)

Creates a SyncConfiguration.Builder for Flexible Sync. Flexible Sync must be enabled on the server for this to work.

Builder
Link copied to clipboard
fun Builder(user: User, partitionValue: <ERROR CLASS>?, schema: Set<KClass<out <ERROR CLASS>>>)

Creates a SyncConfiguration.Builder for Partition-Based Sync. Partition-Based Sync must be enabled on the server for this to work.

Builder
Link copied to clipboard
fun Builder(user: User, partitionValue: <ERROR CLASS>?, schema: Set<KClass<out <ERROR CLASS>>>)

Creates a SyncConfiguration.Builder for Partition-Based Sync. Partition-Based Sync must be enabled on the server for this to work.

Builder
Link copied to clipboard
fun Builder(user: User, partitionValue: <ERROR CLASS>?, schema: Set<KClass<out <ERROR CLASS>>>)

Creates a SyncConfiguration.Builder for Partition-Based Sync. Partition-Based Sync must be enabled on the server for this to work.

Builder
Link copied to clipboard
fun Builder(user: User, partitionValue: Int?, schema: Set<KClass<out <ERROR CLASS>>>)

Creates a SyncConfiguration.Builder for Partition-Based Sync. Partition-Based Sync must be enabled on the server for this to work.

Builder
Link copied to clipboard
fun Builder(user: User, partitionValue: Long?, schema: Set<KClass<out <ERROR CLASS>>>)

Creates a SyncConfiguration.Builder for Partition-Based Sync. Partition-Based Sync must be enabled on the server for this to work.

Builder
Link copied to clipboard
fun Builder(user: User, partitionValue: String?, schema: Set<KClass<out <ERROR CLASS>>>)

Creates a SyncConfiguration.Builder for Partition-Based Sync. Partition-Based Sync must be enabled on the server for this to work.

Functions

build
Link copied to clipboard
open fun build(): SyncConfiguration
errorHandler
Link copied to clipboard
fun errorHandler(errorHandler: SyncSession.ErrorHandler): SyncConfiguration.Builder

Sets the error handler used by Synced Realms when reporting errors with their session.

initialSubscriptions
Link copied to clipboard
fun initialSubscriptions(rerunOnOpen: Boolean = false, initialSubscriptionBlock: InitialSubscriptionsCallback): SyncConfiguration.Builder

Define the initial io.realm.mongodb.sync.SubscriptionSet for the Realm. This will only be executed the first time the Realm file is opened (and the file created).

log
Link copied to clipboard
open fun log(level: <ERROR CLASS>, customLoggers: List<<ERROR CLASS>>): SyncConfiguration.Builder
name
Link copied to clipboard
open fun name(name: String): SyncConfiguration.Builder

Sets the filename of the realm file.

syncClientResetStrategy
Link copied to clipboard
fun syncClientResetStrategy(resetStrategy: SyncClientResetStrategy): SyncConfiguration.Builder

Sets the strategy that would handle the client reset by this synced Realm.

waitForInitialRemoteData
Link copied to clipboard
fun waitForInitialRemoteData(timeout: Duration = Duration.INFINITE): SyncConfiguration.Builder

Setting this will cause the Realm to download all known changes from the server the first time a Realm is opened. The Realm will not open until all the data has been downloaded. This means that if a device is offline the Realm will not open.