Skip to main content

Module disk_environment_store

Module disk_environment_store 

Source
Expand description

§Production disk EnvironmentStore

Backing store used by the real server binary. Persists to a fjall keyspace for metadata and a two-level directory tree (256² slots, ≈16 M bundles before any single directory grows past ~64 K entries) for the bundle bodies. Writes go through a temp-file + rename dance so a mid-write crash never leaves a torn bundle, and feedback-update batches are atomic at the fjall level.

Library choice rationale:

  • fjall over redb (redb compacts synchronously and blocks writes during it, which we can’t afford on a single-node server) and over sled (stalled upstream; its v1.0 rewrite hasn’t landed).
  • postcard for metadata serialisation — compact, fast, stable format, no schema on disk.

Feedback entries are stored under composite keys (location_id, post_id, feedback_type) so range iteration can walk all feedback for a given bundle location during decimation in a single sequential scan.

Structs§

DiskEnvironmentFactory
DiskEnvironmentStore
DiskEnvironmentStore implements the EnvironmentStore trait for production use. PostBundles are stored as files in a directory tree, while config, metadata, feedback, and post-expiry metainformation are stored in a key-value database.
PostBundleFeedbackKey
PostBundleFeedbackValue