MySQL 9.0.0
Source Code Documentation
page_id_t Class Reference

Page identifier. More...

#include <buf0types.h>

Public Member Functions

 page_id_t ()=delete
 This class does not have a default constructor, because there is no natural choice for default values of m_space and m_page_no. More...
 
 page_id_t (space_id_t space, page_no_t page_no)
 Constructor from (space, page_no). More...
 
space_id_t space () const
 Retrieve the tablespace id. More...
 
page_no_t page_no () const
 Retrieve the page number. More...
 
uint64_t hash () const
 Retrieve the hash value. More...
 
void reset (space_id_t space, page_no_t page_no)
 Reset the values from a (space, page_no). More...
 
void set_page_no (page_no_t page_no)
 Reset the page number only. More...
 
bool operator== (const page_id_t &a) const
 Check if a given page_id_t object is equal to the current one. More...
 
bool operator!= (const page_id_t &a) const
 Check if a given page_id_t object is not equal to the current one. More...
 
bool operator< (const page_id_t &other) const
 Provides a lexicographic ordering on <space_id,page_no> pairs. More...
 

Private Attributes

space_id_t m_space
 Tablespace id. More...
 
page_no_t m_page_no
 Page number. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const page_id_t &page_id)
 Print the given page_id_t object. More...
 

Detailed Description

Page identifier.

Constructor & Destructor Documentation

◆ page_id_t() [1/2]

page_id_t::page_id_t ( )
delete

This class does not have a default constructor, because there is no natural choice for default values of m_space and m_page_no.

If 0,0 were used, then it's not good as it doesn't match UINT32_UNDEFINED used to denote impossible page_no_t in several places, and 0 is a legal value for both space_id_t and page_id_t of a real page!

If UINT32_UNDEFINED,UINT32_UNDEFINED were used, then it doesn't match the most common usage where use use memset(parent,0,sizeof(parent_t)); on a parent struct where one of the members has page_id_t type - which is ok given that page_id_t is TriviallyCopyable, and that the field is not used until it is assigned some real value. Such constructor would be misleading to people reading the code, as they might expect UINT32_UNDEFINED value, if they didn't notice the memset code buried somewhere in parent's initialization routine.

Therefore, please either be explicit by using (space,page_no) overload, or continue to use memset at your own risk.

◆ page_id_t() [2/2]

page_id_t::page_id_t ( space_id_t  space,
page_no_t  page_no 
)
inline

Constructor from (space, page_no).

Parameters
[in]spacetablespace id
[in]page_nopage number

Member Function Documentation

◆ hash()

uint64_t page_id_t::hash ( ) const
inline

Retrieve the hash value.

Returns
hashed value

◆ operator!=()

bool page_id_t::operator!= ( const page_id_t a) const
inline

Check if a given page_id_t object is not equal to the current one.

Parameters
[in]apage_id_t object to compare
Returns
true if not equal

◆ operator<()

bool page_id_t::operator< ( const page_id_t other) const
inline

Provides a lexicographic ordering on <space_id,page_no> pairs.

Parameters
[in]otherpage_id_t object to compare
Returns
true if this is strictly smaller than other

◆ operator==()

bool page_id_t::operator== ( const page_id_t a) const
inline

Check if a given page_id_t object is equal to the current one.

Parameters
[in]apage_id_t object to compare
Returns
true if equal

◆ page_no()

page_no_t page_id_t::page_no ( ) const
inline

Retrieve the page number.

Returns
page number

◆ reset()

void page_id_t::reset ( space_id_t  space,
page_no_t  page_no 
)
inline

Reset the values from a (space, page_no).

Parameters
[in]spacetablespace id
[in]page_nopage number

◆ set_page_no()

void page_id_t::set_page_no ( page_no_t  page_no)
inline

Reset the page number only.

Parameters
[in]page_nopage number

◆ space()

space_id_t page_id_t::space ( ) const
inline

Retrieve the tablespace id.

Returns
tablespace id

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const page_id_t page_id 
)
friend

Print the given page_id_t object.

Parameters
[in,out]outthe output stream
[in]page_idthe page_id_t object to be printed
Returns
the output stream

Member Data Documentation

◆ m_page_no

page_no_t page_id_t::m_page_no
private

Page number.

◆ m_space

space_id_t page_id_t::m_space
private

Tablespace id.


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