![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Background-thread Parquet compaction sink fed by a lock-free ring buffer. More...
#include <streaming_sink.hpp>
Classes | |
| struct | Options |
| Configuration options for StreamingSink::create(). More... | |
Public Member Functions | |
| StreamingSink (StreamingSink &&)=default | |
| StreamingSink & | operator= (StreamingSink &&)=default |
| StreamingSink (const StreamingSink &)=delete | |
| StreamingSink & | operator= (const StreamingSink &)=delete |
| ~StreamingSink () | |
| expected< void > | submit (StreamRecord rec) |
| Submit a fully-constructed StreamRecord to the ring buffer. | |
| expected< void > | submit (int64_t timestamp_ns, uint32_t type_id, const uint8_t *data, size_t size) |
| Submit a record from raw bytes. | |
| expected< void > | submit (int64_t timestamp_ns, uint32_t type_id, std::string_view sv) |
| Submit a record from a string_view payload. | |
| void | start () |
| Start the background compaction thread (no-op if already running). | |
| expected< void > | stop () |
| Stop the background thread, drain remaining records, and close open files. | |
| void | stop_nowait () |
| Signal the background thread to stop without waiting for it to finish. | |
| expected< void > | flush () |
| Drain the ring buffer and write all pending records, then close the current Parquet file so it has a valid footer and is immediately readable. | |
| uint64_t | records_submitted () const |
| Total number of records successfully submitted to the ring buffer. | |
| int64_t | records_written () const |
| Total number of records written to Parquet files. | |
| uint64_t | records_dropped () const |
| Total number of records dropped due to ring buffer overflow. | |
| int64_t | files_written () const |
| Number of completed Parquet output files. | |
| int64_t | bytes_written () const |
| Approximate total bytes written to the current output file. | |
| std::vector< std::string > | output_files () const |
| List of completed Parquet output file paths (thread-safe snapshot). | |
Static Public Member Functions | |
| static expected< StreamingSink > | create (Options opts) |
| Create a StreamingSink with the given options. | |
Background-thread Parquet compaction sink fed by a lock-free ring buffer.
Producers submit StreamRecords via submit(). A background thread drains the ring buffer at the configured flush_interval, writing records into Parquet files with automatic row-group flushing and file rolling.
Movable via unique_ptr<Impl>; all non-movable state (mutex, thread, ring) lives inside the Impl struct. Use StreamingSink::create() to construct.
Definition at line 405 of file streaming_sink.hpp.
|
default |
|
delete |
|
inline |
Definition at line 477 of file streaming_sink.hpp.
|
inline |
Approximate total bytes written to the current output file.
Definition at line 558 of file streaming_sink.hpp.
|
inlinestatic |
Create a StreamingSink with the given options.
Creates the output directory if it does not exist. Validates that ring_buffer_capacity is a power of two. If auto_start is true (default), the background compaction thread is started immediately.
| opts | Configuration options. |
Definition at line 434 of file streaming_sink.hpp.
|
inline |
Number of completed Parquet output files.
Definition at line 556 of file streaming_sink.hpp.
|
inline |
Drain the ring buffer and write all pending records, then close the current Parquet file so it has a valid footer and is immediately readable.
Blocks until complete.
Definition at line 543 of file streaming_sink.hpp.
|
delete |
|
default |
|
inline |
List of completed Parquet output file paths (thread-safe snapshot).
Definition at line 565 of file streaming_sink.hpp.
|
inline |
Total number of records dropped due to ring buffer overflow.
Definition at line 554 of file streaming_sink.hpp.
|
inline |
Total number of records successfully submitted to the ring buffer.
Definition at line 550 of file streaming_sink.hpp.
|
inline |
Total number of records written to Parquet files.
Definition at line 552 of file streaming_sink.hpp.
|
inline |
Start the background compaction thread (no-op if already running).
Definition at line 527 of file streaming_sink.hpp.
|
inline |
Stop the background thread, drain remaining records, and close open files.
Blocks until the thread has joined.
Definition at line 531 of file streaming_sink.hpp.
|
inline |
Signal the background thread to stop without waiting for it to finish.
Definition at line 533 of file streaming_sink.hpp.
|
inline |
Submit a record from raw bytes.
| timestamp_ns | Wall-clock timestamp in nanoseconds. |
| type_id | User-defined record type tag. |
| data | Raw payload bytes. |
| size | Number of bytes. |
Definition at line 499 of file streaming_sink.hpp.
|
inline |
Submit a record from a string_view payload.
| timestamp_ns | Wall-clock timestamp in nanoseconds. |
| type_id | User-defined record type tag. |
| sv | Payload as string_view. |
Definition at line 513 of file streaming_sink.hpp.
|
inline |
Submit a fully-constructed StreamRecord to the ring buffer.
Thread-safe (serialized via internal mutex).
| rec | Record to submit. |
Definition at line 489 of file streaming_sink.hpp.