ReplicatorConfiguration

public struct ReplicatorConfiguration

Replicator configuration.

  • The local database to replicate with the replication target.

    Declaration

    Swift

    public let database: Database
  • The replication target to replicate with.

    Declaration

    Swift

    public let target: Endpoint
  • Replicator type indicating the direction of the replicator.

    Declaration

    Swift

    public var replicatorType: ReplicatorType
  • The continuous flag indicating whether the replicator should stay active indefinitely to replicate changed documents.

    Declaration

    Swift

    public var continuous: Bool
  • The Authenticator to authenticate with a remote target.

    Declaration

    Swift

    public var authenticator: Authenticator?
  • Specify the replicator to accept any and only self-signed certs. Any non-self-signed certs will be rejected to avoid accidentally using this mode with the non-self-signed certs in production.

    Declaration

    Swift

    public var acceptOnlySelfSignedServerCertificate: Bool
  • The remote target’s SSL certificate.

    Declaration

    Swift

    public var pinnedServerCertificate: SecCertificate?
  • Extra HTTP headers to send in all requests to the remote target.

    Declaration

    Swift

    public var headers: Dictionary<String, String>?
  • Specific network interface for connecting to the remote target.

    Declaration

    Swift

    public var networkInterface: String?
  • A set of Sync Gateway channel names to pull from. Ignored for push replication. If unset, all accessible channels will be pulled. Note: channels that are not accessible to the user will be ignored by Sync Gateway.

    Declaration

    Swift

    public var channels: [String]?
  • A set of document IDs to filter by: if given, only documents with these IDs will be pushed and/or pulled.

    Declaration

    Swift

    public var documentIDs: [String]?
  • Filter closure for validating whether the documents can be pushed to the remote endpoint. Only documents for which the closure returns true are replicated.

    Declaration

    Swift

    public var pushFilter: ReplicationFilter?
  • Filter closure for validating whether the documents can be pulled from the remote endpoint. Only documents for which the closure returns true are replicated.

    Declaration

    Swift

    public var pullFilter: ReplicationFilter?
  • The custom conflict resolver object can be set here. If this value is not set, or set to nil, the default conflict resolver will be applied.

    Declaration

    Swift

    public var conflictResolver: ConflictResolverProtocol?
  • Allows the replicator to continue replicating in the background. The default value is NO, which means that the replicator will suspend itself when the replicator detects that the application is running in the background.

    If setting the value to YES, please ensure that the application requests for extending the background task properly.

    Declaration

    Swift

    public var allowReplicatingInBackground: Bool
  • The heartbeat interval in second.

    The interval when the replicator sends the ping message to check whether the other peer is still alive. Set the value to zero(by default) means using the default heartbeat of 300 seconds.

    Note: Setting the heartbeat to negative value will result in InvalidArgumentException being thrown.

    Declaration

    Swift

    public var heartbeat: TimeInterval { get set }
  • 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.

    When setting the _maxAttempts to zero(default), the default maxAttempts of 10 times for single shot replicators and infinite times for continuous replicators will be applied and present to users. Settings the value to 1 will result in, will perform an initial request and if there is a transient error occurs, will stop will retrying

    Declaration

    Swift

    public var maxAttempts: UInt
  • 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. Set the value to zero(by default) means using the default max attempts of 300 seconds.

    Set the maxAttemptWaitTime to negative value will result in InvalidArgumentException being thrown.

    Declaration

    Swift

    public var maxAttemptWaitTime: TimeInterval { get set }
  • 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.

    Declaration

    Swift

    public var enableAutoPurge: Bool
  • Initializes a ReplicatorConfiguration’s builder with the given local database and the replication target.

    Declaration

    Swift

    public init(database: Database, target: Endpoint)

    Parameters

    database

    The local database.

    target

    The replication target.

  • Initializes a ReplicatorConfiguration’s builder with the given configuration object.

    Declaration

    Swift

    public init(config: ReplicatorConfiguration)

    Parameters

    config

    The configuration object.