CBLReplicator

@interface CBLReplicator : NSObject

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-short or continuous. The replicator runs asynchronously, so observe the status property to be notified of progress.

  • The replicator’s configuration.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        CBLReplicatorConfiguration *_Nonnull config;
  • The replicator’s current status: its activity level and progress. Observable.

    Declaration

    Objective-C

    @property (readonly, nonatomic) CBLReplicatorStatus *_Nonnull status;
  • Initializes a replicator with the given configuration.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithConfig:
        (nonnull CBLReplicatorConfiguration *)config;
  • Starts the replicator. This method returns immediately; the replicator runs asynchronously and will report its progress throuh the replicator change notification.

    Declaration

    Objective-C

    - (void)start;
  • Stops a running replicator. This method returns immediately; when the replicator actually stops, the replicator will change its status’s activity level to kCBLStopped and the replicator change notification will be notified accordingly.

    Declaration

    Objective-C

    - (void)stop;
  • Adds a replicator change listener block.

    Declaration

    Objective-C

    - (nonnull id<NSObject>)addChangeListener:
        (nonnull void (^)(CBLReplicatorChange *_Nonnull))block;

    Parameters

    block

    The block to be executed when the change is received.

    Return Value

    An opaque object to act as the listener and for removing the listener when calling the -removeChangeListener: method.

  • Removes a change listener. The given change listener is the opaque object returned by the -addChangeListener: method.

    Declaration

    Objective-C

    - (void)removeChangeListener:(nonnull id<NSObject>)listener;

    Parameters

    listener

    The listener object to be removed.