2019-08-12 19:33:07 +00:00
|
|
|
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 (
|
2019-08-16 00:57:43 +00:00
|
|
|
attestationsBucket = []byte("attestations")
|
|
|
|
attestationIndicesBucket = []byte("attestation-indices")
|
|
|
|
blocksBucket = []byte("blocks")
|
|
|
|
blockIndicesBucket = []byte("block-indices")
|
|
|
|
validatorsBucket = []byte("validators")
|
|
|
|
stateBucket = []byte("state")
|
2019-08-13 16:49:27 +00:00
|
|
|
|
2019-08-16 00:57:43 +00:00
|
|
|
// Key indices.
|
|
|
|
shardIdx = []byte("shard")
|
|
|
|
parentRootIdx = []byte("parent-root")
|
|
|
|
startEpochIdx = []byte("start-epoch")
|
|
|
|
endEpochIdx = []byte("end-epoch")
|
|
|
|
|
|
|
|
// Block keys.
|
2019-08-13 16:49:27 +00:00
|
|
|
headBlockRootKey = []byte("head-root")
|
2019-08-12 19:33:07 +00:00
|
|
|
)
|