MySQL 8.0.39
Source Code Documentation
|
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... | |
Page identifier.
|
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.
|
inline |
Constructor from (space, page_no).
[in] | space | tablespace id |
[in] | page_no | page number |
|
inline |
Retrieve the hash value.
|
inline |
Check if a given page_id_t object is not equal to the current one.
[in] | a | page_id_t object to compare |
|
inline |
Provides a lexicographic ordering on <space_id,page_no> pairs.
[in] | other | page_id_t object to compare |
|
inline |
Check if a given page_id_t object is equal to the current one.
[in] | a | page_id_t object to compare |
|
inline |
Retrieve the page number.
|
inline |
Reset the values from a (space, page_no).
[in] | space | tablespace id |
[in] | page_no | page number |
|
inline |
Reset the page number only.
[in] | page_no | page number |
|
inline |
Retrieve the tablespace id.
|
friend |
Print the given page_id_t object.
[in,out] | out | the output stream |
[in] | page_id | the page_id_t object to be printed |
|
private |
Page number.
|
private |
Tablespace id.