ethexe-db 2.0.0

Database abstractions and implementations for ethexe
docs.rs failed to build ethexe-db-2.0.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

ethexe-db

Storage abstraction and implementation layer for the ethexe node. Defines the low-level [CASDatabase] and [KVDatabase] backend traits, provides two concrete backends ([RocksDatabase] for persistence and [MemDb] for tests), and composes them into the typed, domain-aware [Database] that every ethexe service reads and writes.

Role in the stack

ethexe-service owns the single [Database] instance and passes it to every subsystem (ethexe-observer, ethexe-compute, ethexe-processor, ethexe-consensus, ethexe-rpc). The storage-role trait definitions live in ethexe-common::db; [Database] implements them here, plus the runtime Storage trait from ethexe-runtime-common.

Public API

  • [CASDatabase] — Content-addressable backend trait (write(&[u8]) -> H256, read, contains)
  • [KVDatabase] — Key-value backend trait (get/put/contains/iter_prefix/take)
  • [Database] — Typed domain database; primary handle held by services
  • [RawDatabase] — Un-typed { kv, cas } pairing used during construction
  • [RocksDatabase] — Persistent backend (RocksDatabase::open(path))
  • [MemDb] — In-memory backend for tests
  • [hash] — Blake2 hash helper; matches the key returned by CASDatabase::write
  • [initialize_db] — Versioned DB bring-up and migration entry point
  • [dump] — State dump for re-genesis
  • [iterator] / [visitor] — Graph traversal over the content-addressed state
  • [verifier] — DB integrity verification backing ethexe check

Versioned initialization and migrations go through [initialize_db], [GenesisInitializer], [InitConfig], and [VERSION]. Under feature = "mock", create_initialized_empty_memory_db constructs a fully-initialized [MemDb]-backed [Database] for integration tests.

Invariants

  • Database::try_from_raw rejects any backend whose stored version does not match [VERSION]; a mismatch is a hard error requiring migration.
  • KVDatabase::take is unsafe: removing a key without re-insertion may cause permanent data loss.
  • Both backends are Send + Sync; concurrent reads and writes from multiple threads are safe.
  • CAS round-trip: write(data) returns hash(data), and read(that_hash) always returns the same bytes.