Skip to main content

Crate cobble_data_structure

Crate cobble_data_structure 

Source
Expand description

Structured wrapper crate on top of cobble.

This crate mirrors Cobble’s main usage flows, but with typed structured columns (Bytes / List) and typed decode/encode wrappers.

§1) Single-machine embedded (StructuredSingleDb)

use cobble::{Config, VolumeDescriptor};
use cobble_data_structure::{ListConfig, ListRetainMode, StructuredSingleDb};

let mut config = Config::default();
config.num_columns = 2;
config.total_buckets = 1;
config.volumes = VolumeDescriptor::single_volume("file:///tmp/cobble-ssingle".to_string());

let mut db = StructuredSingleDb::open(config)?;
db.update_schema().add_list_column(
    1,
    ListConfig {
        max_elements: Some(100),
        retain_mode: ListRetainMode::Last,
        preserve_element_ttl: false,
    },
).commit()?;
db.put(0, b"k1", 0, b"v1".to_vec())?;
let snapshot_id = db.snapshot()?;
let snapshots = db.list_snapshots()?;

§2) Distributed write path wrappers

Use StructuredDb on shard writers and keep coordinator/global snapshot flow identical to cobble::Db + cobble::DbCoordinator.

§3) Snapshot-following reading wrappers (StructuredReader)

StructuredReader follows global snapshots like cobble::Reader, but returns typed structured rows.

§4) Distributed scan wrappers

Use StructuredScanPlan / StructuredScanSplit / StructuredScanSplitScanner for snapshot-based distributed scan with structured row decoding.

§5) Fixed snapshot read wrappers

Use StructuredReadOnlyDb for pinned-snapshot reads with structured decoding.

Structs§

ListConfig
StructuredDb
StructuredDbIterator
StructuredReadOnlyDb
StructuredReader
StructuredRemoteCompactionServer
A remote compaction server pre-configured to resolve structured data type merge operators (e.g. list) from request metadata.
StructuredScanPlan
Structured distributed scan plan.
StructuredScanSplit
Structured version of a distributed scan split.
StructuredScanSplitScanner
StructuredSchema
StructuredSchemaBuilder
StructuredSingleDb
StructuredWriteBatch
Structured write batch wrapper.

Enums§

ListRetainMode
StructuredColumnType
StructuredColumnValue

Functions§

structured_merge_operator_resolver
Returns a MergeOperatorResolver that can resolve all structured data type merge operators (e.g. list) from their metadata.
structured_resolvable_operator_ids
Returns the merge operator IDs that structured_merge_operator_resolver can resolve.

Type Aliases§

DataStructureDb
Type alias for backward compatibility.