MySQL 8.0.40
Source Code Documentation
binary_log::gtids::Gtid_set Class Reference

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

#include <gtidset.h>

Classes

struct  Uuid_comparator
 

Public Types

typedef std::map< Uuid, std::set< Gno_interval >, Uuid_comparatorGno_interval_list
 Gno_interval_list is a map between uuids and an ordered set of Gno_intervals. More...
 

Public Member Functions

 Gtid_set ()=default
 
virtual ~Gtid_set ()
 
 Gtid_set (const Gtid_set &other)
 Construct a new Gtid_set object from the other one provided. More...
 
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 bool add (const Uuid &uuid, const Gno_interval &interval)
 Adds a new interval indexed by the given uuid. More...
 
virtual const Gno_interval_listget_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 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 {""}
 
static const std::string SEPARATOR_SEQNO_INTERVALS {":"}
 In 'UUID:INTERVAL:INTERVAL', this is the second ':'. More...
 
static const std::string SEPARATOR_UUID_SETS {","}
 In 'SID:GNO,SID:GNO', this is the ','. More...
 

Protected Member Functions

virtual bool do_add (const Uuid &uuid, const Gno_interval &interval)
 

Protected Attributes

Gno_interval_list 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

◆ Gno_interval_list

Gno_interval_list is a map between uuids and an ordered set of Gno_intervals.

Constructor & Destructor Documentation

◆ Gtid_set() [1/2]

binary_log::gtids::Gtid_set::Gtid_set ( )
default

◆ ~Gtid_set()

Gtid_set::~Gtid_set ( )
virtualdefault

◆ Gtid_set() [2/2]

Gtid_set::Gtid_set ( const Gtid_set other)

Construct a new Gtid_set object from the other one provided.

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
otherGtid_set to be copied

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 Uuid uuid,
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()

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

◆ get_gtid_set()

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

Gets a copy of the internal set.

Returns
an internal copy of the given set.

◆ 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

const std::string binary_log::gtids::Gtid_set::EMPTY_GTID_SET {""}
inlinestatic

◆ m_gtid_set

Gno_interval_list binary_log::gtids::Gtid_set::m_gtid_set {}
protected

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

The order is established using the Uuid_comparator.

◆ SEPARATOR_SEQNO_INTERVALS

const std::string binary_log::gtids::Gtid_set::SEPARATOR_SEQNO_INTERVALS {":"}
inlinestatic

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

◆ SEPARATOR_UUID_SETS

const std::string binary_log::gtids::Gtid_set::SEPARATOR_UUID_SETS {","}
inlinestatic

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


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