Replicator

A replicator for replicating document changes between a local database and a target database. The replicator can be bidirectional or either push or pull. The replicator can also be one-shot or continuous. The replicator runs asynchronously, so observe the status to be notified of progress.

actual class Replicator(config: ReplicatorConfiguration) : DelegatedClass<<Error class: unknown class>> , AutoCloseable(source)

Constructors

Link copied to clipboard
expect constructor(config: ReplicatorConfiguration)
actual constructor(config: ReplicatorConfiguration)
actual constructor(config: ReplicatorConfiguration)

Properties

Link copied to clipboard

The replicator's configuration.

Link copied to clipboard

Get a best effort set of document IDs in the default collection, that are still pending replication.

Link copied to clipboard

The server certificates received from the server during the TLS handshake.

Link copied to clipboard

The replicator's current status: its activity level and progress.

Functions

Link copied to clipboard

Adds a change listener for the changes in the replication status and progress.

Adds a change listener for the changes in the replication status and progress with a CoroutineContext that will be used to launch coroutines the listener will be called on. Coroutines will be launched in a CoroutineScope that is canceled when the listener is removed.

Adds a change listener for the changes in the replication status and progress with a CoroutineScope that will be used to launch coroutines the listener will be called on. The listener is removed when the scope is canceled.

Link copied to clipboard

Adds a document replication event listener.

Adds a document replication event listener with a CoroutineContext that will be used to launch coroutines the listener will be called on. Coroutines will be launched in a CoroutineScope that is canceled when the listener is removed.

Adds a document replication event listener with a CoroutineScope that will be used to launch coroutines the listener will be called on. The listener is removed when the scope is canceled.

Link copied to clipboard
expect open override fun close()
actual open override fun close()
actual open override fun close()
Link copied to clipboard

A Flow of document replications.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
expect fun getPendingDocumentIds(collection: Collection): Set<String>

Get a best effort list of documents in the passed collection that are still pending replication.

actual fun getPendingDocumentIds(collection: Collection): Set<String>
actual fun getPendingDocumentIds(collection: Collection): Set<String>
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
expect fun isDocumentPending(docId: String): Boolean
expect fun isDocumentPending(docId: String, collection: Collection): Boolean

Best effort check to see if the document whose ID is passed is still pending replication.

actual fun isDocumentPending(docId: String): Boolean
actual fun isDocumentPending(docId: String, collection: Collection): Boolean
actual fun isDocumentPending(docId: String): Boolean
actual fun isDocumentPending(docId: String, collection: Collection): Boolean
Link copied to clipboard

Remove the given ReplicatorChangeListener or DocumentReplicationListener from the replicator.

Link copied to clipboard

A Flow of replicator state changes.

Link copied to clipboard
expect fun start()

Start the replicator.

expect fun start(resetCheckpoint: Boolean)

Start the replicator. This method does not wait for the replicator to start. The replicator runs asynchronously and reports its progress through replicator change notifications.

actual fun start()
actual fun start(resetCheckpoint: Boolean)
actual fun start()
actual fun start(resetCheckpoint: Boolean)
Link copied to clipboard
expect fun stop()

Stop a running replicator. This method does not wait for the replicator to stop. When the replicator actually stops, it will broadcast a new state, STOPPED, to change listeners.

actual fun stop()
actual fun stop()
Link copied to clipboard
open override fun toString(): String