Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::AuditMetadata Struct Reference

Chain summary stored in Parquet key-value metadata. More...

#include <audit_chain.hpp>

Public Member Functions

std::vector< std::pair< std::string, std::string > > to_key_values () const
 Export as Parquet file key-value metadata pairs.
 
std::string serialize () const
 Convert to a semicolon-delimited metadata string.
 

Static Public Member Functions

static expected< AuditMetadatadeserialize (const std::string &s)
 Parse a metadata string back into AuditMetadata.
 

Public Attributes

std::string chain_id
 Unique identifier for this chain (generated by generate_chain_id()).
 
int64_t start_sequence = 0
 Sequence number of the first entry in this file's chain segment.
 
int64_t end_sequence = 0
 Sequence number of the last entry in this file's chain segment.
 
std::array< uint8_t, 32 > first_prev_hash {}
 prev_hash of the first entry in this segment (links to the prior file).
 
std::array< uint8_t, 32 > last_entry_hash {}
 entry_hash of the last entry in this segment.
 
std::string created_by = SIGNET_CREATED_BY
 Creator string (e.g. "SignetStack signet-forge version 0.1.0").
 
Extended metadata fields

Used by decision_log / inference_log writers to embed chain information in Parquet file key-value metadata.

std::string first_hash
 Hex string of the first entry's entry_hash in this segment.
 
std::string last_hash
 Hex string of the last entry's entry_hash in this segment.
 
std::string prev_file_hash
 Hex string of the first entry's prev_hash (links to the prior file).
 
int64_t record_count = 0
 Number of audit records in this segment.
 
std::string record_type
 Record type: "decision", "inference", etc.
 

Detailed Description

Chain summary stored in Parquet key-value metadata.

Each Parquet file that contains a hash chain segment stores an AuditMetadata record in its key-value metadata. This allows fast cross-file chain verification: you only need to compare the last_entry_hash of file N with the first_prev_hash of file N+1, without reading every entry.

Serialization format (semicolon-delimited key=value pairs):

chain_id=<id>;start_seq=<n>;end_seq=<n>;
first_prev=<64 hex>;last_hash=<64 hex>;created_by=<string>
std::string last_hash
Hex string of the last entry's entry_hash in this segment.
std::string created_by
Creator string (e.g. "SignetStack signet-forge version 0.1.0").
std::string chain_id
Unique identifier for this chain (generated by generate_chain_id()).
See also
QuantizationParams for the same serialization pattern.

Definition at line 748 of file audit_chain.hpp.

Member Function Documentation

◆ deserialize()

static expected< AuditMetadata > signet::forge::AuditMetadata::deserialize ( const std::string &  s)
inlinestatic

Parse a metadata string back into AuditMetadata.

Expects the format produced by serialize(). Returns an error if required fields are missing or malformed.

Parameters
sThe semicolon-delimited metadata string.
Returns
The deserialized AuditMetadata, or an error on parse failure.

Definition at line 840 of file audit_chain.hpp.

◆ serialize()

std::string signet::forge::AuditMetadata::serialize ( ) const
inline

Convert to a semicolon-delimited metadata string.

Format:

chain_id=<id>;start_seq=<n>;end_seq=<n>;
first_prev=<64 hex>;last_hash=<64 hex>;created_by=<string>

All values are plain ASCII. Hash values are lowercase hex.

Returns
The serialized metadata string.

Definition at line 822 of file audit_chain.hpp.

◆ to_key_values()

std::vector< std::pair< std::string, std::string > > signet::forge::AuditMetadata::to_key_values ( ) const
inline

Export as Parquet file key-value metadata pairs.

Returns
A vector of (key, value) pairs suitable for embedding in the Parquet file footer metadata (WriterOptions::file_metadata).

Definition at line 796 of file audit_chain.hpp.

Member Data Documentation

◆ chain_id

std::string signet::forge::AuditMetadata::chain_id

Unique identifier for this chain (generated by generate_chain_id()).

All files in the same logical audit trail share the same chain_id.

Definition at line 751 of file audit_chain.hpp.

◆ created_by

std::string signet::forge::AuditMetadata::created_by = SIGNET_CREATED_BY

Creator string (e.g. "SignetStack signet-forge version 0.1.0").

Definition at line 768 of file audit_chain.hpp.

◆ end_sequence

int64_t signet::forge::AuditMetadata::end_sequence = 0

Sequence number of the last entry in this file's chain segment.

Definition at line 757 of file audit_chain.hpp.

◆ first_hash

std::string signet::forge::AuditMetadata::first_hash

Hex string of the first entry's entry_hash in this segment.

Definition at line 776 of file audit_chain.hpp.

◆ first_prev_hash

std::array<uint8_t, 32> signet::forge::AuditMetadata::first_prev_hash {}

prev_hash of the first entry in this segment (links to the prior file).

All zeros if this is the first file in the chain.

Definition at line 761 of file audit_chain.hpp.

◆ last_entry_hash

std::array<uint8_t, 32> signet::forge::AuditMetadata::last_entry_hash {}

entry_hash of the last entry in this segment.

The next file's first entry must have this as its prev_hash.

Definition at line 765 of file audit_chain.hpp.

◆ last_hash

std::string signet::forge::AuditMetadata::last_hash

Hex string of the last entry's entry_hash in this segment.

Definition at line 779 of file audit_chain.hpp.

◆ prev_file_hash

std::string signet::forge::AuditMetadata::prev_file_hash

Hex string of the first entry's prev_hash (links to the prior file).

Definition at line 782 of file audit_chain.hpp.

◆ record_count

int64_t signet::forge::AuditMetadata::record_count = 0

Number of audit records in this segment.

Definition at line 785 of file audit_chain.hpp.

◆ record_type

std::string signet::forge::AuditMetadata::record_type

Record type: "decision", "inference", etc.

Definition at line 788 of file audit_chain.hpp.

◆ start_sequence

int64_t signet::forge::AuditMetadata::start_sequence = 0

Sequence number of the first entry in this file's chain segment.

Definition at line 754 of file audit_chain.hpp.


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