7.8 Transactions
A transaction batches key creates and mutating value/key operations into an atomic unit.
int ;
int ;
int ;
int ;
peios_reg_begin_transactionstarts one and returns a transaction fd (initially unbound; it binds to a source on first use), or-1/ENOMEM. Pass this fd as thetxn_fdargument to the create and mutating calls to enlist them. Closing the fd without committing aborts the transaction — so a transaction is abort-by-default, which makes error paths safe.peios_reg_commitatomically applies everything enlisted. On success the fd is terminal — close it. Errors tell you what to do:EINVAL(already committed / never bound),EBUSY(write-lock contention — the transaction stays active, retry the commit),EIO(source failure — stays active),ETIMEDOUT.peios_reg_txn_statusreads a transaction's state:state_outreceives theREG_TXN_*state, andterminal_errno_outreceives the errno that ended it (0while active or after a clean commit). Both can beNULL.
The lifecycle: begin → enlist operations by passing txn_fd → commit
(retry on EBUSY/EIO) → close, or close to abort.
peios_reg_begin_read_transaction instead begins a read-only snapshot. The
first read binds one hive and fixes data and layer selection. Reads and
enumeration accept its fd directly; key opening, metadata, and security reads
use their _transacted forms. Mutations fail EROFS. A capture race returns
EAGAIN; repeat the complete read with a fresh transaction. Closing releases
it. Normal transaction timeouts and read-only source quotas apply.