Replicator

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

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.

Parameters

config

replicator configuration

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

Constructors

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

Initializes a replicator with the given configuration.

actual constructor(config: ReplicatorConfiguration)
actual constructor(config: ReplicatorConfiguration)

Properties

Link copied to clipboard

The replicator's configuration.

Link copied to clipboard
actual val isClosed: Boolean
expect val isClosed: Boolean

Determine whether this replicator has been closed.

actual val isClosed: Boolean
actual val isClosed: Boolean
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.

actual fun addChangeListener(context: <Error class: unknown class>, listener: ReplicatorChangeSuspendListener): ListenerToken
actual fun addChangeListener(scope: <Error class: unknown class>, listener: ReplicatorChangeSuspendListener)
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.

actual fun addDocumentReplicationListener(context: <Error class: unknown class>, listener: DocumentReplicationSuspendListener): ListenerToken
actual fun addDocumentReplicationListener(scope: <Error class: unknown class>, listener: DocumentReplicationSuspendListener)
Link copied to clipboard
actual open override fun close()
expect open override fun close()

Immediately close the replicator and free its resources. We recommend the use of this method on Replicators that are in the STOPPED state. If the replicator is not stopped, this method will make a best effort attempt to stop it but will not wait to confirm that it was stopped cleanly. Any attempt to restart a closed replicator will result in a CouchbaseLiteError. This includes calls to getPendingDocIds and isDocPending.

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
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
actual fun getPendingDocumentIds(collection: Collection): Set<String>
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
open override fun hashCode(): Int
Link copied to clipboard
actual fun isDocumentPending(docId: String, collection: Collection): 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, collection: Collection): Boolean
actual fun isDocumentPending(docId: String, collection: Collection): Boolean
Link copied to clipboard

A Flow of replicator state changes.

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

Start the replicator.

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

Stop a running replicator, first cancelling any pending conflict resolutions. 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
open override fun toString(): String