lode

module
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: Apache-2.0

README

Lode

Structured persistence for object storage.

Go Reference Release CI License

Lode is an embeddable Go persistence framework that provides snapshots, metadata, and safe write semantics on object storage, without requiring a database. It offers Datasets for structured collections of named objects and, in an experimental package (lode/volume), Volumes for sparse, resumable storage of byte ranges.


Quick Start

Install
go get github.com/pithecene/lode
Writing and Reading a Blob
package main

import (
    "context"
    "fmt"
    "github.com/pithecene/lode/lode"
)

func main() {
    ctx := context.Background()

    // Create a dataset on filesystem storage.
    ds, _ := lode.NewDataset("mydata", lode.NewFSFactory("/tmp/lode-demo"))

    // Write a blob (by default, raw bytes without a codec).
    snap, _ := ds.Write(ctx, []any{[]byte("hello world")}, lode.Metadata{"source": "demo"})
    fmt.Println("Created snapshot:", snap.ID)

    // Read the blob back.
    data, _ := ds.Read(ctx, snap.ID)
    fmt.Println("Data:", string(data[0].([]byte)))
}
Writing Structured Records
// With a codec, Write accepts structured records.
ds, _ := lode.NewDataset("events",
    lode.NewFSFactory("/tmp/lode-demo"),
    lode.WithCodec(lode.NewJSONLCodec()),
)

records := lode.R(
    lode.D{"id": 1, "event": "signup"},
    lode.D{"id": 2, "event": "login"},
)
snap, _ := ds.Write(ctx, records, lode.Metadata{"batch": "1"})

Lode stores data on the filesystem (NewFSFactory), in memory (NewMemoryFactory), or on S3-compatible storage (lode/s3). The storage location must exist before a dataset is constructed (see Storage Prerequisites). Streaming writes and the experimental Volume API are described in PUBLIC_API.md, and complete programs are listed in examples/.


Core Ideas

Dataset (structured collections):

  • Each write produces a new, immutable snapshot.
  • Each snapshot references a manifest that describes its data files and metadata.
  • Storage, format, compression, and partitioning are independent.

Volume (sparse byte ranges; experimental package lode/volume):

  • A volume is a sparse, resumable byte address space.
  • Commits record which ranges exist; gaps are never filled with zeros.
  • Each commit produces a cumulative manifest.

Both:

  • A snapshot is visible only once its manifest is persisted.
  • Metadata is explicit and persisted, never inferred.
  • Every store detects concurrent writers through CAS.

Guarantees

  • Immutable snapshots: data files and manifests never change once written.
  • Atomic commits: a snapshot is visible only once its manifest exists.
  • Explicit metadata: every snapshot carries metadata supplied by the caller, never inferred.
  • Safe writes: existing objects are never overwritten, and every store detects concurrent writers through CAS.

Lode does not coordinate distributed writers, execute queries, compact data, or remove anything without being asked; the concepts guide gives the details.


Documentation

Topic Where
Storage model, commits, and choosing a write API Concepts guide
Complete API usage, options, and common pitfalls PUBLIC_API.md
Expiring snapshots and reclaiming residual data Retention guide
Snapshot ID format and ordering Snapshot ID guide
Normative behavior docs/contracts/
Runnable programs examples/
Performance docs/BENCHMARKS.md

Status

Lode is at v0.11.0 and under active development. Its APIs are stabilizing; the breaking changes still under consideration for v1.0 are listed in docs/V1_API_DECISIONS.md, and each release is described in CHANGELOG.md.


License

Apache License 2.0 (see LICENSE). Copyright © 2026 Pithecene LLC.

Contact: contact@pithecene.sh. To report a vulnerability, follow SECURITY.md.

Directories

Path Synopsis
examples
blob_upload command
Example: Blob Upload (Raw Bytes)
Example: Blob Upload (Raw Bytes)
default_layout command
Example: Default Layout Round-Trip
Example: Default Layout Round-Trip
hive_layout command
Example: Hive Layout Round-Trip
Example: Hive Layout Round-Trip
manifest_driven command
Example: Manifest-Driven Discovery
Example: Manifest-Driven Discovery
optimistic_concurrency command
Example: CAS Optimistic Concurrency
Example: CAS Optimistic Concurrency
parquet command
Example: Parquet Codec Round-Trip
Example: Parquet Codec Round-Trip
retention command
Example: Retention — expire runs, then sweep
Example: Retention — expire runs, then sweep
s3 command
Example: S3 Storage Adapter
Example: S3 Storage Adapter
stream_write_records command
Example: StreamWriteRecords — Streaming Record Writes
Example: StreamWriteRecords — Streaming Record Writes
vector_artifacts command
Example: Vector Artifact Pipeline
Example: Vector Artifact Pipeline
volume_sparse command
Example: Sparse Volume Ranges
Example: Sparse Volume Ranges
internal
chaos
Package chaos is a randomized stress harness for Lode.
Package chaos is a randomized stress harness for Lode.
history
Package history is the snapshot-history core shared by Lode's containers.
Package history is the snapshot-history core shared by Lode's containers.
retry
Package retry holds the CAS-conflict retry schedule shared by Lode's containers: the configuration the WithRetry* options set, and the jittered exponential backoff a commit loop waits between attempts.
Package retry holds the CAS-conflict retry schedule shared by Lode's containers: the configuration the WithRetry* options set, and the jittered exponential backoff a commit loop waits between attempts.
storepath
Package storepath holds the rules every Store adapter applies to the keys and prefixes it is handed, so the fs, memory and S3 stores agree on what a valid object key is and what a listing prefix means (CONTRACT_STORAGE §Put, §List).
Package storepath holds the rules every Store adapter applies to the keys and prefixes it is handed, so the fs, memory and S3 stores agree on what a valid object key is and what a listing prefix means (CONTRACT_STORAGE §Put, §List).
testutil
Package testutil provides helpers for examples and tests.
Package testutil provides helpers for examples and tests.
validate
Package validate holds the argument and manifest validation errors every Lode package reports.
Package validate holds the argument and manifest validation errors every Lode package reports.
Package lode provides dataset snapshots, manifests, and metadata for object storage systems.
Package lode provides dataset snapshots, manifests, and metadata for object storage systems.
s3
Package s3 provides an S3-compatible storage adapter for Lode.
Package s3 provides an S3-compatible storage adapter for Lode.
volume
Package volume persists a sparse, fixed-length byte address space as immutable, cumulative snapshots.
Package volume persists a sparse, fixed-length byte address space as immutable, cumulative snapshots.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL