LiteCore
Couchbase Lite cross-platform core implementation
Loading...
Searching...
No Matches
Data Types and Base Functions

Data Structures

struct  C4ExtraInfo
 Client-defined metadata that can be associated with some objects like C4Database. More...
 

Macros

#define C4STR(STR)
 
#define kC4SliceNull   kFLSliceNull
 

Typedefs

typedef FLSlice C4Slice
 
typedef FLHeapSlice C4HeapSlice
 
typedef FLSliceResult C4SliceResult
 
typedef C4Slice C4String
 
typedef C4HeapSlice C4HeapString
 
typedef C4SliceResult C4StringResult
 
typedef uint64_t C4SequenceNumber
 A database sequence number, representing the order in which a revision was created.
 
typedef int64_t C4Timestamp
 A date/time representation used for document expiration (and in date/time queries.) Measured in milliseconds since the Unix epoch (1/1/1970, midnight UTC.) A value of 0 represents "no expiration".
 
typedef struct C4BlobStore C4BlobStore
 Opaque handle for an object that manages storage of blobs.
 
typedef struct C4Cert C4Cert
 An X.509 certificate, or certificate signing request (CSR).
 
typedef struct C4Collection C4Collection
 Opaque handle to a namespace of documents in an opened database.
 
typedef struct C4CollectionObserver C4CollectionObserver
 A collection-observer reference.
 
typedef C4CollectionObserver C4DatabaseObserver
 
typedef struct C4Database C4Database
 Opaque handle to an opened database.
 
typedef struct C4DocumentObserver C4DocumentObserver
 A document-observer reference.
 
typedef struct C4DocEnumerator C4DocEnumerator
 Opaque handle to a document enumerator.
 
typedef struct C4Index C4Index
 Represents an existing index.
 
typedef struct C4IndexUpdater C4IndexUpdater
 Describes a set of index values that need to be computed by the application.
 
typedef struct C4KeyPair C4KeyPair
 An asymmetric key or key-pair (RSA, etc.) The private key may or may not be present.
 
typedef struct C4Listener C4Listener
 A LiteCore network listener – supports the REST API, replication, or both.
 
typedef struct C4LogObserver C4LogObserver
 Opaque handle to a registered logging observer.
 
typedef struct C4PeerSync C4PeerSync
 A peer-to-peer sync session.
 
typedef struct C4Query C4Query
 Opaque handle to a compiled query.
 
typedef struct C4QueryObserver C4QueryObserver
 A query-observer reference.
 
typedef struct C4ReadStream C4ReadStream
 An open stream for reading data from a blob.
 
typedef struct C4Replicator C4Replicator
 Opaque reference to a replicator.
 
typedef struct C4Socket C4Socket
 Represents an open bidirectional stream of bytes or messages (typically a TCP socket.)
 
typedef struct C4WriteStream C4WriteStream
 An open stream for writing data to a blob.
 

Functions

static C4INLINE C4Slice c4str (const char *str)
 
bool c4SliceEqual (C4Slice a, C4Slice b)
 
void c4slice_free (C4SliceResult s)
 
CBL_CORE_API void * c4base_retain (void *obj)
 
CBL_CORE_API void c4base_release (void *obj)
 
C4Certc4cert_retain (C4Cert *r)
 
C4Collectionc4coll_retain (C4Collection *r)
 
C4Databasec4db_retain (C4Database *r)
 
C4Indexc4index_retain (C4Index *r)
 
C4IndexUpdaterc4indexupdater_retain (C4IndexUpdater *r)
 
C4KeyPairc4keypair_retain (C4KeyPair *r)
 
C4LogObserverc4logobserver_retain (C4LogObserver *r)
 
C4Queryc4query_retain (C4Query *r)
 
CBL_CORE_API C4Documentc4doc_retain (C4Document *)
 
CBL_CORE_API C4QueryEnumeratorc4queryenum_retain (C4QueryEnumerator *)
 
CBL_CORE_API C4Socketc4socket_retain (C4Socket *)
 
void c4cert_release (C4Cert *r)
 
void c4coll_release (C4Collection *r)
 
void c4db_release (C4Database *r)
 
void c4index_release (C4Index *i)
 
void c4indexupdater_release (C4IndexUpdater *u)
 
void c4keypair_release (C4KeyPair *r)
 
void c4logobserver_release (C4LogObserver *r)
 
void c4query_release (C4Query *r)
 
CBL_CORE_API void c4doc_release (C4Document *)
 
CBL_CORE_API void c4queryenum_release (C4QueryEnumerator *)
 
CBL_CORE_API void c4socket_release (C4Socket *)
 
