![]() |
Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
|
DEMO |
Writes AI trading decision records to Parquet files with cryptographic hash chaining for tamper-evident audit trails. More...
#include <decision_log.hpp>
Public Member Functions | |
| DecisionLogWriter (const std::string &output_dir, const std::string &chain_id="", size_t max_records=100000) | |
| Create a decision log writer. | |
| void | set_instrument_validator (std::function< bool(const std::string &)> validator) |
| Set an optional symbol/instrument validator callback (MiFID II RTS 24). | |
| expected< HashChainEntry > | log (const DecisionRecord &record) |
| Log a trading decision. | |
| expected< void > | flush () |
| Flush current records to a Parquet file. | |
| expected< void > | close () |
| Close the writer (flushes remaining records). | |
| AuditMetadata | current_metadata () const |
| Get the chain metadata for the current batch. | |
| size_t | pending_records () const |
| Get the number of records in the current (unflushed) batch. | |
| int64_t | total_records () const |
| Get the total number of records written across all files. | |
| std::string | current_file_path () const |
| Get the file path of the current (or last written) output file. | |
Writes AI trading decision records to Parquet files with cryptographic hash chaining for tamper-evident audit trails.
Usage: DecisionLogWriter writer("/audit/decisions"); DecisionRecord rec; rec.timestamp_ns = now_ns(); rec.strategy_id = 1; rec.symbol = "BTC-USD"; // ... fill other fields ... auto entry = writer.log(rec); writer.close();
Files are named: decision_log_{chain_id}_{start_seq}_{end_seq}.parquet Each file embeds AuditMetadata in the Parquet key-value metadata for chain continuity verification across file rotations.
Definition at line 553 of file decision_log.hpp.
|
inline |
Create a decision log writer.
| output_dir | Directory to write Parquet files to |
| chain_id | Unique chain identifier (auto-generated if empty) |
| max_records | Max records per file before rotating (default 100,000) |
Definition at line 559 of file decision_log.hpp.
|
inline |
Close the writer (flushes remaining records).
Definition at line 734 of file decision_log.hpp.
|
inline |
Get the file path of the current (or last written) output file.
Definition at line 780 of file decision_log.hpp.
|
inline |
Get the chain metadata for the current batch.
Returns metadata describing the hash chain state, including the chain ID, first/last sequence numbers, and boundary hashes.
Definition at line 745 of file decision_log.hpp.
|
inline |
Flush current records to a Parquet file.
Writes all pending records to a new Parquet file with the schema defined by decision_log_schema(). The hash chain metadata is embedded in the file's key-value metadata section.
Definition at line 652 of file decision_log.hpp.
|
inline |
Log a trading decision.
Returns the hash chain entry.
The record is serialized, hashed, and appended to the hash chain. If the pending buffer reaches max_records, the file is automatically flushed and rotated.
Definition at line 610 of file decision_log.hpp.
|
inline |
Get the number of records in the current (unflushed) batch.
Definition at line 770 of file decision_log.hpp.
|
inline |
Set an optional symbol/instrument validator callback (MiFID II RTS 24).
If set, each record's symbol is validated before logging. Invalid symbols cause log() to return INVALID_ARGUMENT.
Definition at line 601 of file decision_log.hpp.
|
inline |
Get the total number of records written across all files.
Definition at line 775 of file decision_log.hpp.