MySQL 8.4.2
Source Code Documentation
mysql::gtid::Gtid_set Class Reference

This class represents a set of transaction identifiers. More...

#include <gtidset.h>

Public Types

using Tag = mysql::gtid::Tag
 
using Tsid = mysql::gtid::Tsid
 
using Interval_set = std::set< Gno_interval >
 Tsid_interval_map is a 2-level map between tsids and an ordered set of Gno_intervals. More...
 
using Tag_interval_map = std::map< Tag, Interval_set >
 
using Tsid_interval_map = std::map< Uuid, Tag_interval_map >
 

Public Member Functions

 Gtid_set ()=default
 
virtual ~Gtid_set ()
 
 Gtid_set (const Gtid_set &other)=delete
 
Gtid_setoperator= (const Gtid_set &other)
 Copy assignment. More...
 
virtual bool operator== (const Gtid_set &other) const
 Compares this set with another one. More...
 
virtual Gtid_format get_gtid_set_format () const
 Iterates through recorded TSIDs and returns format of the Gtid_set. More...
 
virtual bool add (const Tsid &tsid, const Gno_interval &interval)
 Adds a new interval indexed by the given uuid. More...
 
virtual const Tsid_interval_mapget_gtid_set () const
 Gets a copy of the internal set. More...
 
virtual bool add (const Gtid_set &other)
 Add a set of identifiers to this one. More...
 
virtual std::size_t get_num_tsids () const
 Get the num TSIDs held in the GTID set. More...
 
virtual bool add (const Gtid &gtid)
 Adds the given identifier to this set. More...
 
virtual bool contains (const Gtid &gtid) const
 Checks whether this set contains the given identifier. More...
 
virtual std::string to_string () const
 A human readable representation of this set. More...
 
virtual void reset ()
 Resets this set, making it empty. More...
 
virtual bool is_empty () const
 Returns true if this is an empty set. More...
 
virtual std::size_t count () const
 Gets the number of entries in this set. More...
 

Static Public Attributes

static const std::string empty_gtid_set_str {""}
 
static const std::string separator_interval {":"}
 In 'UUID:INTERVAL:INTERVAL', this is the second ':'. More...
 
static const std::string separator_uuid_set {","}
 In 'SID:GNO,SID:GNO', this is the ','. More...
 

Protected Member Functions

virtual bool do_add (const Tsid &tsid, const Gno_interval &interval)
 
virtual bool do_add (const Uuid &uuid, const Tag &tag, const Gno_interval &interval)
 

Protected Attributes

Tsid_interval_map m_gtid_set {}
 An ordered map of entries mapping Uuid to a list of intervals. More...
 

Detailed Description

This class represents a set of transaction identifiers.

A set of transaction identifiers contains zero or more entries. When there are multiple entries, there can multiple intervals as well. Different intervals may share the same UUID part or not. This class abstracts that in-memory representation.

Member Typedef Documentation

◆ Interval_set

Tsid_interval_map is a 2-level map between tsids and an ordered set of Gno_intervals.

Uuid is mapped into GTID tags, each pair of Uuid and Tag (TSID) is mapped into ordered set of gno intervals

◆ Tag

◆ Tag_interval_map

◆ Tsid

◆ Tsid_interval_map

Constructor & Destructor Documentation

◆ Gtid_set() [1/2]

mysql::gtid::Gtid_set::Gtid_set ( )
default

◆ ~Gtid_set()

Gtid_set::~Gtid_set ( )
virtualdefault

◆ Gtid_set() [2/2]

mysql::gtid::Gtid_set::Gtid_set ( const Gtid_set other)
delete

Member Function Documentation

◆ add() [1/3]

bool Gtid_set::add ( const Gtid gtid)
virtual

Adds the given identifier to this set.

Note
This member function does not check whether the parameters are valid or not. The caller should perform such check before calling this member function.
Parameters
gtidthe identifier to add.
Returns
true if it failed while adding the identifier.
false otherwise.

◆ add() [2/3]

bool Gtid_set::add ( const Gtid_set other)
virtual

Add a set of identifiers to this one.

Note
This member function does not check whether the parameters are valid or not. The caller should perform such check before calling this member function.
Parameters
otherthe set to add to this one.
Returns
true if there was a failure adding the gtids.
false otherwise.

◆ add() [3/3]

bool Gtid_set::add ( const Tsid tsid,
const Gno_interval interval 
)
virtual

Adds a new interval indexed by the given uuid.

Note
This member function does not check whether the parameters are valid or not. The caller should perform such check before calling this member function.
Returns
true if the there was an error adding the interval, false otherwise.

◆ contains()

bool Gtid_set::contains ( const Gtid gtid) const
virtual

Checks whether this set contains the given identifier.

Note
This member function does not check whether the parameters are valid or not. The caller should perform such check before calling this member function.
Parameters
gtidthe gtid to check whehther it exists in this set or not.
Returns
true if the identifier exists in this set.
false if the identifier does not exist in this set.

◆ count()

std::size_t Gtid_set::count ( ) const
virtual

Gets the number of entries in this set.

Returns
the cardinality of this set.

◆ do_add() [1/2]

bool Gtid_set::do_add ( const Tsid tsid,
const Gno_interval interval 
)
protectedvirtual

◆ do_add() [2/2]

bool Gtid_set::do_add ( const Uuid uuid,
const Tag tag,
const Gno_interval interval 
)
protectedvirtual

◆ get_gtid_set()

const Gtid_set::Tsid_interval_map & Gtid_set::get_gtid_set ( ) const
virtual

Gets a copy of the internal set.

Returns
an internal copy of the given set.

◆ get_gtid_set_format()

Gtid_format Gtid_set::get_gtid_set_format ( ) const
virtual

Iterates through recorded TSIDs and returns format of the Gtid_set.

Returns
Format of this GTID set
See also
Gtid_format

◆ get_num_tsids()

std::size_t Gtid_set::get_num_tsids ( ) const
virtual

Get the num TSIDs held in the GTID set.

Returns
std::size_t Number of TSIDs

◆ is_empty()

bool Gtid_set::is_empty ( ) const
virtual

Returns true if this is an empty set.

Returns
true
false

◆ operator=()

Gtid_set & Gtid_set::operator= ( const Gtid_set other)

Copy assignment.

Note
This operator does not check whether the parameters are valid or not. The caller should perform such check before calling this member function.
Parameters
otherthe Gtid_set to be copied over to this one.
Returns
Gtid_set& a reference to the copied Gtid_set.

◆ operator==()

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

Compares this set with another one.

Parameters
otherThe other set to compare this one with.
Returns
true If both sets match.
false If sets do not match.

◆ reset()

void Gtid_set::reset ( )
virtual

Resets this set, making it empty.

◆ to_string()

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

A human readable representation of this set.

Returns
a human readable representation of this set.

Member Data Documentation

◆ empty_gtid_set_str

const std::string mysql::gtid::Gtid_set::empty_gtid_set_str {""}
inlinestatic

◆ m_gtid_set

Tsid_interval_map mysql::gtid::Gtid_set::m_gtid_set {}
protected

An ordered map of entries mapping Uuid to a list of intervals.

◆ separator_interval

const std::string mysql::gtid::Gtid_set::separator_interval {":"}
inlinestatic

In 'UUID:INTERVAL:INTERVAL', this is the second ':'.

◆ separator_uuid_set

const std::string mysql::gtid::Gtid_set::separator_uuid_set {","}
inlinestatic

In 'SID:GNO,SID:GNO', this is the ','.


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