CBL_CORE_API void c4dbobs_free (C4CollectionObserver *)
 
CBL_CORE_API void c4docobs_free (C4DocumentObserver *)
 
CBL_CORE_API void c4enum_free (C4DocEnumerator *)
 
CBL_CORE_API void c4listener_free (C4Listener *)
 Closes and disposes a listener.
 
CBL_CORE_API void c4peersync_free (C4PeerSync *)
 Disposes a C4PeerSync.
 
CBL_CORE_API void c4queryobs_free (C4QueryObserver *)
 
CBL_CORE_API void c4raw_free (C4RawDocument *)
 Frees the storage occupied by a raw document.
 
CBL_CORE_API void c4repl_free (C4Replicator *)
 Frees a replicator reference.
 
CBL_CORE_API void c4stream_close (C4ReadStream *)
 Closes a read-stream.
 
CBL_CORE_API void c4stream_closeWriter (C4WriteStream *)
 Closes a blob write-stream.
 
CBL_CORE_API int c4_getObjectCount (void)
 Returns the number of objects that have been created but not yet freed.
 
CBL_CORE_API void c4_dumpInstances (void)
 Logs information about object in memory.
 

Detailed Description

Macro Definition Documentation

◆ C4STR

#define C4STR ( STR)
Value:
FLSTR(STR)
#define FLSTR(STR)
Macro version of FLStr, for use in initializing compile-time constants.
Definition FLSlice.h:142

◆ kC4SliceNull

#define kC4SliceNull   kFLSliceNull

Typedef Documentation

◆ C4BlobStore

typedef struct C4BlobStore C4BlobStore

Opaque handle for an object that manages storage of blobs.

◆ C4Cert

typedef struct C4Cert C4Cert

An X.509 certificate, or certificate signing request (CSR).

◆ C4Collection

typedef struct C4Collection C4Collection

Opaque handle to a namespace of documents in an opened database.

◆ C4CollectionObserver

A collection-observer reference.

◆ C4Database

typedef struct C4Database C4Database

Opaque handle to an opened database.

◆ C4DatabaseObserver

◆ C4DocEnumerator

Opaque handle to a document enumerator.

◆ C4DocumentObserver

A document-observer reference.

◆ C4HeapSlice

◆ C4HeapString

◆ C4Index

typedef struct C4Index C4Index

Represents an existing index.

◆ C4IndexUpdater

Describes a set of index values that need to be computed by the application.

◆ C4KeyPair

typedef struct C4KeyPair C4KeyPair

An asymmetric key or key-pair (RSA, etc.) The private key may or may not be present.

◆ C4Listener

typedef struct C4Listener C4Listener

A LiteCore network listener – supports the REST API, replication, or both.

◆ C4LogObserver

typedef struct C4LogObserver C4LogObserver

Opaque handle to a registered logging observer.

◆ C4PeerSync

typedef struct C4PeerSync C4PeerSync

A peer-to-peer sync session.

◆ C4Query

typedef struct C4Query C4Query

Opaque handle to a compiled query.

◆ C4QueryObserver

A query-observer reference.

◆ C4ReadStream

typedef struct C4ReadStream C4ReadStream

An open stream for reading data from a blob.

◆ C4Replicator

typedef struct C4Replicator C4Replicator

Opaque reference to a replicator.

◆ C4SequenceNumber

typedef uint64_t C4SequenceNumber

A database sequence number, representing the order in which a revision was created.

◆ C4Slice

typedef FLSlice C4Slice

◆ C4SliceResult

◆ C4Socket

typedef struct C4Socket C4Socket

Represents an open bidirectional stream of bytes or messages (typically a TCP socket.)

◆ C4String

typedef C4Slice C4String

◆ C4StringResult

◆ C4Timestamp

typedef int64_t C4Timestamp

A date/time representation used for document expiration (and in date/time queries.) Measured in milliseconds since the Unix epoch (1/1/1970, midnight UTC.) A value of 0 represents "no expiration".

◆ C4WriteStream

typedef struct C4WriteStream C4WriteStream

An open stream for writing data to a blob.

Function Documentation

◆ c4_dumpInstances()

CBL_CORE_API void c4_dumpInstances ( void )

Logs information about object in memory.

