subsystem-summary-of-bucket
Installation
SKILL.md
Bucket Subsystem Technical Summary
Overview
The bucket subsystem implements a log-structured merge tree (LSM-tree) data structure called the BucketList. It maintains a canonical, hash-verifiable representation of all ledger state. There are two BucketList instances: the LiveBucketList (current ledger state) and the HotArchiveBucketList (recently evicted entries). Each is organized into 11 temporal levels (level 0 being youngest/smallest, level 10 being oldest/largest), where older levels are exponentially larger and change less frequently.
The system is designed to:
- Provide a single canonical hash of all ledger entries without rehashing the entire database on each ledger close.
- Enable efficient "catch-up" via incremental bucket downloads from history archives.
- Support point and bulk lookups of ledger entries via indexed bucket files (BucketListDB).
Key Classes and Data Structures
Bucket Types (CRTP Hierarchy)
BucketBase<BucketT, IndexT>— Abstract CRTP base for immutable, sorted, hashed containers of XDR entries. Holds a filename, hash, size, and optional index (shared_ptr<IndexT>). Provides the coremerge()andmergeInternal()static methods. Buckets are designed to be held inshared_ptrand shared across threads.