Skip to main content

Pebble DB Storage Engine Architecture

Membuss leverages CockroachDB's Pebble DB (core/db/pebble_ds.go, core/store/pebble.go) as its embedded Log-Structured Merge-tree (LSM) storage engine.


1. LSM Namespace Key Layout

Keys in Pebble DB are prefixed to partition namespaces cleanly:

Prefix VariableRaw Key BytesTarget ContentExample Key String
db.PrefixBlockblk/Content block payload / headerblk/<m.Bytes()>
db.PrefixDAGdag/Serialized DAGNode protobufdag/<m.Bytes()>
db.PrefixMetameta/System metadata & timestampsmeta/ts/<m.String()>
db.PrefixSealseal/Root sealing recordsseal/<m.Bytes()>

2. Zero-Copy Slice Allocation

  • m.Bytes(): Returns a direct sub-slice of the underlying multihash byte array without heap allocation.
  • Block.RawData(): Provides zero-copy byte slice getters for internal block exchange pipelines.