All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
as_txn.h File Reference
#include <aerospike/as_std.h>
#include <aerospike/as_key.h>
#include <aerospike/as_error.h>
#include <aerospike/as_status.h>
#include <pthread.h>
+ Include dependency graph for as_txn.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  as_txn
 
struct  as_txn_hash
 
struct  as_txn_hash_row
 
struct  as_txn_iter
 
struct  as_txn_key
 

Macros

#define AS_TXN_READ_CAPACITY_DEFAULT   128
 
#define AS_TXN_WRITE_CAPACITY_DEFAULT   128
 

Enumerations

enum  as_txn_state { AS_TXN_STATE_OPEN , AS_TXN_STATE_VERIFIED , AS_TXN_STATE_COMMITTED , AS_TXN_STATE_ABORTED }
 

Functions

AS_EXTERN void as_txn_clear (as_txn *txn)
 
static bool as_txn_close_monitor (as_txn *txn)
 
AS_EXTERN as_txnas_txn_create (void)
 
AS_EXTERN as_txnas_txn_create_capacity (uint32_t reads_capacity, uint32_t writes_capacity)
 
AS_EXTERN void as_txn_destroy (as_txn *txn)
 
AS_EXTERN uint64_t as_txn_get_read_version (as_txn *txn, const uint8_t *digest)
 
AS_EXTERN void as_txn_init (as_txn *txn)
 
AS_EXTERN void as_txn_init_capacity (as_txn *txn, uint32_t reads_capacity, uint32_t writes_capacity)
 
AS_EXTERN as_txn_keyas_txn_iter_next (as_txn_iter *iter)
 
static void as_txn_iter_reads (as_txn_iter *iter, as_txn *txn)
 
static void as_txn_iter_writes (as_txn_iter *iter, as_txn *txn)
 
static bool as_txn_monitor_exists (as_txn *txn)
 
AS_EXTERN void as_txn_on_read (as_txn *txn, const uint8_t *digest, const char *set, uint64_t version)
 
AS_EXTERN void as_txn_on_write (as_txn *txn, const uint8_t *digest, const char *set, uint64_t version, int rc)
 
AS_EXTERN void as_txn_on_write_in_doubt (as_txn *txn, const uint8_t *digest, const char *set)
 
static uint32_t as_txn_reads_size (as_txn *txn)
 
AS_EXTERN as_status as_txn_set_ns (as_txn *txn, const char *ns, as_error *err)
 
static void as_txn_set_timeout (as_txn *txn, uint32_t timeout)
 
AS_EXTERN as_status as_txn_verify_command (as_txn *txn, as_error *err)
 
AS_EXTERN bool as_txn_writes_contain (as_txn *txn, const as_key *key)
 
static uint32_t as_txn_writes_size (as_txn *txn)
 

Macro Definition Documentation

◆ AS_TXN_READ_CAPACITY_DEFAULT

#define AS_TXN_READ_CAPACITY_DEFAULT   128

Default number of transaction read hash buckets.

Definition at line 36 of file as_txn.h.

◆ AS_TXN_WRITE_CAPACITY_DEFAULT

#define AS_TXN_WRITE_CAPACITY_DEFAULT   128

Default number of transaction write hash buckets.

Definition at line 41 of file as_txn.h.

Enumeration Type Documentation

◆ as_txn_state

Transaction state.

Enumerator
AS_TXN_STATE_OPEN 
AS_TXN_STATE_VERIFIED 
AS_TXN_STATE_COMMITTED 
AS_TXN_STATE_ABORTED 

Definition at line 50 of file as_txn.h.

Function Documentation

◆ as_txn_clear()

AS_EXTERN void as_txn_clear ( as_txn * txn)

Clear transaction. Remove all tracked keys. For internal use only.

◆ as_txn_close_monitor()

static bool as_txn_close_monitor ( as_txn * txn)
inlinestatic

Return if the transaction monitor record should be closed/deleted. For internal use only.

Definition at line 256 of file as_txn.h.

References as_txn::deadline, and as_txn::write_in_doubt.

◆ as_txn_create()

AS_EXTERN as_txn * as_txn_create ( void )

Create transaction on heap, assign random transaction id and initialize reads/writes hashmaps with default capacities.

The default client transaction timeout is zero. This means use the server configuration mrt-duration as the transaction timeout. The default mrt-duration is 10 seconds.

◆ as_txn_create_capacity()

AS_EXTERN as_txn * as_txn_create_capacity ( uint32_t reads_capacity,
uint32_t writes_capacity )

Create transaction on heap, assign random transaction id and initialize reads/writes hashmaps with given capacities.

The default client transaction timeout is zero. This means use the server configuration mrt-duration as the transaction timeout. The default mrt-duration is 10 seconds.

Parameters
reads_capacityexpected number of record reads in the transaction. Minimum value is 16.
writes_capacityexpected number of record writes in the transaction. Minimum value is 16.

◆ as_txn_destroy()

