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
| Type | Item | Encoding |
|---|---|---|
UIntCursor | u64 | RLE + unsigned LEB128 |
IntCursor | i64 | RLE + signed LEB128 |
StrCursor | str | RLE + length-prefixed UTF-8 |
ByteCursor | [u8] | RLE + length-prefixed bytes |
BooleanCursor | bool | Boolean run-length encoding |
DeltaCursor | i64 | Delta-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§
Structs§
- Acc
- A running accumulator — the cumulative sum of per-item
Aggvalues. - Agg
- A per-item aggregate value, used for min/max slab metadata and accumulator steps.
- ColAcc
Iter - An iterator adapter over
ColumnDataIterthat emits theAccvalue after each item. - ColGroup
Item - A single item from a
ColGroupIter, bundling the item with its position and the pre-item accumulator. - ColGroup
Iter - An iterator adapter over
ColumnDataIterthat emitsColGroupItemvalues. - Column
Data - A compressed, mutable column of optional typed values.
- Column
Data Iter - An iterator over items in a
ColumnData, with rich navigation capabilities. - Column
Data Iter State - Serializable snapshot of a
ColumnDataIterposition. - Cursor
Iter - A low-level iterator that decodes
Runs from a raw byte slice using aColumnCursor. - 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
ColumnCursorthat decodes run-length encoded data. - Run
- A single RLE run:
countconsecutive repetitions ofvalue. - RunIter
- Slab
- Slab
Weight - Slab
Writer - Span
Tree - Splice
Del
Enums§
- Pack
Error - Errors returned when decoding or validating column data.
- Read
RawError - Errors returned by
RawReader::read_next. - WriteOp
Traits§
- Column
Cursor - Core trait for cursor types that know how to decode a specific columnar encoding.
- Encoder
State - HasAcc
- Implemented by slab weight / span-weight types that carry a cumulative
Accsum. - HasMin
Max - HasPos
- Implemented by slab weight / span-weight types that carry a cumulative item count.
- Maybe
Packable - Adapter trait that lets both
TandOption<T>(and&T,Option<&T>, etc.) be used as input values when writing to aColumnDataorEncoder. - Packable
- Types that can be encoded into and decoded from the hexane columnar format.
- Span
Weight
Functions§
- lebsize
- The number of bytes required to encode
valas a LEB128 integer - ulebsize
- The number of bytes required to encode
valas a uLEB128 integer
Type Aliases§
- Boolean
Cursor - A
ColumnCursorthat decodes boolean run-length encoded columns. - Byte
Cursor - RLE cursor for byte-slice columns (
[u8]), with a 128-item slab size. - Delta
Cursor - A
ColumnCursorthat 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
ColumnCursorfor uncompressed raw byte columns. - Slab
Tree - StrCursor
- RLE cursor for UTF-8 string columns (
str), with a 128-item slab size. - UInt
Cursor - RLE cursor for unsigned 64-bit integer columns (
u64), with a 64-item slab size.