MySQL 8.4.3
Source Code Documentation
mysql::gtid::Gtid Class Reference

Represents a MySQL Global Transaction Identifier. More...

#include <gtid.h>

Public Member Functions

 Gtid ()=default
 Construct an empty GTID. More...
 
 Gtid (const Tsid &tsid, gno_t gno)
 Construct a new Gtid object. More...
 
virtual ~Gtid ()
 Destroy the Gtid object. More...
 
virtual gno_t get_gno () const
 Get the sequence number of this transaction identifier. More...
 
virtual const Uuidget_uuid () const
 Get the uuid of this transaction identifier. More...
 
virtual const Tsidget_tsid () const
 Get the tsid of this transaction identifier. More...
 
virtual const Tagget_tag () const
 Get the tag of this transaction identifier. More...
 
virtual std::string to_string () const
 Gets a human readable representation of this transaction identifier. More...
 
virtual std::size_t encode_gtid_tagged (unsigned char *buf) const
 Encodes GTID into a binary format. More...
 
virtual std::size_t decode_gtid_tagged (const unsigned char *buf, std::size_t buf_len)
 Decodes GTID from a given buffer. More...
 
virtual bool operator== (const Gtid &other) const
 Compares two identifiers and returns whether they match or not. More...
 
virtual bool operator!= (const Gtid &other) const
 Compares two identifiers and returns whether they are different. More...
 
virtual Gtidoperator= (const Gtid &other)
 Copy assignment. More...
 
 Gtid (const Gtid &other)
 Construct a new Gtid object from another one, by deep copying its contents. More...
 

Static Public Member Functions

static constexpr std::size_t get_max_encoded_length ()
 Gets maximum length of encoded GTID in compile time. More...
 

Static Public Attributes

static constexpr auto separator_gtid {':'}
 In 'UUID:SEQNO', this is the ':'. More...
 

Protected Attributes

Tsid m_tsid
 
gno_t m_gno {0}
 

Detailed Description

Represents a MySQL Global Transaction Identifier.

This class abstracts the representation of a Global Transaction Identifier.

It contains two fields, a TSID, composed of UUID and tag, and a sequence number.

Constructor & Destructor Documentation

◆ Gtid() [1/3]

mysql::gtid::Gtid::Gtid ( )
default

Construct an empty GTID.

◆ Gtid() [2/3]

Gtid::Gtid ( const Tsid tsid,
gno_t  gno 
)

Construct a new Gtid object.

Parameters
tsidTSID part of the transaction identifier
gnoThe gno part of the transaction identfier.

◆ ~Gtid()

Gtid::~Gtid ( )
virtualdefault

Destroy the Gtid object.

◆ Gtid() [3/3]

Gtid::Gtid ( const Gtid other)

Construct a new Gtid object from another one, by deep copying its contents.

Parameters
otherthe other gtid to construct this gtid from.

Member Function Documentation

◆ decode_gtid_tagged()

std::size_t Gtid::decode_gtid_tagged ( const unsigned char *  buf,
std::size_t  buf_len 
)
virtual

Decodes GTID from a given buffer.

Supported is only tagged format of a GTID. Buf must contain required number of bytes

Parameters
bufBuffer to read from
buf_lenBuffer length in bytes
Returns
Number of bytes read from the buffer or 0 in case decoding is not possible

◆ encode_gtid_tagged()

std::size_t Gtid::encode_gtid_tagged ( unsigned char *  buf) const
virtual

Encodes GTID into a binary format.

Supported is only tagged format of a GTID. Buf must be preallocated with a required number of bytes

Parameters
bufBuffer to write to
Returns
Number of bytes written

◆ get_gno()

gno_t Gtid::get_gno ( ) const
virtual

Get the sequence number of this transaction identifier.

Returns
The sequence number part of this transaction identifier.

◆ get_max_encoded_length()

static constexpr std::size_t mysql::gtid::Gtid::get_max_encoded_length ( )
inlinestaticconstexpr

Gets maximum length of encoded GTID in compile time.

Returns
Maximum number of bytes needed to store GTID

◆ get_tag()

const Tag & Gtid::get_tag ( ) const
virtual

Get the tag of this transaction identifier.

Returns
The tag part of this transaction identifier.

◆ get_tsid()

const Tsid & Gtid::get_tsid ( ) const
virtual

Get the tsid of this transaction identifier.

Returns
The tsid part of this transaction identifier.

◆ get_uuid()

const Uuid & Gtid::get_uuid ( ) const
virtual

Get the uuid of this transaction identifier.

Returns
The uuid part of this transaction identifier.

◆ operator!=()

bool Gtid::operator!= ( const Gtid other) const
virtual

Compares two identifiers and returns whether they are different.

Parameters
otherThe other transaction identifier to compare to this one.
Returns
true if the identifiers are different.
false otherwise.

◆ operator=()

Gtid & Gtid::operator= ( const Gtid other)
virtual

Copy assignment.

Note that this operator will do a deep copy of the other identifier.

Parameters
otherCopies the uuid and gno of the other identifier.
Returns
a copy of the other identifier.

◆ operator==()

bool Gtid::operator== ( const Gtid other) const
virtual

Compares two identifiers and returns whether they match or not.

Parameters
otherThe other transaction identifier to compare to this one.
Returns
true if the identifiers are equal.
false otherwise.

◆ to_string()

std::string Gtid::to_string ( ) const
virtual

Gets a human readable representation of this transaction identifier.

Returns
A human readable representation of this transaction identifier.

Member Data Documentation

◆ m_gno

gno_t mysql::gtid::Gtid::m_gno {0}
protected

◆ m_tsid

Tsid mysql::gtid::Gtid::m_tsid
protected

◆ separator_gtid

constexpr auto mysql::gtid::Gtid::separator_gtid {':'}
staticconstexpr

In 'UUID:SEQNO', this is the ':'.


The documentation for this class was generated from the following files: