Struct dist_tx::tm::XaTransactionId
source · pub struct XaTransactionId { /* private fields */ }
Expand description
The ID of a distributed transaction, in analogy to the X/Open XA standard.
Implementations
sourceimpl XaTransactionId
impl XaTransactionId
sourcepub fn try_new(
format_id: i32,
global_tid: Vec<u8>,
branch_qualifier: Vec<u8>
) -> XaResult<XaTransactionId>
pub fn try_new(
format_id: i32,
global_tid: Vec<u8>,
branch_qualifier: Vec<u8>
) -> XaResult<XaTransactionId>
Creates an instance of XaTransactionId
from the three components
format_id
, global_tid
, and branch_qualifier
.
Note that the lengths of the binary parameters must not exceed 64
.
XA uses a signed int for the format_id, but recommends using only -1, 0, and positive values, where -1 is used to represent the NULL value.
sourcepub fn null_ta() -> XaTransactionId
pub fn null_ta() -> XaTransactionId
Creates an instance of XaTransactionId
that represents NULL.
sourcepub fn get_format_id(&self) -> i32
pub fn get_format_id(&self) -> i32
Returns the format_id.
sourcepub fn get_global_tid(&self) -> &Vec<u8>
pub fn get_global_tid(&self) -> &Vec<u8>
Returns a reference to the global transaction id.
sourcepub fn get_branch_qualifier(&self) -> &Vec<u8>
pub fn get_branch_qualifier(&self) -> &Vec<u8>
Returns a reference to the branch qualifier.
sourcepub fn as_bytes(&self, padding: bool) -> Result<Vec<u8>>
pub fn as_bytes(&self, padding: bool) -> Result<Vec<u8>>
Provides a binary representation. If padding is true, and the combined length of the binary fields is below 128 bytes, the missing number of zero bytes are appended to make the byte pattern compatible with the XA structure in C.
sourcepub fn parse(
bytes: &[u8],
count: u64,
padding: bool
) -> XaResult<Vec<XaTransactionId>>
pub fn parse(
bytes: &[u8],
count: u64,
padding: bool
) -> XaResult<Vec<XaTransactionId>>
Reads a Vec of instances from a binary representation. If padding is true, and the combined length of the binary fields is below 128 bytes, the missing number of bytes are skipped to make the byte pattern compatible with the XA structure in C.
Trait Implementations
sourceimpl Clone for XaTransactionId
impl Clone for XaTransactionId
sourcefn clone(&self) -> XaTransactionId
fn clone(&self) -> XaTransactionId
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more