diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-30 20:59:34 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-05-31 09:57:40 +0300 |
commit | 9d142a895c4ac9e34f839222df70b967dfb840e3 (patch) | |
tree | bce4cc3bb604158905baebd355871f70a82a472a | |
parent | 80a142f14622e4c578ebc3bb47d307ddb860f3f9 (diff) | |
download | mariadb-git-9d142a895c4ac9e34f839222df70b967dfb840e3.tar.gz |
Define page_id_t in buf0types.h
-rw-r--r-- | storage/innobase/include/buf0buf.h | 71 | ||||
-rw-r--r-- | storage/innobase/include/buf0types.h | 71 |
2 files changed, 71 insertions, 71 deletions
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 58314bed71a..086bfb12710 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -215,77 +215,6 @@ struct buf_pools_list_size_t { }; #endif /* !UNIV_INNOCHECKSUM */ -/** Page identifier. */ -class page_id_t { -public: - - /** Constructor from (space, page_no). - @param[in] space tablespace id - @param[in] page_no page number */ - page_id_t(ulint space, ulint page_no) - : m_space(uint32_t(space)), m_page_no(uint32(page_no)) - { - ut_ad(space <= 0xFFFFFFFFU); - ut_ad(page_no <= 0xFFFFFFFFU); - } - - bool operator==(const page_id_t& rhs) const - { - return m_space == rhs.m_space && m_page_no == rhs.m_page_no; - } - bool operator!=(const page_id_t& rhs) const { return !(*this == rhs); } - - bool operator<(const page_id_t& rhs) const - { - if (m_space == rhs.m_space) { - return m_page_no < rhs.m_page_no; - } - - return m_space < rhs.m_space; - } - - /** Retrieve the tablespace id. - @return tablespace id */ - uint32_t space() const { return m_space; } - - /** Retrieve the page number. - @return page number */ - uint32_t page_no() const { return m_page_no; } - - /** Retrieve the fold value. - @return fold value */ - ulint fold() const { return (m_space << 20) + m_space + m_page_no; } - - /** Reset the page number only. - @param[in] page_no page number */ - inline void set_page_no(ulint page_no) - { - m_page_no = uint32_t(page_no); - - ut_ad(page_no <= 0xFFFFFFFFU); - } - -private: - - /** Tablespace id. */ - uint32_t m_space; - - /** Page number. */ - uint32_t m_page_no; - - /** Declare the overloaded global operator<< as a friend of this - class. Refer to the global declaration for further details. Print - the given page_id_t object. - @param[in,out] out the output stream - @param[in] page_id the page_id_t object to be printed - @return the output stream */ - friend - std::ostream& - operator<<( - std::ostream& out, - const page_id_t page_id); -}; - /** Print the given page_id_t object. @param[in,out] out the output stream @param[in] page_id the page_id_t object to be printed diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h index 2523c0054d3..63299681823 100644 --- a/storage/innobase/include/buf0types.h +++ b/storage/innobase/include/buf0types.h @@ -125,6 +125,77 @@ this must be equal to UNIV_PAGE_SIZE */ #define BUF_BUDDY_HIGH (BUF_BUDDY_LOW << BUF_BUDDY_SIZES) /* @} */ +/** Page identifier. */ +class page_id_t { +public: + + /** Constructor from (space, page_no). + @param[in] space tablespace id + @param[in] page_no page number */ + page_id_t(ulint space, ulint page_no) + : m_space(uint32_t(space)), m_page_no(uint32(page_no)) + { + ut_ad(space <= 0xFFFFFFFFU); + ut_ad(page_no <= 0xFFFFFFFFU); + } + + bool operator==(const page_id_t& rhs) const + { + return m_space == rhs.m_space && m_page_no == rhs.m_page_no; + } + bool operator!=(const page_id_t& rhs) const { return !(*this == rhs); } + + bool operator<(const page_id_t& rhs) const + { + if (m_space == rhs.m_space) { + return m_page_no < rhs.m_page_no; + } + + return m_space < rhs.m_space; + } + + /** Retrieve the tablespace id. + @return tablespace id */ + uint32_t space() const { return m_space; } + + /** Retrieve the page number. + @return page number */ + uint32_t page_no() const { return m_page_no; } + + /** Retrieve the fold value. + @return fold value */ + ulint fold() const { return (m_space << 20) + m_space + m_page_no; } + + /** Reset the page number only. + @param[in] page_no page number */ + void set_page_no(ulint page_no) + { + m_page_no = uint32_t(page_no); + + ut_ad(page_no <= 0xFFFFFFFFU); + } + +private: + + /** Tablespace id. */ + uint32_t m_space; + + /** Page number. */ + uint32_t m_page_no; + + /** Declare the overloaded global operator<< as a friend of this + class. Refer to the global declaration for further details. Print + the given page_id_t object. + @param[in,out] out the output stream + @param[in] page_id the page_id_t object to be printed + @return the output stream */ + friend + std::ostream& + operator<<( + std::ostream& out, + const page_id_t page_id); +}; + #ifndef UNIV_INNOCHECKSUM #include "ut0mutex.h" |