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::CSVLogStorage Class Reference

#include <duckdb.hpp>

Inheritance diagram for duckdb::CSVLogStorage:
Collaboration diagram for duckdb::CSVLogStorage:

Public Member Functions

 CSVLogStorage (DatabaseInstance &db, bool normalize, idx_t buffer_size)
 
- Public Member Functions inherited from duckdb::BufferingLogStorage
 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

void FlushChunk (LoggingTargetTable table, DataChunk &chunk) final
 Implement the BufferingLogStorage interface.
 
void ResetAllBuffers () override
 Resets all buffers and state.
 
void UpdateConfigInternal (DatabaseInstance &db, case_insensitive_map_t< Value > &config) override
 Implements CSVLogStorage specific config handling.
 
virtual void BeforeFlush (LoggingTargetTable table, DataChunk &chunk)
 Interface to child classes.
 
virtual void AfterFlush (LoggingTargetTable table, DataChunk &chunk)
 
void RegisterWriter (LoggingTargetTable table, unique_ptr< CSVWriter > writer)
 Helper functions.
 
CSVWriterGetWriter (LoggingTargetTable table)
 Returns the writer for a table.
 
void SetWriterConfigs (CSVWriter &Writer, vector< string > column_names)
 Configure a CSV writer by initializing its settings with the writer_options and reader_options settings.
 
CSVWriterOptionsGetCSVWriterOptions ()
 Allows child classes to manipulate options.
 
CSVReaderOptionsGetCSVReaderOptions ()
 Allows child classes to manipulate options.
 
- Protected Member Functions inherited from duckdb::BufferingLogStorage
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
 

Private Member Functions

void ExecuteCast (LoggingTargetTable table, DataChunk &chunk)
 Perform the cast (does not reset input chunk!)
 
void ResetCastChunk ()
 Reset the Cast chunks.
 
void InitializeCastChunk (LoggingTargetTable table)
 Initialize the cast chunks.
 

Private Attributes

map< LoggingTargetTable, unique_ptr< DataChunk > > cast_buffers
 The cast buffers used to cast from the original types to the VARCHAR types ready to write to CSV format.
 
map< LoggingTargetTable, unique_ptr< CSVWriter > > writers
 The writers to be registered by child classes.
 
unique_ptr< CSVWriterOptionswriter_options
 
unique_ptr< CSVReaderOptionsreader_options
 

Additional Inherited Members

- Static Public Member Functions inherited from duckdb::LogStorage
static vector< LogicalTypeGetSchema (LoggingTargetTable table)
 
static vector< string > GetColumnNames (LoggingTargetTable table)
 
- Protected Attributes inherited from duckdb::BufferingLogStorage
mutex lock
 
bool normalize_contexts = true
 

Detailed Description

The CSVLogStorage implements an additional layer on the BufferingLogStorage which will handle converting the log entries and contexts to CSV lines. It provides functionality to write log data in CSV format with automatic type casting and configuration of CSV writers. This class serves as a base for both file-based and stdout-based CSV logging.

Member Function Documentation

◆ FlushChunk()

void duckdb::CSVLogStorage::FlushChunk ( LoggingTargetTable  table,
DataChunk chunk 
)
finalprotectedvirtual

Implement the BufferingLogStorage interface.

Flushes the Chunk to the CSV writers

Implements duckdb::BufferingLogStorage.

◆ ResetAllBuffers()

void duckdb::CSVLogStorage::ResetAllBuffers ( )
overrideprotectedvirtual

Resets all buffers and state.

Reimplemented from duckdb::BufferingLogStorage.

◆ UpdateConfigInternal()

void duckdb::CSVLogStorage::UpdateConfigInternal ( DatabaseInstance db,
case_insensitive_map_t< Value > &  config 
)
overrideprotectedvirtual

Implements CSVLogStorage specific config handling.

Reimplemented from duckdb::BufferingLogStorage.

Reimplemented in duckdb::FileLogStorage.

◆ BeforeFlush()

virtual void duckdb::CSVLogStorage::BeforeFlush ( LoggingTargetTable  table,
DataChunk chunk 
)
inlineprotectedvirtual

Interface to child classes.

Hooks for child class to run code pre-flush

Reimplemented in duckdb::FileLogStorage.

39638{};

◆ AfterFlush()

virtual void duckdb::CSVLogStorage::AfterFlush ( LoggingTargetTable  table,
DataChunk chunk 
)
inlineprotectedvirtual

Reimplemented in duckdb::FileLogStorage.

39639{};

◆ RegisterWriter()

void duckdb::CSVLogStorage::RegisterWriter ( LoggingTargetTable  table,
unique_ptr< CSVWriter writer 
)
protected

Helper functions.

To be called by child classed to register the CSV writers used to write to.

Member Data Documentation

◆ writer_options

unique_ptr<CSVWriterOptions> duckdb::CSVLogStorage::writer_options
private

CSV Options to initialize the CSVWriters with. TODO: cleanup, this is now a little bit of a mixed bag of settings


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