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::BufferingLogStorage Class Referenceabstract

#include <duckdb.hpp>

Inheritance diagram for duckdb::BufferingLogStorage:
Collaboration diagram for duckdb::BufferingLogStorage:

Public Member Functions

 BufferingLogStorage (DatabaseInstance &db_p, idx_t buffer_size, bool normalize)
 
void WriteLogEntry (timestamp_t timestamp, LogLevel level, const string &log_type, const string &log_message, const RegisteredLoggingContext &context) final
 (Partially) Implements LogStorage API
 
void WriteLogEntries (DataChunk &chunk, const RegisteredLoggingContext &context) final
 Write out the chunk to the buffers.
 
void FlushAll () final
 Flushes buffers for all tables.
 
void Flush (LoggingTargetTable table) final
 Flushes buffer for a specific table.
 
void Truncate () override
 Truncates log storage: both buffers and persistent storage (if applicable)
 
void UpdateConfig (DatabaseInstance &db, case_insensitive_map_t< Value > &config) override
 Apply a new log storage configuration.
 
bool IsEnabled (LoggingTargetTable table) override
 Returns whether the table is enabled for this storage.
 
- Public Member Functions inherited from duckdb::LogStorage
virtual const string GetStorageName ()=0
 
virtual DUCKDB_API bool CanScan (LoggingTargetTable table)
 READING (OPTIONAL)
 
virtual DUCKDB_API unique_ptr< LogStorageScanStateCreateScanState (LoggingTargetTable table) const
 
virtual DUCKDB_API bool Scan (LogStorageScanState &state, DataChunk &result) const
 
virtual DUCKDB_API void InitializeScan (LogStorageScanState &state) const
 
virtual DUCKDB_API unique_ptr< TableRefBindReplace (ClientContext &context, TableFunctionBindInput &input, LoggingTargetTable table)
 

Protected Member Functions

virtual void FlushChunk (LoggingTargetTable table, DataChunk &chunk)=0
 Interface to child classes.
 
virtual void UpdateConfigInternal (DatabaseInstance &db, case_insensitive_map_t< Value > &config)
 
virtual void ResetAllBuffers ()
 
void FlushAllInternal ()
 Helper methods.
 
void FlushInternal (LoggingTargetTable table)
 Flushes one of the tables.
 
bool IsEnabledInternal (LoggingTargetTable table)
 Whether a specific table is available in the log storage.
 
idx_t GetBufferLimit () const
 

Protected Attributes

mutex lock
 
bool normalize_contexts = true
 

Private Member Functions

void ResetLogBuffers ()
 Resets the log buffers.
 
void WriteLoggingContext (const RegisteredLoggingContext &context)
 Write out a logging context.
 

Private Attributes

unordered_set< idx_tregistered_contexts
 The currently registered RegisteredLoggingContext's.
 
idx_t buffer_limit = 0
 Configuration for buffering.
 
bool only_flush_on_full_buffer = false
 Debug option for testing buffering behaviour.
 
map< LoggingTargetTable, unique_ptr< DataChunk > > buffers
 The buffers used for each table.
 
bool flush_contexts_on_next_entry_flush = false
 

Additional Inherited Members

- Static Public Member Functions inherited from duckdb::LogStorage
static vector< LogicalTypeGetSchema (LoggingTargetTable table)
 
static vector< string > GetColumnNames (LoggingTargetTable table)
 

Detailed Description

The buffering Log storage implements a buffering mechanism around the Base LogStorage class. It implements some general features that most log storages will need.

Member Function Documentation

◆ WriteLogEntry()

void duckdb::BufferingLogStorage::WriteLogEntry ( timestamp_t  timestamp,
LogLevel  level,
const string &  log_type,
const string &  log_message,
const RegisteredLoggingContext context 
)
finalvirtual

(Partially) Implements LogStorage API

Write out the entry to the buffers

Implements duckdb::LogStorage.

◆ WriteLogEntries()

void duckdb::BufferingLogStorage::WriteLogEntries ( DataChunk chunk,
const RegisteredLoggingContext context 
)
finalvirtual

Write out the chunk to the buffers.

Implements duckdb::LogStorage.

◆ FlushAll()

void duckdb::BufferingLogStorage::FlushAll ( )
finalvirtual

Flushes buffers for all tables.

Implements duckdb::LogStorage.

◆ Flush()

void duckdb::BufferingLogStorage::Flush ( LoggingTargetTable  table)
finalvirtual

Flushes buffer for a specific table.

Implements duckdb::LogStorage.

◆ Truncate()

void duckdb::BufferingLogStorage::Truncate ( )
overridevirtual

Truncates log storage: both buffers and persistent storage (if applicable)

Reimplemented from duckdb::LogStorage.

Reimplemented in duckdb::FileLogStorage.

◆ UpdateConfig()

void duckdb::BufferingLogStorage::UpdateConfig ( DatabaseInstance db,
case_insensitive_map_t< Value > &  config 
)
overridevirtual

Apply a new log storage configuration.

Reimplemented from duckdb::LogStorage.

◆ IsEnabled()

bool duckdb::BufferingLogStorage::IsEnabled ( LoggingTargetTable  table)
overridevirtual

Returns whether the table is enabled for this storage.

Implements duckdb::LogStorage.

◆ FlushChunk()

virtual void duckdb::BufferingLogStorage::FlushChunk ( LoggingTargetTable  table,
DataChunk chunk 
)
protectedpure virtual

Interface to child classes.

Invoked whenever buffers are full to flush to storage

Implemented in duckdb::CSVLogStorage, and duckdb::InMemoryLogStorage.

◆ UpdateConfigInternal()

virtual void duckdb::BufferingLogStorage::UpdateConfigInternal ( DatabaseInstance db,
case_insensitive_map_t< Value > &  config 
)
protectedvirtual

This method is called in a chained way down the class hierarchy. This allows each class to interpret its own part of the config. Unhandled config values that are left over will result in an error

Reimplemented in duckdb::CSVLogStorage, and duckdb::FileLogStorage.

◆ ResetAllBuffers()

virtual void duckdb::BufferingLogStorage::ResetAllBuffers ( )
protectedvirtual

ResetAllBuffers will clear all buffered data. To be overridden by child classes to ensure their buffers are flushed too

Reimplemented in duckdb::CSVLogStorage, and duckdb::InMemoryLogStorage.

◆ FlushAllInternal()

void duckdb::BufferingLogStorage::FlushAllInternal ( )
protected

Helper methods.

Flushes all tables

Member Data Documentation

◆ lock

mutex duckdb::BufferingLogStorage::lock
mutableprotected

lock to be used by this class and child classes to ensure thread safety TODO: maybe remove and delegate thread-safety to LogManager?

◆ normalize_contexts

bool duckdb::BufferingLogStorage::normalize_contexts = true
protected

Switches between using false = use LoggingTargetTable::ALL_LOGS, true = use LoggingTargetTable::LOG_ENTIRES + LoggingTargetTable::CONTEXTS

◆ flush_contexts_on_next_entry_flush

bool duckdb::BufferingLogStorage::flush_contexts_on_next_entry_flush = false
private

This flag is set whenever a new context_is written to the entry buffer. It means that the next flush of LoggingTargetTable::LOG_ENTRIES also requires a flush of LoggingTargetTable::LOG_CONTEXTS


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