Skip to main content

dr-store

Generic append-only content-addressed object store for the dr-* stack.

dr-store owns three things and nothing else:

  1. Immutable put — an absent typed (schema, content_hash) key atomically accepts a verified complete canonical record value; replay of the same canonical value is idempotent success; different content at the same key is a typed conflict and never overwrites the stored value.
  2. Verified get — every read recomputes and verifies the Content Hash and schema declared by the ObjectReference; missing, schema-mismatched, or corrupted content fails with a typed error.
  3. Atomic key-to-reference binding — one generic compare-and-set that binds an opaque caller-owned key to an ObjectReference: an unbound key binds; the same reference replays idempotently; a different reference conflicts and never overwrites the winner. No overwrite path is exposed.

The Content Hash is the full 64-character lowercase SHA-256 digest of the complete canonical persisted record, canonicalized through dr-serialize's canonical JSON. dr-store does not invent a second canonicalization dialect, and a Content Hash is not an Identity Hash.

The vocabulary sheet (source: .defs/vocab.html) is the authoritative statement of the contracts this repo implements — the append-only content-addressed object store and the Document Directory: the terms, the guarantees, what is in and out of scope, and the mapping from each term to the exported names.

Document Directory

The Document Directory stores what a single immutable record cannot: one allocated directory with exactly one writer, one atomically-replaced canonical-JSON Manifest, and zero or more streamed binary Sidecars.

from dr_store import DocumentDirectory

directory = DocumentDirectory.allocate(
    root, prefix="run", manifest_name="record.json"
)
directory.publish(manifest)                    # atomic durable replace
writer = directory.open_sidecar("stdout.bin", head_cap=..., tail_cap=...)
writer.write(chunk)
summary = writer.finalize()                    # -> SidecarSummary
directory.publish(final_manifest)              # summaries embedded by caller
  • Atomic durable publish — each publish() writes the complete canonical JSON to a temp file in the same directory, flushes it (F_FULLFSYNC where available, os.fsync otherwise), renames it onto the manifest name, and flushes the directory entry. After abrupt process death a reader sees either no Manifest or one complete previously published Manifest — never a partial one. The claim is scoped to local macOS filesystems; network mounts and cloud-synchronized directories are outside it.
  • Writer-owned truncationhead_cap bytes fill first and a ring buffer keeps the last tail_cap bytes of the remainder, stored as head segment then tail segment in one file. No caps is unbounded; an unset tail_cap is head-only, so the tail buffer is bounded by tail_cap and never by the stream. The SidecarSummary reports the stored segment lengths alongside produced and dropped byte counts, plus the Sidecar Digest: the full 64-character lowercase SHA-256 of the stored bytes. A Sidecar Digest is not a Content Hash — its input is raw bytes, not a canonical record.
  • Verified read-backread_manifest() accepts only strict canonical JSON; verify_sidecar() checks stored bytes against the digest and total segment length the caller extracted from its own Manifest. Every fault is a typed error under DocumentDirectoryError.

The component is domain-neutral in the same way the Object Store is, and narrower still: it knows no lifecycle state, never reads a field out of a Manifest payload, never computes a retention policy, and never owns threads or child processes. Concurrent allocation under one root is collision-free; each allocated directory has one writer by construction, not by locking. The vocabulary sheet's Document Directory section states its terms and guarantees.

Ecosystem

dr-store depends only on dr-serialize for canonical JSON and strict finite-JSON validation. It carries no Whetstone, Rollout, workflow, retry, or campaign vocabulary; the public contract is domain-neutral.

Backends

  • in-memory (MemoryBackend) — for tests and single-process use.
  • sqlite (SqliteBackend) — durable and safe under concurrent cross-process use via serialized transactions.

Both satisfy the same backend-neutral contract, exercised by a shared concurrency test proving parallel binds of one unbound key produce exactly one winner.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dr_store-0.1.1.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dr_store-0.1.1-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file dr_store-0.1.1.tar.gz.

File metadata

  • Download URL: dr_store-0.1.1.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dr_store-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d981dabc3abb1f9f3ec1d19a6b62e933c1737f03d9d9ee69f64c068120aef58
MD5 61fa88d299b3b89ad3016126dec68661
BLAKE2b-256 797f52fc654cd893d0204a057086cd2081ee4843c58b6184428c38e7947a1b83

See more details on using hashes here.

Provenance

The following attestation bundles were made for dr_store-0.1.1.tar.gz:

Publisher: release.yml on danielle-rothermel/dr-store

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dr_store-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dr_store-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dr_store-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2ee06652861ea0584772c6954d4e0ad9ad6899351af8818920f4ae54d3c3f605
MD5 95e4255d2dcaadbea73a310aad101b06
BLAKE2b-256 d38f2e08e64cbc37c704d9a26befd172066bf5cbe766bbacf12f0050eaa0bcdd

See more details on using hashes here.

Provenance

The following attestation bundles were made for dr_store-0.1.1-py3-none-any.whl:

Publisher: release.yml on danielle-rothermel/dr-store

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page