AS_EXTERN void as_txn_destroy ( as_txn * txn)

Destroy transaction.

◆ as_txn_get_read_version()

AS_EXTERN uint64_t as_txn_get_read_version ( as_txn * txn,
const uint8_t * digest )

Get record version for a given key. For internal use only.

◆ as_txn_init()

AS_EXTERN void as_txn_init ( as_txn * txn)

Initialize transaction, assign random transaction id and initialize reads/writes hashmaps with default capacities.

The default client transaction timeout is zero. This means use the server configuration mrt-duration as the transaction timeout. The default mrt-duration is 10 seconds.

Call this function or as_txn_init_capacity(), but not both. Do not use this function for async commands (use as_txn_create() instead).

Parameters
txnTransaction.

◆ as_txn_init_capacity()

AS_EXTERN void as_txn_init_capacity ( as_txn * txn,
uint32_t reads_capacity,
uint32_t writes_capacity )

Initialize transaction, assign random transaction id and initialize reads/writes hashmaps with given capacities.

The default client transaction timeout is zero. This means use the server configuration mrt-duration as the transaction timeout. The default mrt-duration is 10 seconds.

Call this function or as_txn_init(), but not both. Do not use this function for async commands (use as_txn_create_capacity() instead).

Parameters
txnTransaction.
reads_capacityexpected number of record reads in the transaction. Minimum value is 16.
writes_capacityexpected number of record writes in the transaction. Minimum value is 16.

◆ as_txn_iter_next()

AS_EXTERN as_txn_key * as_txn_iter_next ( as_txn_iter * iter)

Return next available hash element or NULL if no more elements are available.

◆ as_txn_iter_reads()

static void as_txn_iter_reads ( as_txn_iter * iter,
as_txn * txn )
inlinestatic

Initialize read keys iterator.

Definition at line 280 of file as_txn.h.

References as_txn_iter::ele, as_txn_iter::idx, as_txn_iter::khash, as_txn::reads, as_txn_iter::row, and as_txn_hash::table.

◆ as_txn_iter_writes()

static void as_txn_iter_writes ( as_txn_iter * iter,
as_txn * txn )
inlinestatic

Initialize write keys iterator.

Definition at line 292 of file as_txn.h.

References as_txn_iter::ele, as_txn_iter::idx, as_txn_iter::khash, as_txn_iter::row, as_txn_hash::table, and as_txn::writes.

◆ as_txn_monitor_exists()

static bool as_txn_monitor_exists ( as_txn * txn)
inlinestatic

Does transaction monitor record exist.

Definition at line 265 of file as_txn.h.

References as_txn::deadline.

◆ as_txn_on_read()

AS_EXTERN void as_txn_on_read ( as_txn * txn,
const uint8_t * digest,
const char * set,
uint64_t version )

Process the results of a record read. For internal use only.

◆ as_txn_on_write()

AS_EXTERN void as_txn_on_write ( as_txn * txn,
const uint8_t * digest,
const char * set,
uint64_t version,
int rc )

Process the results of a record write. For internal use only.

◆ as_txn_on_write_in_doubt()

AS_EXTERN void as_txn_on_write_in_doubt ( as_txn * txn,
const uint8_t * digest,
const char * set )

Add key to write hash when write command is in doubt (usually caused by timeout). For internal use only.

◆ as_txn_reads_size()

static uint32_t as_txn_reads_size ( as_txn * txn)
inlinestatic

Return read hash size.

Definition at line 194 of file as_txn.h.

References as_txn_hash::n_eles, and as_txn::reads.

◆ as_txn_set_ns()

AS_EXTERN as_status as_txn_set_ns ( as_txn * txn,
const char * ns,
as_error * err )

Set transaction namespace only if doesn't already exist. If namespace already exists, verify new namespace is the same. For internal use only.

◆ as_txn_set_timeout()

static void as_txn_set_timeout ( as_txn * txn,
uint32_t timeout )
inlinestatic

Set transaction timeout in seconds. The timer starts when the transaction monitor record is created. This occurs when the first command in the transaction is executed. If the timeout is reached before an aerospike_commit() or aerospike_abort() is called, the server will expire and rollback the transaction.

If the transaction timeout is zero, the server configuration mrt-duration is used. The default mrt-duration is 10 seconds.

Definition at line 185 of file as_txn.h.

References as_txn::timeout.

◆ as_txn_verify_command()

AS_EXTERN as_status as_txn_verify_command ( as_txn * txn,
as_error * err )

Verify that the transaction state allows future commands.

◆ as_txn_writes_contain()

AS_EXTERN bool as_txn_writes_contain ( as_txn * txn,
const as_key * key )

Return if writes hashmap contains the given key.

◆ as_txn_writes_size()

static uint32_t as_txn_writes_size ( as_txn * txn)
inlinestatic

Return write hash size.

Definition at line 215 of file as_txn.h.

References as_txn_hash::n_eles, and as_txn::writes.