Expand description
Acta v0.2 file validation and metadata reading.
validate checks a file’s framing, schema descriptors, and block
metadata. validate_with_options can additionally decode every complete
block and verify logical values and optional statistics. Reader exposes
that same information as an open-time snapshot of the schema and the
committed blocks. Both walk the file through one shared parser, so they
agree about which files are well formed.
Logical block decoding is available through Reader::read_block, which
decodes one whole block, and the lazy sequential Reader::scan API, which
can restrict a read to a projection of the columns and to a half-open
PrimaryRange over the primary column, pruning blocks by their stored
bounds before reading them. A snapshot Scan is immutable: it decodes
only the blocks the reader held when it was created, so later appends
cannot enter it. To follow an append-only file as it grows,
Reader::refresh extends the snapshot in place with frames committed
since it was opened, and Reader::tail returns a Tail that polls the
path for newly committed frames synchronously, one block per poll, without
sleeping or blocking. A tail never exposes a partial frame, never infers a
global primary ordering, and stops cleanly by being dropped. Writer
creates deterministic plain/raw v0.2 files by default, buffers appended
batches into blocks bounded by a row and a byte target, and can explicitly
select Zstandard when the default zstd feature is enabled. Writer-side
transforms, fixed policies, deterministic adaptive encoding, and optional
block-local min/max statistics are available through additive writer
options; their defaults leave the plain/raw output unchanged. Statistics
are written under WriterStatistics, which is generation only: nothing
reads them for pruning, since PrimaryRange prunes on the mandatory
primary bounds in the block header. Writer::open reconstructs a
complete existing file and resumes the same append engine that
Writer::create enters, exposing the reconstructed schema through
Writer::schema; Writer::open_with_schema adds an exact schema guard
and Writer::open_with_limits reads the existing file under explicit
Limits. Both entry points hold a cooperative exclusive writer lock that
never blocks readers. Incomplete tails require explicit recovery and are
not silently truncated. inspect_recovery is a read-only snapshot, while
repair_incomplete_tail is a destructive operation narrowly limited to a
structurally verified incomplete final data frame.
let report = acta::validate("spec/v0.2/fixtures/minimal/minimal.acta")?;
assert_eq!(report.format_version(), (0, 2));
assert_eq!(report.frame_count(), 2);
assert!(!report.incomplete_tail());Explicit recovery is a read-only inspection followed by an intentional, narrowly bounded repair:
let path = std::path::Path::new("ticks.acta");
let plan = acta::inspect_recovery(path)?;
if plan.requires_repair() {
let summary = acta::repair_incomplete_tail(path)?;
println!("removed {} bytes", summary.bytes_removed());
}Full validation is opt-in because it decodes every complete block and verifies optional statistics, while structural validation only walks the metadata needed to establish a safe snapshot.
Structs§
- Binary
Array - A binary array.
FixedBinaryuses the same representation and carries its width in the corresponding schema column. - Block
Metadata - Read-only metadata for one complete, committed data block.
- Column
- One immutable column in a
Schema. - Decimal
Array - A decimal64 array whose values are signed unscaled integers.
- Error
- An Acta error with a category, optional file offset, and parsing context.
- File
Metadata - File-level metadata retained by a
Readersnapshot. - Limits
- Bounds checked against declared sizes before any file region is read.
- Primary
Bounds - The inclusive primary timestamp/date bounds declared by one block.
- Primitive
Array - A typed fixed-width array with optional row validity.
- Reader
- A metadata-first, open-time snapshot of an Acta v0.2 file.
- Record
Batch - A decoded block with one logical array per schema column.
- Recovery
Plan - A read-only, point-in-time recovery decision for an Acta file.
- Recovery
Summary - The result of successfully repairing one incomplete final data frame.
- Refresh
Report - What one
Reader::refreshadded to a snapshot. - Scan
- A lazy, sequential scan over the committed blocks in a reader snapshot.
- Scan
Metrics - Aggregate work counters for one scan. These expose only logical scan accounting; physical descriptor tables and decoder state remain private.
- Schema
- The fixed schema shared by every block in an Acta file.
- Tail
- A live tail over the frames appended after a reader’s snapshot.
- Timestamp
Array - A timestamp64 array retaining its schema unit and timezone annotation.
- Utf8
Array - A UTF-8 array with one string slot per logical row.
- Validation
Options - Options controlling Acta validation.
- Validation
Report - The result of a sequential Acta v0.2 structural validation.
- Write
Accounting - A point-in-time view of writer data accounting.
- Write
Summary - The result of a successfully finished writer.
- Writer
- A synchronous buffered writer for Acta v0.2 append sessions.
- Writer
Options - Options for buffered Stage 7 writing.
Enums§
- Array
- A logical column array. Each variant has exactly one value position per row; nullability is carried by the typed array’s validity bitmap.
- Error
Context - The region of a file an error was detected in.
- Error
Kind - The broad category of an Acta failure.
- Logical
Type - A v0.2 logical column type.
- Primary
Range - A typed half-open range over the schema’s primary column.
- Recovery
Action - The action a recovery inspection recommends.
- Scalar
Value - A borrowed logical scalar used by display and small native clients.
- Time
Unit - The logical unit of a
timestamp64column. - Time
Zone - The timezone annotation of a
timestamp64column. - Validation
Level - The amount of an Acta file validation decodes.
- Writer
Codec - The stream codec selected by a
crate::Writer. - Writer
Encoding - The writer-side encoding policy.
- Writer
Statistics - The block-local min/max statistics policy selected by a
crate::Writer. - Writer
Transform - A value transform/layout that a writer can apply without profiling.
Constants§
- DEFAULT_
BYTE_ BLOCK_ TARGET - The default maximum estimated raw frame size buffered into one data block.
- DEFAULT_
ROW_ BLOCK_ TARGET - The default maximum number of logical rows buffered into one data block.
- DEFAULT_
ZSTD_ LEVEL - The default Zstandard compression level used by
WriterOptions. - FILE_
ID_ SIZE - The width of the opaque file ID a v0.2 prologue carries.
Functions§
- inspect_
recovery - Inspect recovery state without opening the file for writing.
- inspect_
recovery_ with_ limits - Inspect recovery state under caller-supplied structural limits.
- repair_
incomplete_ tail - Repair a verified incomplete final data frame.
- repair_
incomplete_ tail_ with_ limits - Repair a verified incomplete final data frame under structural
limits. - validate
- Validate the Acta v0.2 structure of
pathunder the defaultLimits. - validate_
with_ limits - Validate the Acta v0.2 framing of
pathunder caller-suppliedlimits. - validate_
with_ options - Validate an Acta file with an explicit level and resource limits.
Type Aliases§
- Boolean
Array - A nullable boolean array.
- Result
- The result type returned by Acta operations.