Database Replication Functions
Collaboration diagram for Database Replication Functions:

Functions

RDM_RETCODE rdm_dbReplicationGetProgress (RDM_DB db, uint64_t *progress)
Get The progress with respect to replication. More...
RDM_RETCODE rdm_dbReplicationSetProgress (RDM_DB db, uint64_t progress)
Set The progress with respect to replication. More...
RDM_RETCODE rdm_dbReplicationGet (RDM_DB db, void *replicationBuffer, size_t bufferSize, size_t *pBytesWritten)
Populate a buffer with changes to a persistent database. More...
RDM_RETCODE rdm_dbReplicationPut (RDM_DB db, const void *replicationBuffer, size_t messageSize)
Apply a replication buffer with changes to a persistent database. More...

Detailed Description

Replication functions for the core database API. All the functions here are located in RDM DB Engine Library. Linker option:

    -lrdmrdm

Function Documentation

rdm_dbReplicationGet()

RDM_RETCODE rdm_dbReplicationGet ( RDM_DB db,
void * replicationBuffer,
size_t bufferSize,
size_t * pBytesWritten
)

#include <rdmdbreplicationeapi.h>

Populate a buffer with changes to a persistent database.

This function will populate a buffer with changes to a database. The buffer can be used by rdm_dbReplicationPut() to apply the changes to another database.

The replication buffer is required to hold at least 4K bytes. Preferably the buffer should be a lot larger, especially when connected to a remote TFS on another host.

This function should be called repeatedly until sREPLICATEDONE is returned. Please note that the first call to this function may return sREPLICATEDONE with some data that should be provided to the target.

Locking Requirements
Database must be opened in RDM_OPEN_REPLICATE_SOURCE mode. Otherwise no locks required.
Return values
sOKAY Normal, successful return.
sREPLICATEUNSAFE The replication target is to fare behind for the replication to be entirely safe.
sREPLICATEDONE The replication target has caught up with the replication source.
See also
rdm_dbReplicationSetProgress
rdm_dbReplicationGetProgress
rdm_dbReplicationPut
Parameters
[in] db An allocated RDM_DB
[out] replicationBuffer The buffer where the changes will be populated
[in] bufferSize The size of replicationBuffer
[out] pBytesWritten The number of bytes populated

rdm_dbReplicationGetProgress()

RDM_RETCODE rdm_dbReplicationGetProgress ( RDM_DB db,
uint64_t * progress
)

#include <rdmdbreplicationeapi.h>

Get The progress with respect to replication.

Get The progress with respect to replication. The progress is simply a number. A higher number means more data have been applied.

Use this function prior to starting replication to take progress that have already been made into account. First call this function on the target database DB handle to get its progress and then pass that number to the source database DB handle by calling rdm_dbReplicationSetProgress().

Locking Requirements
Database must be opened in RDM_OPEN_REPLICATE_TARGET mode. Other users that have this database open must have it open in RDM_OPEN_READONLY mode and are only allowed to retrieve data by calling rdm_dbStartSnapshot(). Otherwise no locks required.
Return values
sOKAY Normal, successful return.
See also
rdm_dbReplicationSetProgress
rdm_dbReplicationPut
rdm_dbReplicationGet
Parameters
[in] db An allocated RDM_DB
[out] progress The progress we have made

rdm_dbReplicationPut()

RDM_RETCODE rdm_dbReplicationPut ( RDM_DB db,
const void * replicationBuffer,
size_t messageSize
)

#include <rdmdbreplicationeapi.h>

Apply a replication buffer with changes to a persistent database.

This function will apply a replication buffer containing changes to a database. The replication buffer is generated by rdm_dbReplicationGet().

Call this function once each time the call to rdm_dbReplicationGet() provided some data. When sREPLICATECOMMIT is returned additonal content is available in the target database. target database.

Locking Requirements
Database must be opened in RDM_OPEN_REPLICATE_TARGET mode. Other users that have this database open must have it open in RDM_OPEN_READONLY mode and are only allowed to retrieve data by calling rdm_dbStartSnapshot(). Otherwise no locks required.
Return values
sOKAY Normal, successful return.
sREPLICATECOMMIT The replication target has committed a transaction that now is available to its clients.
eREPLICATEMISSMATCH Replication target does not match replication source.
See also
rdm_dbReplicationGetProgress
rdm_dbReplicationSetProgress
rdm_dbReplicationGet
Parameters
[in] db An allocated RDM_DB
[in] replicationBuffer The buffer with changes
[in] messageSize The size of the message

rdm_dbReplicationSetProgress()

RDM_RETCODE rdm_dbReplicationSetProgress ( RDM_DB db,
uint64_t progress
)

#include <rdmdbreplicationeapi.h>

Set The progress with respect to replication.

Set The progress with respect to replication. The progress is simply a number. A higher number means more data have been applied.

Use this function prior to starting replication to take progress that have already been made into account. First call rdm_dbReplicationGetProgress() on the target database DB handle to get its progress and then pass that number to the source database DB handle by calling this function.

Locking Requirements
Database must be opened in RDM_OPEN_REPLICATE_SOURCE mode. Otherwise no locks required.
Return values
sOKAY Normal, successful return.
eREPLICATEBEHIND Replication source is behind the replication target.
See also
rdm_dbReplicationGetProgress
rdm_dbReplicationGet
rdm_dbReplicationPut
Parameters
[in] db An allocated RDM_DB
[in] progress The progress we have made