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::ZSTDCompressionBufferCollection Struct Reference
Collaboration diagram for duckdb::ZSTDCompressionBufferCollection:

Classes

struct  BufferData

Public Types

enum class  Slot : uint8_t { SEGMENT , OVERFLOW_0 , OVERFLOW_1 }

Public Member Functions

page_id_t GetCurrentId () const
void SetCurrentBuffer (Slot slot, page_offset_t offset=0)
page_offset_t & GetCurrentOffset ()
void AlignCurrentOffset ()
BufferHandle & BufferHandleMutable ()
vector< BufferData > GetBufferData (bool include_segment)
data_ptr_t GetCurrentBufferPtr ()
bool CanFlush () const
ZSTDCompressionBufferFlags & GetCurrentFlags ()
ZSTDCompressionBufferState & GetCurrentBufferState ()
bool IsOnSegmentBuffer () const

Public Attributes

block_id_t block_id = INVALID_BLOCK
unique_ptr< ColumnSegment > segment
 The current segment + buffer of the segment.
BufferHandle segment_handle
BufferHandle extra_pages [2]
ZSTDCompressionBufferState buffer_states [3]

Private Attributes

optional_idx buffer_index

Member Enumeration Documentation

◆ Slot

enum class duckdb::ZSTDCompressionBufferCollection::Slot : uint8_t
strong
406879: uint8_t { SEGMENT, OVERFLOW_0, OVERFLOW_1 };
::uint8_t uint8_t

Member Function Documentation

◆ GetCurrentId()

page_id_t duckdb::ZSTDCompressionBufferCollection::GetCurrentId ( ) const
inline
406895 {
406896#ifdef DEBUG
406897 if (!buffer_index.IsValid() || buffer_index == 0) {
406898 D_ASSERT(block_id == INVALID_BLOCK);
406899 } else {
406900 D_ASSERT(block_id != INVALID_BLOCK);
406901 }
406902#endif
406903 return block_id;
406904 }
block_id_t block_id
Definition duckdb.cpp:407006

◆ SetCurrentBuffer()

void duckdb::ZSTDCompressionBufferCollection::SetCurrentBuffer ( Slot slot,
page_offset_t offset = 0 )
inline
406907 {
406908 idx_t index;
406909 switch (slot) {
406910 case Slot::SEGMENT:
406911 index = 0;
406912 break;
406913 case Slot::OVERFLOW_0:
406914 index = 1;
406915 break;
406916 case Slot::OVERFLOW_1:
406917 index = 2;
406918 break;
406919 default:
406920 throw InternalException("ZSTDCompressionBufferCollection::Slot value not handled");
406921 };
406922 buffer_index = index;
406923 buffer_states[index].offset = offset;
406924 }
index
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
ZSTDCompressionBufferState buffer_states[3]
Definition duckdb.cpp:407017

◆ GetCurrentOffset()

page_offset_t & duckdb::ZSTDCompressionBufferCollection::GetCurrentOffset ( )
inline
406925 {
406926 if (!buffer_index.IsValid()) {
406927 throw InternalException(
406928 "(ZSTDCompressionBufferCollection::GetCurrentOffset) Can't get BufferHandle, no buffer set yet!");
406929 }
406930 auto index = buffer_index.GetIndex();
406931 auto &offset = buffer_states[index].offset;
406932 return offset;
406933 }

◆ AlignCurrentOffset()

void duckdb::ZSTDCompressionBufferCollection::AlignCurrentOffset ( )
inline
406934 {
406935 auto &offset = GetCurrentOffset();
406936 offset = UnsafeNumericCast<page_offset_t>(
406937 AlignValue<idx_t, sizeof(string_length_t)>(UnsafeNumericCast<idx_t>(offset)));
406938 }
static T AlignValue(T n)
Align value (ceiling) (not for pointer types).
Definition duckdb.hpp:2126

◆ BufferHandleMutable()

