Skip to main content

Crate noxu_xa

Crate noxu_xa 

Source
Expand description

Internal component of the noxu database.

This crate is published only so the noxu umbrella crate can depend on it. Use noxu (noxu = "3") in applications; depend on this crate directly only if you are extending the engine internals. Its API may change without a major version bump.

XA distributed transaction support for Noxu DB.

This crate implements the X/Open XA interface for coordinating distributed transactions across multiple Noxu environments. It provides:

  • Xid — XA transaction identifier (format_id + global_transaction_id + branch_qualifier)
  • XaFlags — flags for XA operations (JOIN, RESUME, TMSUCCESS, ONEPHASE, etc.)
  • XaResource — trait defining the XA resource manager interface
  • XaEnvironment — implementation of XaResource backed by a Noxu Environment

§Example

use noxu_xa::{XaEnvironment, XaResource, Xid, XaFlags, PrepareResult};

let xa = XaEnvironment::new(env);
let xid = Xid::new(1, b"global_txn_1", b"branch_1").unwrap();

xa.xa_start(&xid, XaFlags::NOFLAGS)?;
// ... perform database operations using xa.get_transaction(&xid) ...
xa.xa_end(&xid, XaFlags::TMSUCCESS)?;

match xa.xa_prepare(&xid, XaFlags::NOFLAGS)? {
    PrepareResult::Ok => xa.xa_commit(&xid, XaFlags::NOFLAGS)?,
    PrepareResult::ReadOnly => {} // no commit needed
}

Re-exports§

pub use environment::XaEnvironment;
pub use error::PrepareResult;
pub use error::XaError;
pub use error::XaResult;
pub use flags::XaFlags;
pub use prepared_log::PreparedLog;
pub use resource::XaResource;
pub use xid::Xid;
pub use xid::XidError;

Modules§

environment
XA Environment — wraps a Noxu Environment to provide XA resource management.
error
XA error types.
flags
XA flags and return codes.
prepared_log
Persistent prepared-transaction log for XA crash recovery.
resource
XA Resource Manager trait.
xid
XA Transaction Identifier (Xid).