sparrow-ipc 0.3.0
Loading...
Searching...
No Matches
sparrow_ipc::dictionary_tracker Class Reference

Tracks dictionaries during serialization. More...

#include <dictionary_tracker.hpp>

Public Member Functions

std::vector< dictionary_infoextract_dictionaries_from_batch (const sparrow::record_batch &batch)
 Extract dictionaries from a record batch.
 
void mark_emitted (int64_t id) noexcept
 Mark a dictionary as emitted.
 
bool is_emitted (int64_t id) const noexcept
 Check if a dictionary has been emitted.
 
void reset () noexcept
 Reset tracking state.
 

Detailed Description

Tracks dictionaries during serialization.

This class is responsible for discovering dictionary-encoded fields in record batches, extracting their dictionary data, and managing which dictionaries have been emitted to the output stream.

Dictionaries must be emitted before any RecordBatch that references them. This class ensures proper ordering by tracking emitted dictionary IDs and providing methods to determine which dictionaries need to be sent before each record batch.

Definition at line 37 of file dictionary_tracker.hpp.

Member Function Documentation

◆ extract_dictionaries_from_batch()

std::vector< dictionary_info > sparrow_ipc::dictionary_tracker::extract_dictionaries_from_batch ( const sparrow::record_batch & batch)
nodiscard

Extract dictionaries from a record batch.

Scans all columns in the record batch for dictionary-encoded fields. Returns a vector of dictionaries that need to be emitted before this record batch can be serialized.

Parameters
batchThe record batch to scan for dictionaries
Returns
Vector of dictionary_info for dictionaries that haven't been emitted yet
Here is the caller graph for this function:

◆ is_emitted()

bool sparrow_ipc::dictionary_tracker::is_emitted ( int64_t id) const
nodiscardnoexcept

Check if a dictionary has been emitted.

Parameters
idThe dictionary ID to check
Returns
true if the dictionary has been emitted, false otherwise

◆ mark_emitted()

void sparrow_ipc::dictionary_tracker::mark_emitted ( int64_t id)
noexcept

Mark a dictionary as emitted.

After a dictionary has been written to the stream, call this method to record that it has been emitted. This prevents re-emission of the same dictionary for subsequent record batches (unless it's a delta update).

Parameters
idThe dictionary ID that was emitted
Here is the caller graph for this function:

◆ reset()

void sparrow_ipc::dictionary_tracker::reset ( )
noexcept

Reset tracking state.

Clears all tracking information. Useful when starting a new stream.


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