Class ReplicatorConfiguration
A class representing configuration options for a Replicator
Inheritance
Inherited Members
Namespace: Couchbase.Lite.Sync
Assembly: Couchbase.Lite.dll
Syntax
public sealed class ReplicatorConfiguration
Constructors
| Improve this Doc View SourceReplicatorConfiguration(Database, IEndpoint)
[DEPRECATED] Constructs a new builder object with the required properties
Declaration
[Obsolete("Constructor ReplicatorConfiguration(Database, IEndpoint) is deprecated, please use ReplicatorConfiguration(IEndpoint)")]
public ReplicatorConfiguration(Database database, IEndpoint target)
Parameters
Type | Name | Description |
---|---|---|
Database | database | The database that will serve as the local side of the replication |
IEndpoint | target | The endpoint to replicate to, either local or remote |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown if an unsupported IEndpoint implementation
is provided as |
ReplicatorConfiguration(IEndpoint)
Constructs a new builder object with the required properties
Declaration
public ReplicatorConfiguration(IEndpoint target)
Parameters
Type | Name | Description |
---|---|---|
IEndpoint | target | The endpoint to replicate to, either local or remote |
Remarks
After the ReplicatorConfiguration created, use AddCollection(Collection, CollectionConfiguration) or AddCollections(IList<Collection>, CollectionConfiguration) to configure the collections in the replication with the target. If there is no collection specified, the replicator will not start with a no collections specified error.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown if an unsupported IEndpoint implementation
is provided as |
Properties
| Improve this Doc View SourceAcceptOnlySelfSignedServerCertificate
Get or set the way that the replicator will validate TLS certificates. This
property will be overriden if the PinnedServerCertificate property
is set.
Default value is
Declaration
public bool AcceptOnlySelfSignedServerCertificate { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
NOTE: This is an enterprise edition feature
AcceptParentDomainCookies
Gets or sets whether or not a cookie can be set on a parent domain of the host that issued it (i.e. foo.bar.com can set a cookie for all of bar.com). This is only recommended if the host issuing the cookie is well trusted.
Declaration
public bool AcceptParentDomainCookies { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Authenticator
Gets or sets the class which will authenticate the replication
Declaration
public Authenticator Authenticator { get; set; }
Property Value
Type | Description |
---|---|
Authenticator |
Channels
[DEPRECATED] A set of Sync Gateway channel names to pull from. Ignored for push replicatoin. The default value is null, meaning that all accessible channels will be pulled. Note: channels that are not accessible to the user will be ignored by Sync Gateway.
Declaration
[Obsolete("Channels is deprecated, please use CollectionConfiguration.Channels")]
public IList<string> Channels { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.String> |
Remarks
Note: Channels property is only applicable in the replications with Sync Gateway.
Collections
The collections in the replication.
Declaration
public IReadOnlyList<Collection> Collections { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyList<Collection> |
ConflictResolver
[DEPRECATED] The implemented custom conflict resolver object can be registered to the replicator at ConflictResolver property. The default value of the conflictResolver is null. When the value is null, the default conflict resolution will be applied.
Declaration
[Obsolete("ConflictResolver is deprecated, please use CollectionConfiguration.ConflictResolver")]
public IConflictResolver ConflictResolver { get; set; }
Property Value
Type | Description |
---|---|
IConflictResolver |
Continuous
Gets or sets whether or not the Replicator should stay
active indefinitely. The default is false
Default value is DefaultReplicatorContinuous
Declaration
public bool Continuous { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Database
[DEPRECATED] Gets the local database participating in the replication.
Declaration
[Obsolete("Database is deprecated, please use Collections")]
public Database Database { get; }
Property Value
Type | Description |
---|---|
Database |
Exceptions
Type | Condition |
---|---|
CouchbaseLiteException | Thrown if Database doesn't exist in the replicator configuration. |
DocumentIDs
[DEPRECATED] A set of document IDs to filter by. If not null, only documents with these IDs will be pushed and/or pulled
Declaration
[Obsolete("DocumentIDs is deprecated, please use CollectionConfiguration.DocumentIDs")]
public IList<string> DocumentIDs { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<System.String> |
EnableAutoPurge
Gets or sets the value 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. - If set the property to
false
, AutoPurge is disabled, the replicator will notify the registered DocumentReplicationListener AddDocumentReplicationListener(EventHandler<DocumentReplicationEventArgs>) with an "access removed" event AccessRemoved when access to the document is revoked on the Sync Gateway. On receiving the event, the application may decide to manually purge the document. However, for performance reasons, any DocumentReplicationListeners added AddDocumentReplicationListener(EventHandler<DocumentReplicationEventArgs>) to the replicator after the replicator is started will not receive the access removed events until the replicator is restarted or reconnected with Sync Gateway. - auto-purge will not be performed when DocumentIDs filter DocumentIDs is used. Default value is DefaultReplicatorEnableAutoPurge
Declaration
public bool EnableAutoPurge { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Headers
Extra HTTP headers to send in all requests to the remote target
Declaration
public IDictionary<string, string> Headers { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> |
Heartbeat
Gets or sets the replicator heartbeat keep-alive interval. Default value is DefaultReplicatorHeartbeat (5 min interval).
Declaration
public TimeSpan? Heartbeat { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Throw if set the Heartbeat to less or equal to 0 full seconds. |
MaxAttempts
Gets or sets the Max number of retry attempts. The retry attempts will reset after the replicator is connected to a remote peer.
- Setting the value to 1 means that the replicator will try connect once and the replicator will stop if there is a transient error.
- Default value is DefaultReplicatorMaxAttemptsSingleShot
(
10
) for a single shot replicator. - Default value is DefaultReplicatorMaxAttemptsContinuous (System.Int32.MaxValue) for a continuous replicator.
Declaration
public int MaxAttempts { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Throw if set the MaxAttempts to a negative value. |
MaxAttemptsWaitTime
Gets or sets the Max delay between retries. The default is null (5 min interval is applied).
5
min interval is applied when MaxAttemptsWaitTime is set to null.- null will be returned when default
5
min interval is applied. Default value is DefaultReplicatorMaxAttemptWaitTime
Declaration
public TimeSpan? MaxAttemptsWaitTime { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Throw if set the MaxRetryWaitTime to less than 0 full seconds. |
PinnedServerCertificate
Gets or sets a certificate to trust. All other certificates received by a Replicator with this configuration will be rejected.
Declaration
public X509Certificate2 PinnedServerCertificate { get; set; }
Property Value
Type | Description |
---|---|
System.Security.Cryptography.X509Certificates.X509Certificate2 |
Remarks
A server will be authenticated if it presents a chain of certificates (possibly of length 1) in which any one of the certificates matches the one passed here.
PullFilter
[DEPRECATED] Func delegate that takes Document input parameter and bool output parameter Document pull will be allowed if output is true, othewise, Document pull will not be allowed
Declaration
[Obsolete("PullFilter is deprecated, please use CollectionConfiguration.PullFilter")]
public Func<Document, DocumentFlags, bool> PullFilter { get; set; }
Property Value
Type | Description |
---|---|
System.Func<Document, DocumentFlags, System.Boolean> |
PushFilter
[DEPRECATED] Func delegate that takes Document input parameter and bool output parameter Document push will be allowed if output is true, othewise, Document push will not be allowed
Declaration
[Obsolete("PushFilter is deprecated, please use CollectionConfiguration.PushFilter")]
public Func<Document, DocumentFlags, bool> PushFilter { get; set; }
Property Value
Type | Description |
---|---|
System.Func<Document, DocumentFlags, System.Boolean> |
ReplicatorType
A value indicating the direction of the replication. The default is PushAndPull which is bidirectional Default value is DefaultReplicatorType
Declaration
public ReplicatorType ReplicatorType { get; set; }
Property Value
Type | Description |
---|---|
ReplicatorType |
Target
Gets the target to replicate with (either Database or System.Uri
Declaration
public IEndpoint Target { get; }
Property Value
Type | Description |
---|---|
IEndpoint |
Methods
| Improve this Doc View SourceAddCollection(Collection, CollectionConfiguration)
Add a collection in the replication with an optional collection configuration.
Declaration
public void AddCollection(Collection collection, CollectionConfiguration config = null)
Parameters
Type | Name | Description |
---|---|---|
Collection | collection | to be added in the collections' configuration list |
CollectionConfiguration | config | to be added in the collections' configuration list |
Remarks
The given configuration will replace the existing configuration of the given collection in replication. Default configuration will apply in the replication of the given collection if the given configuration is null. Configuration will be read only once applied to the collection in the replication.
Exceptions
Type | Condition |
---|---|
CouchbaseLiteException | Thrown if database of the given collection doesn't match with the database Database of the replicator configuration. |
System.ArgumentNullException | Thrown if collection is null. |
AddCollections(IList<Collection>, CollectionConfiguration)
Add a list of collections in the replication with an optional shared configuration.
Declaration
public void AddCollections(IList<Collection> collections, CollectionConfiguration config = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<Collection> | collections | that the given config will apply to |
CollectionConfiguration | config | will apply to the given collections |
GetCollectionConfig(Collection)
Get a copy of the given collection’s config.
Declaration
public CollectionConfiguration GetCollectionConfig(Collection collection)
Parameters
Type | Name | Description |
---|---|---|
Collection | collection | The collection config belongs to |
Returns
Type | Description |
---|---|
CollectionConfiguration | The collection config of the given collection |
Remarks
Use AddCollection(Collection, CollectionConfiguration) to add or update collection configuration in a replication.
RemoveCollection(Collection)
Remove the give collection and it's configuration from the replication.
Declaration
public void RemoveCollection(Collection collection)
Parameters
Type | Name | Description |
---|---|---|
Collection | collection | to be removed |