CBLReplicatorConfiguration

@interface CBLReplicatorConfiguration : NSObject

Replicator Configuration

  • Deprecated

    Use collectionConfigs instead

    The local database to replicate with the target endpoint.

    Declaration

    Objective-C

    @property (nonatomic, readonly) __deprecated_msg CBLDatabase *database;
  • The replication endpoint to replicate with.

    Declaration

    Objective-C

    @property (nonatomic, readonly) id<CBLEndpoint> _Nonnull target;
  • The collection configurations used for the replication. Each configuration specifies a collection and its configuration.

    Note

    Will be renamed to collections in the next major release.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSArray<CBLCollectionConfiguration *> *_Nonnull collectionConfigs;
  • Replication type indicating the direction of the replication. The default value is .pushAndPull which is bidrectional.

    Declaration

    Objective-C

    @property (nonatomic) int replicatorType;
  • Should the replicator stay active indefinitely, and push/pull changed documents?. The default value is NO.

    Declaration

    Objective-C

    @property (nonatomic) BOOL continuous;
  • An Authenticator to authenticate with a remote server. Currently there are two types of the authenticators, CBLBasicAuthenticator and CBLSessionAuthenticator, supported.

    Declaration

    Objective-C

    @property (nonatomic, nullable) CBLAuthenticator *authenticator;
  • The remote target’s SSL certificate.

    @Note: The pinned cert will be evaluated against any certs in a cert chain, and the cert chain will be valid only if the cert chain contains the pinned cert.

    Declaration

    Objective-C

    @property (nonatomic, nullable) SecCertificateRef pinnedServerCertificate;
  • Extra HTTP headers to send in all requests to the remote target.

    Declaration

    Objective-C

    @property (nonatomic, nullable) NSDictionary<NSString *, NSString *> *headers;
  • Specific network interface (e.g. en0 and pdp_ip0) for connecting to the remote target.

    Declaration

    Objective-C

    @property (nonatomic, nullable) NSString *networkInterface;
  • The option to remove the restriction that does not allow the replicator to save the parent-domain cookies, the cookies whose domains are the parent domain of the remote host, from the HTTP response. For example, when the option is set to true, the cookies whose domain are “.foo.com” returned by “bar.foo.com” host will be permitted to save.

    This option is disabled by default (See kCBLDefaultReplicatorAcceptParentCookies) which means that the parent-domain cookies are not permitted to save by default.

    Declaration

    Objective-C

    @property (nonatomic) BOOL acceptParentDomainCookies;
  • Deprecated

    Use -initWithCollections:target: instead.

    A set of Sync Gateway channel names to pull from for the default collection. Ignored for push replication.

    @Note: Channels are not supported in Peer-to-Peer and Database-to-Database replication.

    Declaration

    Objective-C

    @property (nonatomic, nullable) NSArray<NSString *> *channels;
  • Deprecated

    Use -initWithCollections:target: instead.

    A set of document IDs to filter by for the default collection. If given, only documents with these IDs will be pushed and/or pulled.

    Declaration

    Objective-C

    @property (nonatomic, nullable) NSArray<NSString *> *documentIDs;
  • Deprecated

    Use -initWithCollections:target: instead.

    A push filter for the default collection. Only documents for which the filter returns true are replicated.

    Declaration

    Objective-C

    @property (nonatomic) int pushFilter;
  • Deprecated

    Use -initWithCollections:target: instead.

    A pull filter for the default collection. Only documents for which the closure returns true are replicated.

    Declaration

    Objective-C

    @property (nonatomic) int pullFilter;
  • Deprecated

    Use -initWithCollections:target: instead.

    The custom conflict resolver for the default collection. If this value is not set, or set to nil, the default conflict resolver will be applied.

    Declaration

    Objective-C

    @property (nonatomic, nullable) id<CBLConflictResolver> conflictResolver;
  • The heartbeat interval in second.

    The interval when the replicator sends the ping message to check whether the other peer is still alive. Default heartbeat is kCBLDefaultReplicatorHeartbeat seconds.

    @Note: Setting the heartbeat to negative value will result in InvalidArgumentException being thrown. For backward compatibility, setting to zero will result in default heartbeat internally.

    Declaration

    Objective-C

    @property (nonatomic) NSTimeInterval heartbeat;
  • The maximum attempts to perform retry. The retry attempt will be reset when the replicator is able to connect and replicate with the remote server again.

    Default maxAttempts is kCBLDefaultReplicatorMaxAttemptsSingleShot times for single shot replicators and kCBLDefaultReplicatorMaxAttemptsContinuous times for continuous replicators.

    Settings the value to 1, will perform an initial request and if there is a transient error occurs, will stop without retry.

    @Note: For backward compatibility, setting it to zero will result in default maxAttempt internally.

    Declaration

    Objective-C

    @property (nonatomic) NSUInteger maxAttempts;
  • Max wait time for the next attempt(retry).

    The exponential backoff for calculating the wait time will be used by default and cannot be customized. Default max attempts is kCBLDefaultReplicatorMaxAttemptsWaitTime seconds.

    @Note: Set the maxAttemptWaitTime to negative value will result in InvalidArgumentException being thrown. For backward compatibility, setting it to zero will result in default maxAttemptWaitTime internally.

    Declaration

    Objective-C

    @property (nonatomic) NSTimeInterval maxAttemptWaitTime;
  • To enable/disable the auto purge feature

    The default value is true which means that the document will be automatically purged by the pull replicator when the user loses access to the document from both removed and revoked scenarios.

    When the property is set to false, this behavior is disabled and an access removed event will be sent to any document listeners that are active on the replicator. For performance reasons, the document listeners must be added before the replicator is started or they will not receive the events.

    @Note: Auto purge will not be performed when documentIDs filter is specified.

    Declaration

    Objective-C

    @property (nonatomic) BOOL enableAutoPurge;
  • Deprecated

    Use collectionConfigs instead.

    The collections used for the replication.

    Note

    Will be reintroduced, as array of CBLCollectionConfiguration, in the next major release.

    Declaration

    Objective-C

    @property (nonatomic, readonly) __deprecated_msg NSArray<CBLCollection *> *collections;
  • Unavailable

    Not available

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Deprecated

    Use -initWithCollections:target: instead.

    Initializes a CBLReplicatorConfiguration with the given database and the target’s endpoint.

    When using this initializer, the default collection of the given database will be automatically included in the configuration.

    If you do not intend to replicate the default collection, use -initWithCollections:target: instead to explicity specifiy the intended collections.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDatabase:(nonnull CBLDatabase *)database
                                      target:(nonnull id<CBLEndpoint>)target;

    Parameters

    database

    The database.

    target

    The target endpoint.

    Return Value

    The CBLReplicatorConfiguration object.

  • Deprecated

    Use -initWithCollections:target: instead.

    Initializes a CBLReplicatorConfiguration with the target’s endpoint.

    After the ReplicatorConfiguration object is created, use addCollection(_ collection:, config:) or addCollections(_ collections:, config:) to specify and configure the collections used for replicating with the target. If there are no collections specified, the replicator will fail to start with a no collections specified error.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithTarget:(nonnull id<CBLEndpoint>)target;

    Parameters

    target

    The target endpoint.

    Return Value

    The CBLReplicatorConfiguration object.

  • Initializes a CBLReplicatorConfiguration with the specified collection configurations and target’s endpoint.

    Each CBLCollectionConfiguration in the collections array must be initialized using -initWithCollection:.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithCollections:
                                (nonnull NSArray<CBLCollectionConfiguration *> *)
                                    collections
                                         target:(nonnull id<CBLEndpoint>)target;

    Parameters

    collections

    An array of collection configurations to replicate.

    target

    The target endpoint.

  • Initializes a CBLReplicatorConfiguration with the configuration object.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithConfig:
        (nonnull CBLReplicatorConfiguration *)config;

    Parameters

    config

    The configuration.

    Return Value

    The CBLReplicatorConfiguration object.

  • Deprecated

    Use -initWithCollections:target: instead.

    Add a collection used for the replication with an optional collection configuration. If the collection has been added before, the previous added and its configuration if specified will be replaced. If a null configuration is specified, a default empty configuration will be applied.

    Declaration

    Objective-C

    - (void)addCollection:(nonnull CBLCollection *)collection
                   config:(nullable CBLCollectionConfiguration *)config;

    Parameters

    collection

    The collection to be added.

    config

    Configuration for the collection, if nil, default config

  • Deprecated

    Use -initWithCollections:target: instead.

    Add multiple collections used for the replication with an optional shared collection configuration. If any of the collections have been added before, the previously added collections and their configuration if specified will be replaced. Adding an empty collection array will be no-ops. if specified will be replaced.

    If a null configuration is specified, a default empty configuration will be applied.

    Declaration

    Objective-C

    - (void)addCollections:(nonnull NSArray *)collections
                    config:(nullable CBLCollectionConfiguration *)config;

    Parameters

    collections

    The collections to be added.

    config

    Respective configuration for the collections, if nil, default config

  • Deprecated

    Use -initWithCollections:target: instead.

    Remove the collection. If the collection doesn’t exist, this operation will be no ops.

    Declaration

    Objective-C

    - (void)removeCollection:(nonnull CBLCollection *)collection;

    Parameters

    collection

    The collection to be removed.

  • Deprecated

    Use collectionConfigs instead.

    Get a copy of the collection’s config. If the config needs to be changed for the collection, the collection will need to be re-added with the updated config.

    Declaration

    Objective-C

    - (nullable CBLCollectionConfiguration *)collectionConfig:
        (nonnull CBLCollection *)collection;

    Parameters

    collection

    The collection whose config is needed.

    Return Value

    The collection configuration, or nil if config doesn’t exist

ServerCert