Couchbase Lite C
Couchbase Lite C API
Data Structures
CBLReplicator.h File Reference
#include "CBLBase.h"

Go to the source code of this file.

Data Structures

struct  CBLProxySettings
 Proxy settings for the replicator. More...
 
struct  CBLReplicationCollection
 The collection and the configuration that can be configured specifically for the replication. More...
 
struct  CBLReplicatorConfiguration
 The configuration of a replicator. More...
 
struct  CBLReplicatorProgress
 A fractional progress value, ranging from 0.0 to 1.0 as replication progresses. More...
 
struct  CBLReplicatorStatus
 A replicator's current status. More...
 
struct  CBLReplicatedDocument
 Information about a document that's been pushed or pulled. More...
 

Functions

Lifecycle
static const CBLReplicatorCBLReplicator_Retain (const CBLReplicator *t)
 
static void CBLReplicator_Release (const CBLReplicator *t)
 
_cbl_warn_unused CBLReplicator *_cbl_nullable CBLReplicator_Create (const CBLReplicatorConfiguration *, CBLError *_cbl_nullable outError)
 Creates a replicator with the given configuration. More...
 
const CBLReplicatorConfigurationCBLReplicator_Config (CBLReplicator *)
 Returns the configuration of an existing replicator. More...
 
void CBLReplicator_Start (CBLReplicator *replicator, bool resetCheckpoint)
 Starts a replicator, asynchronously. More...
 
void CBLReplicator_Stop (CBLReplicator *)
 Stops a running replicator, asynchronously. More...
 
void CBLReplicator_SetHostReachable (CBLReplicator *, bool reachable)
 Informs the replicator whether it's considered possible to reach the remote host with the current network configuration. More...
 
void CBLReplicator_SetSuspended (CBLReplicator *repl, bool suspended)
 Puts the replicator in or out of "suspended" state. More...
 

Configuration

enum  CBLReplicatorType : uint8_t { kCBLReplicatorTypePushAndPull = 0 , kCBLReplicatorTypePush , kCBLReplicatorTypePull }
 Direction of replication: push, pull, or both. More...
 
enum  CBLDocumentFlags : unsigned { kCBLDocumentFlagsDeleted = 1 << 0 , kCBLDocumentFlagsAccessRemoved = 1 << 1 }
 Flags describing a replicated document. More...
 
enum  CBLProxyType : uint8_t { kCBLProxyHTTP , kCBLProxyHTTPS }
 Types of proxy servers, for CBLProxySettings. More...
 
typedef struct CBLEndpoint CBLEndpoint
 An opaque object representing the location of a database to replicate with. More...
 
typedef struct CBLAuthenticator CBLAuthenticator
 An opaque object representing authentication credentials for a remote server. More...
 
typedef bool(* CBLReplicationFilter) (void *_cbl_nullable context, CBLDocument *document, CBLDocumentFlags flags)
 A callback that can decide whether a particular document should be pushed or pulled. More...
 
typedef const CBLDocument *_cbl_nullable(* CBLConflictResolver) (void *_cbl_nullable context, FLString documentID, const CBLDocument *_cbl_nullable localDocument, const CBLDocument *_cbl_nullable remoteDocument)
 Conflict-resolution callback for use in replications. More...
 
typedef FLSliceResult(* CBLPropertyEncryptor) (void *context, FLString documentID, FLDict properties, FLString keyPath, FLSlice input, FLStringResult *algorithm, FLStringResult *kid, CBLError *error)
 Callback that encrypts CBLEncryptable properties in the documents of the default collection pushed by the replicator. More...
 
typedef FLSliceResult(* CBLPropertyDecryptor) (void *context, FLString documentID, FLDict properties, FLString keyPath, FLSlice input, FLString algorithm, FLString kid, CBLError *error)
 Callback that decrypts encrypted CBLEncryptable properties in documents of the default collection pulled by the replicator. More...
 
typedef FLSliceResult(* CBLDocumentPropertyEncryptor) (void *context, FLString scope, FLString collection, FLString documentID, FLDict properties, FLString keyPath, FLSlice input, FLStringResult *algorithm, FLStringResult *kid, CBLError *error)
 Callback that encrypts CBLEncryptable properties in the documents pushed by the replicator. More...
 
