Aerospike.Txn (Aerospike Driver v0.3.1)

Copy Markdown View Source

Transaction handle for multi-record transactions.

Aerospike.Txn is an immutable handle that identifies a transaction in progress. Create one with new/0 or new/1, then pass it as the :txn option to transaction-aware single-record commands.

Creating this struct does not start a transaction by itself. Runtime state lives in the started cluster's ETS tables and is initialized when Aerospike.transaction/2 or Aerospike.transaction/3 enters the callback. This struct only carries the transaction identifier and timeout.

The handle is only valid against the cluster that initialized it. A fresh %Aerospike.Txn{} or a handle reused against another cluster has no runtime state behind it, so transaction commands reject it.

Passing the same %Aerospike.Txn{} to multiple concurrent processes is undefined behavior. The tracking row is shared mutable state, and the driver does not serialize concurrent updates around one transaction handle.

Summary

Types

Option accepted by new/1.

Keyword options accepted by new/1.

t()

Multi-record transaction handle.

Functions

Creates a new transaction handle with a random signed int64 ID.

Creates a new transaction handle with the given options.

Types

option()

@type option() :: {:timeout, non_neg_integer()}

Option accepted by new/1.

opts()

@type opts() :: [option()]

Keyword options accepted by new/1.

t()

@type t() :: %Aerospike.Txn{id: integer(), timeout: non_neg_integer()}

Multi-record transaction handle.

id is the signed 64-bit transaction identifier sent to the server. timeout is the multi-record transaction timeout in milliseconds, where 0 asks the server to use its configured default duration.

Functions

new()

@spec new() :: t()

Creates a new transaction handle with a random signed int64 ID.

new(opts)

@spec new(opts()) :: t()

Creates a new transaction handle with the given options.

Options:

  • :timeout — transaction timeout in milliseconds. 0 asks the server to use its configured multi-record transaction duration.