BufferHandle & duckdb::ZSTDCompressionBufferCollection::BufferHandleMutable ( )
inline
406939 {
406940 if (!buffer_index.IsValid()) {
406941 throw InternalException(
406942 "(ZSTDCompressionBufferCollection::BufferHandleMutable) Can't get BufferHandle, no buffer set yet!");
406943 }
406944 auto index = buffer_index.GetIndex();
406945 if (index == 0) {
406946 return segment_handle;
406947 }
406948 D_ASSERT(index < 3);
406949 return extra_pages[index - 1];
406950 }

◆ GetBufferData()

vector< BufferData > duckdb::ZSTDCompressionBufferCollection::GetBufferData ( bool include_segment)
inline
406951 {
406952 vector<BufferData> res;
406953 for (idx_t i = 0; i < 3; i++) {
406954 if (!i) {
406955 if (include_segment) {
406956 res.emplace_back(segment_handle, buffer_states[i], Slot::SEGMENT);
406957 }
406958 continue;
406959 }
406960 res.emplace_back(extra_pages[i - 1], buffer_states[i], i == 1 ? Slot::OVERFLOW_0 : Slot::OVERFLOW_1);
406961 }
406962 return res;
406963 }

◆ GetCurrentBufferPtr()

data_ptr_t duckdb::ZSTDCompressionBufferCollection::GetCurrentBufferPtr ( )
inline
406964 {
406965 if (!buffer_index.IsValid()) {
406966 throw InternalException(
406967 "(ZSTDCompressionBufferCollection::GetCurrentBufferPtr) Can't get BufferHandle, no buffer set yet!");
406968 }
406969 auto index = buffer_index.GetIndex();
406970 auto &state = buffer_states[index];
406971 return BufferHandleMutable().Ptr() + state.offset;
406972 }

◆ CanFlush()

bool duckdb::ZSTDCompressionBufferCollection::CanFlush ( ) const
inline

Can't flush the segment buffer

406973 {
406974 if (!buffer_index.IsValid()) {
406975 throw InternalException(
406976 "(ZSTDCompressionBufferCollection::CanFlush) Can't determine CanFlush, no buffer set yet!");
406977 }
406978 auto index = buffer_index.GetIndex();
406979 if (index == 0) {
406981 return false;
406982 }
406983 auto &flags = buffer_states[index].flags;
406984 return !flags.HasVectorMetadata() && !flags.HasStringMetadata();
406985 }

◆ GetCurrentFlags()

ZSTDCompressionBufferFlags & duckdb::ZSTDCompressionBufferCollection::GetCurrentFlags ( )
inline
406986 {
406987 return GetCurrentBufferState().flags;
406988 }

◆ GetCurrentBufferState()

ZSTDCompressionBufferState & duckdb::ZSTDCompressionBufferCollection::GetCurrentBufferState ( )
inline
406989 {
406990 if (!buffer_index.IsValid()) {
406991 throw InternalException(
406992 "(ZSTDCompressionBufferCollection::GetCurrentBufferState) Can't get BufferState, no buffer set yet!");
406993 }
406994 return buffer_states[buffer_index.GetIndex()];
406995 }

◆ IsOnSegmentBuffer()

bool duckdb::ZSTDCompressionBufferCollection::IsOnSegmentBuffer ( ) const
inline
406996 {
406997 if (!buffer_index.IsValid()) {
406998 return false;
406999 }
407000 return buffer_index.GetIndex() == 0;
407001 }

Member Data Documentation

◆ block_id

block_id_t duckdb::ZSTDCompressionBufferCollection::block_id = INVALID_BLOCK

Current block-id of the overflow page we're writing NOTE: INVALID_BLOCK means we haven't spilled to an overflow page yet

◆ buffer_states

ZSTDCompressionBufferState duckdb::ZSTDCompressionBufferCollection::buffer_states[3]

0: segment_handle 1: extra_pages[0]; 2: extra_pages[1];


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