Useful for debugging when c4_getObjectCount indicates there are leaks. (Note: In release builds this doesn't have much to say, because the instrumentation it needs is suppressed for performance purposes.)

◆ c4_getObjectCount()

CBL_CORE_API int c4_getObjectCount ( void )

Returns the number of objects that have been created but not yet freed.

This can be used as a debugging/testing tool to detect leaks; for example, capture the value at the start of a test, then call again at the end and compare.

◆ c4base_release()

CBL_CORE_API void c4base_release ( void * obj)

◆ c4base_retain()

CBL_CORE_API void * c4base_retain ( void * obj)

◆ c4cert_release()

void c4cert_release ( C4Cert * r)
inline

◆ c4cert_retain()

C4Cert * c4cert_retain ( C4Cert * r)
inline

◆ c4coll_release()

void c4coll_release ( C4Collection * r)
inline
Note
This function is thread-safe.

◆ c4coll_retain()

C4Collection * c4coll_retain ( C4Collection * r)
inline

◆ c4db_release()

void c4db_release ( C4Database * r)
inline
Note
This function is thread-safe.

◆ c4db_retain()

C4Database * c4db_retain ( C4Database * r)
inline

◆ c4dbobs_free()

CBL_CORE_API void c4dbobs_free ( C4CollectionObserver * )
Note
This function is thread-safe.

◆ c4doc_release()

CBL_CORE_API void c4doc_release ( C4Document * )
Note
This function is thread-safe.

◆ c4doc_retain()

CBL_CORE_API C4Document * c4doc_retain ( C4Document * )

◆ c4docobs_free()

CBL_CORE_API void c4docobs_free ( C4DocumentObserver * )
Note
This function is thread-safe.

◆ c4enum_free()

CBL_CORE_API void c4enum_free ( C4DocEnumerator * )
Note
This function is thread-safe.

◆ c4index_release()

void c4index_release ( C4Index * i)
inline

◆ c4index_retain()

C4Index * c4index_retain ( C4Index * r)
inline

◆ c4indexupdater_release()

void c4indexupdater_release ( C4IndexUpdater * u)
inline

◆ c4indexupdater_retain()

C4IndexUpdater * c4indexupdater_retain ( C4IndexUpdater * r)
inline

◆ c4keypair_release()

void c4keypair_release ( C4KeyPair * r)
inline

◆ c4keypair_retain()

C4KeyPair * c4keypair_retain ( C4KeyPair * r)
inline

◆ c4listener_free()

CBL_CORE_API void c4listener_free ( C4Listener * )

Closes and disposes a listener.

◆ c4logobserver_release()

void c4logobserver_release ( C4LogObserver * r)
inline
Note
This function is thread-safe.

◆ c4logobserver_retain()

C4LogObserver * c4logobserver_retain ( C4LogObserver * r)
inline

◆ c4peersync_free()

CBL_CORE_API void c4peersync_free ( C4PeerSync * )

Disposes a C4PeerSync.

◆ c4query_release()

void c4query_release ( C4Query * r)
inline
Note
This function is thread-safe.

◆ c4query_retain()

C4Query * c4query_retain ( C4Query * r)
inline

◆ c4queryenum_release()

CBL_CORE_API void c4queryenum_release ( C4QueryEnumerator * )
Note
This function is thread-safe.

◆ c4queryenum_retain()

CBL_CORE_API C4QueryEnumerator * c4queryenum_retain ( C4QueryEnumerator * )

◆ c4queryobs_free()

CBL_CORE_API void c4queryobs_free ( C4QueryObserver * )
Note
This function is thread-safe.

◆ c4raw_free()

CBL_CORE_API void c4raw_free ( C4RawDocument * )

Frees the storage occupied by a raw document.

◆ c4repl_free()

CBL_CORE_API void c4repl_free ( C4Replicator * )

Frees a replicator reference.

Does not stop the replicator – if the replicator still has other internal references, it will keep going. If you need the replicator to stop, call c4repl_stop first.

Note
This function is thread-safe.

◆ c4slice_free()

void c4slice_free ( C4SliceResult s)
inline

◆ c4SliceEqual()

bool c4SliceEqual ( C4Slice a,
C4Slice b )
inline

◆ c4socket_release()

CBL_CORE_API void c4socket_release ( C4Socket * )

◆ c4socket_retain()

CBL_CORE_API C4Socket * c4socket_retain ( C4Socket * )

◆ c4str()

static C4INLINE C4Slice c4str ( const char * str)
static

◆ c4stream_close()

CBL_CORE_API void c4stream_close ( C4ReadStream * )

Closes a read-stream.

(A NULL parameter is allowed.)

Note
After close, the ReadStream is deleted.

◆ c4stream_closeWriter()

CBL_CORE_API void c4stream_closeWriter ( C4WriteStream * )

Closes a blob write-stream.

If c4stream_install was not already called (or was called but failed), the temporary file will be deleted without adding the blob to the store. (A NULL parameter is allowed, and is a no-op.)

Note
After close, the WriteStream is deleted.