LiteCore
Couchbase Lite cross-platform core implementation
Loading...
Searching...
No Matches
c4Replicator.h
Go to the documentation of this file.
1//
2// c4Replicator.h
3//
4// Copyright 2017-Present Couchbase, Inc.
5//
6// Use of this software is governed by the Business Source License included
7// in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
8// in that file, in accordance with the Business Source License, use of this
9// software will be governed by the Apache License, Version 2.0, included in
10// the file licenses/APL2.txt.
11//
12
13#pragma once
14#include "c4ReplicatorTypes.h"
15
18
25
28NODISCARD CBL_CORE_API bool c4repl_isValidRemote(C4Address remoteAddress, C4String remoteDatabaseName,
29 C4Error* C4NULLABLE outError) C4API;
30
42
45
46
57 C4ReplicatorParameters params, C4String logPrefix,
58 C4Error* C4NULLABLE outError) C4API;
59
60#ifdef COUCHBASE_ENTERPRISE
69NODISCARD CBL_CORE_API C4Replicator* c4repl_newLocal(C4Database* db, C4Database* otherLocalDB,
70 C4ReplicatorParameters params, C4String logPrefix,
71 C4Error* C4NULLABLE outError) C4API;
72#endif
73
85 C4ReplicatorParameters params, C4String logPrefix,
86 C4Error* C4NULLABLE outError) C4API;
87
96
100
107
115
123
128
132
136
150 C4Error* C4NULLABLE outErr) C4API;
151
165 C4Error* C4NULLABLE outErr) C4API;
166
167
171
182 C4Error* C4NULLABLE outErr) C4API;
183
184
185#pragma mark - COOKIES:
186
187
204 C4String fromPath, bool acceptParentDomain,
205 C4Error* C4NULLABLE outError) C4API;
206
211
215
#define NODISCARD
Definition CompilerSupport.h:59
#define CBL_CORE_API
Definition c4Compat.h:134
#define C4NULLABLE
Definition c4Compat.h:38
#define C4API
Definition c4Compat.h:114
#define C4_ASSUME_NONNULL_BEGIN
Definition c4Compat.h:36
#define C4API_END_DECLS
Definition c4Compat.h:116
#define C4API_BEGIN_DECLS
Definition c4Compat.h:115
#define C4_ASSUME_NONNULL_END
Definition c4Compat.h:37
struct C4Replicator C4Replicator
Opaque reference to a replicator.
Definition c4Base.h:175
struct C4Database C4Database
Opaque handle to an opened database.
Definition c4Base.h:136
struct C4Socket C4Socket
Represents an open bidirectional stream of bytes or messages (typically a TCP socket....
Definition c4Base.h:178
struct C4Cert C4Cert
An X.509 certificate, or certificate signing request (CSR).
Definition c4Base.h:123
CBL_CORE_API C4ReplicatorStatus c4repl_getStatus(C4Replicator *repl)
Returns the current state of a replicator.
NODISCARD CBL_CORE_API bool c4repl_retry(C4Replicator *repl, C4Error *outError)
Tells a replicator that's in the offline state to reconnect immediately.
CBL_CORE_API void c4repl_start(C4Replicator *repl, bool reset)
Tells a replicator to start.
NODISCARD CBL_CORE_API bool c4repl_isDocumentPending(C4Replicator *repl, C4String docID, C4CollectionSpec spec, C4Error *outErr)
Checks if the document with the given ID has revisions pending push.
CBL_CORE_API bool c4repl_isValidDatabaseName(C4String dbName)
Checks whether a database name is valid, for purposes of appearing in a replication URL.
C4ReplicatorProgressLevel
Definition c4ReplicatorTypes.h:90
NODISCARD CBL_CORE_API bool c4address_fromURL(C4String url, C4Address *address, C4String *dbName)
A simple URL parser that populates a C4Address from a URL string.
CBL_CORE_API C4SliceResult c4repl_getPendingDocIDs(C4Replicator *repl, C4CollectionSpec spec, C4Error *outErr)
Gets a fleece encoded list of IDs of documents who have revisions pending push.
CBL_CORE_API void c4repl_stop(C4Replicator *repl)
Tells a replicator to stop.
CBL_CORE_API void c4repl_setOptions(C4Replicator *repl, C4Slice optionsDictFleece)
Sets the replicator's options dictionary.
NODISCARD CBL_CORE_API C4Cert * c4repl_getPeerTLSCertificate(C4Replicator *repl, C4Error *outErr)
Gets the TLS certificate, if any, that was sent from the remote server (NOTE: Only functions when usi...
CBL_CORE_API C4Slice c4repl_getResponseHeaders(C4Replicator *repl)
Returns the HTTP response headers as a Fleece-encoded dictionary.
CBL_CORE_API void c4repl_setSuspended(C4Replicator *repl, bool suspended)
Puts the replicator in or out of "suspended" state.
CBL_CORE_API C4StringResult c4db_getCookies(C4Database *db, C4Address request, C4Error *error)
Locates any saved HTTP cookies relevant to the given request, and returns them as a string that can b...
CBL_CORE_API C4StringResult c4address_toURL(C4Address address)
Converts a C4Address to a URL.
CBL_CORE_API void c4db_clearCookies(C4Database *db)
Removes all cookies from the database's cookie store.
NODISCARD CBL_CORE_API bool c4repl_isValidRemote(C4Address remoteAddress, C4String remoteDatabaseName, C4Error *outError)
Checks whether the destination of a replication is valid.
NODISCARD CBL_CORE_API bool c4db_setCookie(C4Database *db, C4String setCookieHeader, C4String fromHost, C4String fromPath, bool acceptParentDomain, C4Error *outError)
Takes the value of a "Set-Cookie:" header, received from the given host, from an HTTP request with th...
NODISCARD CBL_CORE_API C4Replicator * c4repl_newWithSocket(C4Database *db, C4Socket *openSocket, C4ReplicatorParameters params, C4String logPrefix, C4Error *outError)
Creates a new replicator from an already-open C4Socket.
NODISCARD CBL_CORE_API bool c4repl_setProgressLevel(C4Replicator *repl, C4ReplicatorProgressLevel level, C4Error *outErr)
Sets the progress level of the replicator, indicating what information should be provided via callbac...
NODISCARD CBL_CORE_API C4Replicator * c4repl_new(C4Database *db, C4Address remoteAddress, C4String remoteDatabaseName, C4ReplicatorParameters params, C4String logPrefix, C4Error *outError)
Creates a new networked replicator.
CBL_CORE_API void c4repl_setHostReachable(C4Replicator *repl, bool reachable)
Informs the replicator whether it's considered possible to reach the remote host with the current net...
A simple parsed-URL type.
Definition c4ReplicatorTypes.h:56
Full identifier of a collection in a database, including its scope.
Definition c4DatabaseTypes.h:91
An error value.
Definition c4Error.h:133
Parameters describing a replication, used when creating a C4Replicator.
Definition c4ReplicatorTypes.h:193
Current status of replication.
Definition c4ReplicatorTypes.h:97
A simple reference to a block of memory.
Definition FLSlice.h:45
A heap-allocated block of memory returned from an API call.
Definition FLSlice.h:63