Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::FixedSizeBuffer Class Reference
Collaboration diagram for duckdb::FixedSizeBuffer:

Public Member Functions

 FixedSizeBuffer (BlockManager &block_manager, MemoryTag memory_tag)
 Constructor for a new in-memory buffer.
 
 FixedSizeBuffer (BlockManager &block_manager, const idx_t segment_count, const idx_t allocation_size, const BlockPointer &block_pointer)
 Constructor for deserializing buffer metadata from disk.
 

Static Public Attributes

static constexpr idx_t BASE [] = {0x00000000FFFFFFFF, 0x0000FFFF, 0x00FF, 0x0F, 0x3, 0x1}
 Constants for fast offset calculations in the bitmask.
 
static constexpr uint8_t SHIFT [] = {32, 16, 8, 4, 2, 1}
 

Private Member Functions

data_ptr_t GetDeprecated (const bool dirty_p=true)
 
bool InMemory () const
 Returns true, if the buffer is in-memory.
 
bool OnDisk () const
 Returns true, if the block is on-disk.
 
void Serialize (PartialBlockManager &partial_block_manager, const idx_t available_segments, const idx_t segment_size, const idx_t bitmask_offset)
 Serializes a buffer, if dirty or not on disk.
 
void LoadFromDisk ()
 Load a buffer from disk, if not in memory.
 
uint32_t GetOffset (const idx_t bitmask_count, const idx_t available_segments)
 Returns the first free offset in a bitmask.
 
void SetAllocationSize (const idx_t available_segments, const idx_t segment_size, const idx_t bitmask_offset)
 Sets the allocation size, if dirty.
 

Private Attributes

BlockManagerblock_manager
 Block manager of the database instance.
 
atomic< idx_treaders
 The number of active segments.
 
idx_t segment_count
 The number of allocated segments.
 
idx_t allocation_size
 The size of allocated memory in this buffer (necessary for copying while pinning)
 
bool dirty
 True: the in-memory buffer is no longer consistent with its optional copy on disk.
 
bool vacuum
 True: can be vacuumed after the vacuum operation.
 
bool loaded
 True: has been loaded from disk.
 
BlockPointer block_pointer
 Partial block id and offset.
 
BufferHandle buffer_handle
 The buffer handle of the in-memory buffer.
 
shared_ptr< BlockHandleblock_handle
 The block handle of the on-disk buffer.
 
mutex lock
 The lock for this fixed size buffer handle.
 

Friends

class FixedSizeAllocator
 
class SegmentHandle
 

Detailed Description

A fixed-size buffer holds fixed-size segments of data. It lazily deserializes a buffer, if on-disk and not in memory, and it only serializes dirty and non-written buffers to disk during serialization.

Member Function Documentation

◆ GetDeprecated()

data_ptr_t duckdb::FixedSizeBuffer::GetDeprecated ( const bool  dirty_p = true)
inlineprivate

Returns a pointer to the buffer in memory, and calls Deserialize, if the buffer is not in memory. DEPRECATED. Use segment handles.

11521 {
11522 lock_guard<mutex> l(lock);
11523 if (!InMemory()) {
11524 LoadFromDisk();
11525 }
11526 if (dirty_p) {
11527 dirty = dirty_p;
11528 }
11529 return buffer_handle.Ptr();
11530 }
data_ptr_t Ptr() const
Returns a pointer to the buffer data. Handle must be valid.
Definition duckdb.hpp:9927
BufferHandle buffer_handle
The buffer handle of the in-memory buffer.
Definition duckdb.cpp:11575
mutex lock
The lock for this fixed size buffer handle.
Definition duckdb.cpp:11579
bool dirty
True: the in-memory buffer is no longer consistent with its optional copy on disk.
Definition duckdb.cpp:11566
void LoadFromDisk()
Load a buffer from disk, if not in memory.
bool InMemory() const
Returns true, if the buffer is in-memory.
Definition duckdb.cpp:11533
Here is the call graph for this function:

◆ InMemory()

bool duckdb::FixedSizeBuffer::InMemory ( ) const
inlineprivate

Returns true, if the buffer is in-memory.

11533 {
11534 return buffer_handle.IsValid();
11535 }
DUCKDB_API bool IsValid() const
Returns whether or not the BufferHandle is valid.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnDisk()

bool duckdb::FixedSizeBuffer::OnDisk ( ) const
inlineprivate

Returns true, if the block is on-disk.

11538 {
11539 return block_pointer.IsValid();
11540 }
BlockPointer block_pointer
Partial block id and offset.
Definition duckdb.cpp:11573

Member Data Documentation

◆ BASE

constexpr idx_t duckdb::FixedSizeBuffer::BASE[] = {0x00000000FFFFFFFF, 0x0000FFFF, 0x00FF, 0x0F, 0x3, 0x1}
staticconstexpr

Constants for fast offset calculations in the bitmask.

11506{0x00000000FFFFFFFF, 0x0000FFFF, 0x00FF, 0x0F, 0x3, 0x1};

◆ SHIFT

constexpr uint8_t duckdb::FixedSizeBuffer::SHIFT[] = {32, 16, 8, 4, 2, 1}
staticconstexpr
11507{32, 16, 8, 4, 2, 1};

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