Documentation
¶
Overview ¶
Package data provides Arrow IPC serialization and high-performance data handling. This package implements: - Arrow schema definitions for blockchain events - JSON to Arrow conversion - IPC serialization for Rust interop
Package data provides Arrow IPC serialization for zero-copy data transfer.
Package data provides Apache Arrow schema definitions matching HieraChain-Consensus (Rust). Schemas defined here MUST match exactly with src/core/schemas.rs to ensure Arrow IPC compatibility between Go and Rust components.
Index ¶
- func BlockHeaderSchema() *arrow.Schema
- func BlockSchema() *arrow.Schema
- func EventSchema() *arrow.Schema
- func TransactionSchema() *arrow.Schema
- func ValidateSchema(record arrow.Record, expected *arrow.Schema) error
- type Converter
- type EventJSON
- type IPCWriter
- func (w *IPCWriter) DeserializeAllFromIPC(data []byte) ([]arrow.Record, error)
- func (w *IPCWriter) DeserializeFromIPC(data []byte) (arrow.Record, error)
- func (w *IPCWriter) SerializeMultipleToIPC(records []arrow.Record) ([]byte, error)
- func (w *IPCWriter) SerializeToIPC(record arrow.Record) ([]byte, error)
- type TransactionJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockHeaderSchema ¶
BlockHeaderSchema returns the Arrow schema for a Block Header. Matches Rust: src/core/schemas.rs::get_block_header_schema()
Fields:
- index: int64 (nullable) - Block index/height
- timestamp: float64 (nullable) - Block creation timestamp
- previous_hash: string (nullable) - Hash of previous block
- nonce: int64 (nullable) - Block nonce
- merkle_root: string (nullable) - Merkle root of events
- hash: string (nullable) - Block hash
func BlockSchema ¶
BlockSchema returns the Arrow schema for a full Block (header + events). Matches Rust: src/core/schemas.rs::get_block_schema()
Fields:
- index: int64 - Block index/height
- timestamp: float64 - Block creation timestamp
- previous_hash: string - Hash of previous block
- nonce: int64 - Block nonce
- merkle_root: string - Merkle root of events
- hash: string - Block hash
- events: list<struct> - List of events in the block
- zk_proof: binary - ZK proof bytes (for SubChain -> MainChain)
- zk_public_inputs: binary - Public inputs for ZK verification
func EventSchema ¶
EventSchema returns the Arrow schema for an Event. Matches Rust: src/core/schemas.rs::get_event_schema()
Fields:
- entity_id: string (nullable) - Entity identifier
- event: string (nullable) - Event type name
- timestamp: float64 (nullable) - Unix timestamp
- details: map<string, string> (nullable) - Key-value metadata
- data: binary (nullable) - Raw event data
func TransactionSchema ¶
TransactionSchema returns the Arrow schema for a Transaction. Matches Rust: src/core/schemas.rs::get_transaction_schema() Updated to include ZK Proof fields for trustless verification
Types ¶
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
Converter handles JSON to Arrow conversion.
func NewConverter ¶
func NewConverter() *Converter
NewConverter creates a new Converter with the default memory allocator.
func NewConverterWithSchema ¶
NewConverterWithSchema creates a Converter with a custom schema.
func (*Converter) ArrowBatchToJSON ¶
ArrowBatchToJSON converts an Arrow RecordBatch back to JSON bytes.
func (*Converter) EventsToArrowBatch ¶
EventsToArrowBatch converts a slice of EventJSON to Arrow RecordBatch.
type EventJSON ¶
type EventJSON struct {
EntityID string `json:"entity_id"`
Event string `json:"event"`
Timestamp float64 `json:"timestamp"`
Details map[string]string `json:"details,omitempty"`
Data []byte `json:"data,omitempty"`
}
EventJSON represents an event in JSON format for conversion.
type IPCWriter ¶
type IPCWriter struct {
// contains filtered or unexported fields
}
IPCWriter writes Arrow RecordBatches to IPC format.
func (*IPCWriter) DeserializeAllFromIPC ¶
DeserializeAllFromIPC deserializes IPC bytes to all Arrow Records.
func (*IPCWriter) DeserializeFromIPC ¶
DeserializeFromIPC deserializes IPC bytes to an Arrow Record.
func (*IPCWriter) SerializeMultipleToIPC ¶
SerializeMultipleToIPC serializes multiple records to IPC bytes.
type TransactionJSON ¶
type TransactionJSON struct {
TxID string `json:"tx_id"`
EntityID string `json:"entity_id"`
EventType string `json:"event_type"`
Timestamp float64 `json:"timestamp"`
Data []byte `json:"data,omitempty"`
Signature string `json:"signature,omitempty"`
Details map[string]string `json:"details,omitempty"`
}
TransactionJSON represents a transaction in JSON format.