DB_TXN->set_commit_token()

#include <db.h>

int
DB_TXN->set_commit_token(DB_TXN *txn, DB_TXN_TOKEN *buffer);  

The DB_TXN->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 DB_TXN->set_commit_token() method may be called at any time after the DB_ENV->txn_begin() method has been called, and before DB_TXN->commit() has been called.

The DB_TXN->set_commit_token() method returns a non-zero error value on failure and 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 DB_TXN->set_commit_token() method may fail and 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

DB_TXN

See Also

Transaction Subsystem and Related Methods, Replication and Related Methods