Skip to main content

Crate hexane

Crate hexane 

Source
Expand description

Hexane is a columnar compression library implementing the encoding described in the Automerge Binary Format.

Data is stored in ColumnData<C> where the cursor type C selects the encoding (RLE<T>, delta, boolean, or raw). Values are batched into Slabs — Arc-wrapped byte buffers — held in a SpanTree B-tree for O(log n) positional seek, insert, and splice.

§Cursor Types

TypeItemEncoding
UIntCursoru64RLE + unsigned LEB128
IntCursori64RLE + signed LEB128
StrCursorstrRLE + length-prefixed UTF-8
ByteCursor[u8]RLE + length-prefixed bytes
BooleanCursorboolBoolean run-length encoding
DeltaCursori64Delta-encoded integers
RawCursor[u8]Uncompressed raw bytes

§Quick Example

use hexane::{ColumnData, UIntCursor};

let mut col: ColumnData<UIntCursor> = ColumnData::new();
col.splice(0, 0, [1u64, 2, 3, 4, 5]);
assert_eq!(col.to_vec(), vec![Some(1), Some(2), Some(3), Some(4), Some(5)]);

let bytes = col.save();
let col2: ColumnData<UIntCursor> = ColumnData::load(&bytes).unwrap();
assert_eq!(col.to_vec(), col2.to_vec());

See the README for comprehensive usage documentation.

Modules§

tree

Structs§

Acc
A running accumulator — the cumulative sum of per-item Agg values.
Agg
A per-item aggregate value, used for min/max slab metadata and accumulator steps.
ColAccIter
An iterator adapter over ColumnDataIter that emits the Acc value after each item.
ColGroupItem
A single item from a ColGroupIter, bundling the item with its position and the pre-item accumulator.
ColGroupIter
An iterator adapter over ColumnDataIter that emits ColGroupItem values.
ColumnData
A compressed, mutable column of optional typed values.
ColumnDataIter
An iterator over items in a ColumnData, with rich navigation capabilities.
ColumnDataIterState
Serializable snapshot of a ColumnDataIter position.
CursorIter
A low-level iterator that decodes Runs from a raw byte slice using a ColumnCursor.
Encoder
A streaming encoder that accumulates values and writes them into a compressed slab.
RawReader
A low-level reader for sequential byte access across a multi-slab tree.
RleCursor
A ColumnCursor that decodes run-length encoded data.
Run
A single RLE run: count consecutive repetitions of value.
RunIter
Slab
SlabWeight
SlabWriter
SpanTree
SpliceDel

Enums§

PackError
Errors returned when decoding or validating column data.
ReadRawError
Errors returned by RawReader::read_next.
WriteOp

Traits§

ColumnCursor
Core trait for cursor types that know how to decode a specific columnar encoding.
EncoderState
HasAcc
Implemented by slab weight / span-weight types that carry a cumulative Acc sum.
HasMinMax
HasPos
Implemented by slab weight / span-weight types that carry a cumulative item count.
MaybePackable
Adapter trait that lets both T and Option<T> (and &T, Option<&T>, etc.) be used as input values when writing to a ColumnData or Encoder.
Packable
Types that can be encoded into and decoded from the hexane columnar format.
SpanWeight

Functions§

lebsize
The number of bytes required to encode val as a LEB128 integer
ulebsize
The number of bytes required to encode val as a uLEB128 integer

Type Aliases§

BooleanCursor
A ColumnCursor that decodes boolean run-length encoded columns.
ByteCursor
RLE cursor for byte-slice columns ([u8]), with a 128-item slab size.
DeltaCursor
A ColumnCursor that decodes delta-encoded signed 64-bit integer columns.
IntCursor
RLE cursor for signed 64-bit integer columns (i64), with a 64-item slab size.
RawCursor
A ColumnCursor for uncompressed raw byte columns.
SlabTree
StrCursor
RLE cursor for UTF-8 string columns (str), with a 128-item slab size.
UIntCursor
RLE cursor for unsigned 64-bit integer columns (u64), with a 64-item slab size.