MySQL  8.0.18
Source Code Documentation
binary_log::Uuid Struct Reference

This is a POD. More...

#include <uuid.h>

Public Member Functions

void clear ()
 Set to all zeros. More...
 
void copy_from (const unsigned char *data)
 Copies the given 16-byte data to this UUID. More...
 
void copy_from (const Uuid &data)
 Copies the given UUID object to this UUID. More...
 
void copy_to (unsigned char *data) const
 Copies the given UUID object to this UUID. More...
 
bool equals (const Uuid &other) const
 Returns true if this UUID is equal the given UUID. More...
 
int parse (const char *string, size_t len)
 Stores the UUID represented by a string of the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX or {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} in this object. More...
 
size_t to_string (char *buf) const
 Generates a 36+1 character long representation of this UUID object in the given string buffer. More...
 
void print () const
 

Static Public Member Functions

static bool is_valid (const char *string, size_t len)
 Returns true if parse() would succeed, but doesn't store the result. More...
 
static int parse (const char *in_string, size_t len, const unsigned char *out_binary_string)
 Parses the UUID passed as argument in in_string and functions and writes the binary representation in out_binary_string. More...
 
static bool read_section (int section_len, const char **section_str, const unsigned char **out_binary_str)
 Helper method used to validate and parse one section of a uuid. More...
 
static size_t to_string (const unsigned char *bytes_arg, char *buf)
 Convert the given binary buffer to a UUID. More...
 

Public Attributes

unsigned char bytes [BYTE_LENGTH]
 The data for this Uuid. More...
 

Static Public Attributes

static const size_t BYTE_LENGTH = 16
 The number of bytes in the data of a Uuid. More...
 
static const size_t TEXT_LENGTH = 36
 The number of bytes in the textual representation of a Uuid. More...
 
static const size_t BIT_LENGTH = 128
 The number of bits in the data of a Uuid. More...
 
static const int NUMBER_OF_SECTIONS = 5
 
static const int bytes_per_section [NUMBER_OF_SECTIONS] = {4, 2, 2, 2, 6}
 
static const int hex_to_byte [256]
 

Detailed Description

This is a POD.

It has to be a POD because it is a member of Sid_map::Node which is stored in HASH in mysql-server code. The structure contains the following components.

Structure gtid_info
Name Format Description
byte unsigned char array This stores the Uuid of the server on which transaction is originated

Member Function Documentation

◆ clear()

void binary_log::Uuid::clear ( )
inline

Set to all zeros.

◆ copy_from() [1/2]

void binary_log::Uuid::copy_from ( const unsigned char *  data)
inline

Copies the given 16-byte data to this UUID.

◆ copy_from() [2/2]

void binary_log::Uuid::copy_from ( const Uuid data)
inline

Copies the given UUID object to this UUID.

◆ copy_to()

void binary_log::Uuid::copy_to ( unsigned char *  data) const
inline

Copies the given UUID object to this UUID.

◆ equals()

bool binary_log::Uuid::equals ( const Uuid other) const
inline

Returns true if this UUID is equal the given UUID.

◆ is_valid()

bool binary_log::Uuid::is_valid ( const char *  string,
size_t  len 
)
static

Returns true if parse() would succeed, but doesn't store the result.

Parameters
stringString that needs to be checked.
lenLength of that string.
Return values
truevalid string.
falseinvalid string.

◆ parse() [1/2]

int binary_log::Uuid::parse ( const char *  string,
size_t  len 
)

Stores the UUID represented by a string of the form XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX or {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} in this object.

Parameters
stringString to be parsed and stored.
lenLength of that string.
Return values
0success.
>0failure.

◆ parse() [2/2]

int binary_log::Uuid::parse ( const char *  in_string,
size_t  len,
const unsigned char *  out_binary_string 
)
static

Parses the UUID passed as argument in in_string and functions and writes the binary representation in out_binary_string.

Depends on UUID's read_section method and the constants for text length.

Parameters
[in]in_stringString to be parsed.
[in]lenLength of that string.
[out]out_binary_stringString where the binary UUID will be stored
Return values
0success.
>0failure.

◆ print()

void binary_log::Uuid::print ( ) const
inline

◆ read_section()

bool binary_log::Uuid::read_section ( int  section_len,
const char **  section_str,
const unsigned char **  out_binary_str 
)
static

Helper method used to validate and parse one section of a uuid.

If the last parameter, out_binary_str, is NULL then the function will just validate the section.

Parameters
[in]section_lenLength of the section to be parsed.
[in,out]section_strPointer to a string containing the section. It will be updated during the execution as the string is parsed.
[out]out_binary_strString where the section will be stored in binary format. If null, the function will just validate the input string.
Return values
falsesuccess.
truefailure.

◆ to_string() [1/2]

size_t binary_log::Uuid::to_string ( char *  buf) const

Generates a 36+1 character long representation of this UUID object in the given string buffer.

Return values
36- the length of the resulting string.

◆ to_string() [2/2]

size_t binary_log::Uuid::to_string ( const unsigned char *  bytes_arg,
char *  buf 
)
static

Convert the given binary buffer to a UUID.

Member Data Documentation

◆ BIT_LENGTH

const size_t binary_log::Uuid::BIT_LENGTH = 128
static

The number of bits in the data of a Uuid.

◆ BYTE_LENGTH

const size_t binary_log::Uuid::BYTE_LENGTH = 16
static

The number of bytes in the data of a Uuid.

◆ bytes

unsigned char binary_log::Uuid::bytes[BYTE_LENGTH]

The data for this Uuid.

◆ bytes_per_section

const int binary_log::Uuid::bytes_per_section = {4, 2, 2, 2, 6}
static

◆ hex_to_byte

const int binary_log::Uuid::hex_to_byte
static
Initial value:
= {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8,
9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1,
}

◆ NUMBER_OF_SECTIONS

const int binary_log::Uuid::NUMBER_OF_SECTIONS = 5
static

◆ TEXT_LENGTH

const size_t binary_log::Uuid::TEXT_LENGTH = 36
static

The number of bytes in the textual representation of a Uuid.


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