typedef FLSliceResult(* CBLDocumentPropertyDecryptor) (void *context, FLString scope, FLString collection, FLString documentID, FLDict properties, FLString keyPath, FLSlice input, FLString algorithm, FLString kid, CBLError *error)
 Callback that decrypts encrypted CBLEncryptable properties in documents pulled by the replicator. More...
 
CBL_PUBLIC const FLString kCBLAuthDefaultCookieName
 The name of the HTTP cookie used by Sync Gateway to store session keys. More...
 
CBL_PUBLIC const CBLConflictResolver CBLDefaultConflictResolver
 Default conflict resolver. More...
 
_cbl_warn_unused CBLEndpoint *_cbl_nullable CBLEndpoint_CreateWithURL (FLString url, CBLError *_cbl_nullable outError)
 Creates a new endpoint representing a server-based database at the given URL. More...
 
_cbl_warn_unused CBLEndpointCBLEndpoint_CreateWithLocalDB (CBLDatabase *)
 Creates a new endpoint representing another local database. More...
 
void CBLEndpoint_Free (CBLEndpoint *_cbl_nullable)
 Frees a CBLEndpoint object. More...
 
_cbl_warn_unused CBLAuthenticatorCBLAuth_CreatePassword (FLString username, FLString password)
 Creates an authenticator for HTTP Basic (username/password) auth. More...
 
_cbl_warn_unused CBLAuthenticatorCBLAuth_CreateSession (FLString sessionID, FLString cookieName)
 Creates an authenticator using a Couchbase Sync Gateway login session identifier, and optionally a cookie name (pass NULL for the default.) More...
 
void CBLAuth_Free (CBLAuthenticator *_cbl_nullable)
 Frees a CBLAuthenticator object. More...
 

Status and Progress

enum  CBLReplicatorActivityLevel : uint8_t {
  kCBLReplicatorStopped , kCBLReplicatorOffline , kCBLReplicatorConnecting , kCBLReplicatorIdle ,
  kCBLReplicatorBusy
}
 The possible states a replicator can be in during its lifecycle. More...
 
typedef void(* CBLReplicatorChangeListener) (void *_cbl_nullable context, CBLReplicator *replicator, const CBLReplicatorStatus *status)
 A callback that notifies you when the replicator's status changes. More...
 
typedef void(* CBLDocumentReplicationListener) (void *context, CBLReplicator *replicator, bool isPush, unsigned numDocuments, const CBLReplicatedDocument *documents)
 A callback that notifies you when documents are replicated. More...
 
CBLReplicatorStatus CBLReplicator_Status (CBLReplicator *)
 Returns the replicator's current status. More...
 
_cbl_warn_unused FLDict _cbl_nullable CBLReplicator_PendingDocumentIDs (CBLReplicator *, CBLError *_cbl_nullable outError)
 Indicates which documents in the default collection have local changes that have not yet been pushed to the server by this replicator. More...
 
bool CBLReplicator_IsDocumentPending (CBLReplicator *repl, FLString docID, CBLError *_cbl_nullable outError)
 Indicates whether the document in the default collection with the given ID has local changes that have not yet been pushed to the server by this replicator. More...
 
FLDict _cbl_nullable CBLReplicator_PendingDocumentIDs2 (CBLReplicator *, const CBLCollection *collection, CBLError *_cbl_nullable outError)
 Indicates which documents in the given collection have local changes that have not yet been pushed to the server by this replicator. More...
 
bool CBLReplicator_IsDocumentPending2 (CBLReplicator *repl, FLString docID, const CBLCollection *collection, CBLError *_cbl_nullable outError)
 Indicates whether the document with the given ID in the given collection has local changes that have not yet been pushed to the server by this replicator. More...
 
_cbl_warn_unused CBLListenerTokenCBLReplicator_AddChangeListener (CBLReplicator *, CBLReplicatorChangeListener, void *_cbl_nullable context)
 Registers a listener that will be called when the replicator's status changes. More...
 
_cbl_warn_unused CBLListenerTokenCBLReplicator_AddDocumentReplicationListener (CBLReplicator *, CBLDocumentReplicationListener, void *_cbl_nullable context)
 Registers a listener that will be called when documents are replicated. More...