mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-11 20:20:05 +00:00
6ec9d7e6e2
* begin indices approach * use shard bucket * continue the indices approach * eliminate the filter checkers in favor of the single loop of root lookups * elim extraneous println statement * continue the indices approach * intersection for multiple filter types works, but is complex, verbose, and nearly unreadable * remove unused code * table drive tests for byte slice intersections * include all table driven tests * gazelle imports * better abstractions * better comments * variadic approach working * transform to variadic * comments * comments * separate bucket for indices for faster range scans * attestation key as hash tree root of data and different indices buckets * test pass * default behavior without filter * appropriate filter criterion errors if criterion does not apply to type * better abstractions and prune keys on deletion * better naming * fix build * fix build * rem extraneous code
26 lines
985 B
Go
26 lines
985 B
Go
package kv
|
|
|
|
// The schema will define how to store and retrieve data from the db.
|
|
// we can prefix or suffix certain values such as `block` with attributes
|
|
// for prefix-wide scans across the underlying BoltDB buckets when filtering data.
|
|
// For example, we might store attestations as shard + attestation_root -> attestation, making
|
|
// it easy to scan for keys that have a certain shard number as a prefix and return those
|
|
// corresponding attestations.
|
|
var (
|
|
attestationsBucket = []byte("attestations")
|
|
attestationIndicesBucket = []byte("attestation-indices")
|
|
blocksBucket = []byte("blocks")
|
|
blockIndicesBucket = []byte("block-indices")
|
|
validatorsBucket = []byte("validators")
|
|
stateBucket = []byte("state")
|
|
|
|
// Key indices.
|
|
shardIdx = []byte("shard")
|
|
parentRootIdx = []byte("parent-root")
|
|
startEpochIdx = []byte("start-epoch")
|
|
endEpochIdx = []byte("end-epoch")
|
|
|
|
// Block keys.
|
|
headBlockRootKey = []byte("head-root")
|
|
)
|