Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
992d2494
Commit
992d2494
authored
May 30, 2019
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define page_id_t in buf0types.h
parent
f42bda6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
71 deletions
+71
-71
storage/innobase/include/buf0buf.h
storage/innobase/include/buf0buf.h
+0
-71
storage/innobase/include/buf0types.h
storage/innobase/include/buf0types.h
+71
-0
No files found.
storage/innobase/include/buf0buf.h
View file @
992d2494
...
...
@@ -214,77 +214,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
...
...
storage/innobase/include/buf0types.h
View file @
992d2494
...
...
@@ -134,6 +134,77 @@ this must be equal to srv_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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment