MySQL 8.4.2
Source Code Documentation
buf::Block_hint Class Reference

#include <buf0block_hint.h>

Public Member Functions

void store (buf_block_t *block)
 Stores the pointer to the block, which is currently buffer-fixed. More...
 
void clear ()
 Clears currently stored pointer. More...
 
template<typename F >
auto run_with_hint (F &&f)
 Executes given function with the block pointer which was previously stored or with nullptr if the pointer is no longer valid, was cleared or not stored. More...
 

Private Member Functions

void buffer_fix_block_if_still_valid ()
 A helper function which checks if m_block is not a dangling pointer and still points to block with page with m_page_id and if so, buffer-fixes it, otherwise clear()s it. More...
 

Static Private Member Functions

static void buffer_unfix_block_if_needed (buf_block_t *block)
 A helper function which decrements block->buf_fix_count if it's non-null. More...
 

Private Attributes

buf_block_tm_block {nullptr}
 The block pointer stored by store(). More...
 
page_id_t m_page_id {0, 0}
 If m_block is non-null, the m_block->page.id at time it was stored. More...
 

Member Function Documentation

◆ buffer_fix_block_if_still_valid()

void buf::Block_hint::buffer_fix_block_if_still_valid ( )
private

A helper function which checks if m_block is not a dangling pointer and still points to block with page with m_page_id and if so, buffer-fixes it, otherwise clear()s it.

◆ buffer_unfix_block_if_needed()

void buf::Block_hint::buffer_unfix_block_if_needed ( buf_block_t block)
staticprivate

A helper function which decrements block->buf_fix_count if it's non-null.

Parameters
[in]blockA pointer to a block or nullptr

◆ clear()

void buf::Block_hint::clear ( )

Clears currently stored pointer.

◆ run_with_hint()

template<typename F >
auto buf::Block_hint::run_with_hint ( F &&  f)
inline

Executes given function with the block pointer which was previously stored or with nullptr if the pointer is no longer valid, was cleared or not stored.

Parameters
[in]fThe function to be executed. It will be passed the pointer. If you wish to use the block pointer subsequently, you need to ensure you buffer-fix it before returning from f.
Returns
the return value of f

◆ store()

void buf::Block_hint::store ( buf_block_t block)

Stores the pointer to the block, which is currently buffer-fixed.

Parameters
[in]blocka pointer to a buffer-fixed block to be stored

Member Data Documentation

◆ m_block

buf_block_t* buf::Block_hint::m_block {nullptr}
private

The block pointer stored by store().

◆ m_page_id

page_id_t buf::Block_hint::m_page_id {0, 0}
private

If m_block is non-null, the m_block->page.id at time it was stored.


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