DbTxn::set_commit_token()

#include <db_cxx.h>
 
int
DbTxn::set_commit_token(DB_TXN_TOKEN *buffer);

The DbTxn::set_commit_token() method configures the transaction for commit token generation, and accepts the address of an application-supplied buffer to receive the token. The actual generation of the token contents does not occur until commit time.

Commit tokens are used to enable some consistency guarantees for replicated applications. Please see the Read your writes consistency section in the Berkeley DB Programmer's Reference Guide for more information.

The DbTxn::set_commit_token() method may be called at any time after the DbEnv::txn_begin() method has been called, and before DbTxn::commit() has been called.

The DbTxn::set_commit_token() method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

Parameters

buffer

The address of an application-supplied buffer. The buffer memory must remain available, and will be filled in later by Berkeley DB, at the time of the commit() call.

Errors

The DbTxn::set_commit_token() method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

EINVAL

If the transaction is a nested transaction; if this method is called on a replication client; if the database environment is not configured for logging.

Class

DbTxn

See Also

Transaction Subsystem and Related Methods, Replication and Related Methods