Documentation
¶
Index ¶
Constants ¶
const NumBytesForHeight = 4
Variables ¶
This section is empty.
Functions ¶
func BucketConsensusStrings ¶
func BucketConsensusStrings() []string
BucketConsensusStrings returns a slice of all String values of the enum
Types ¶
type BucketConsensus ¶
type BucketConsensus byte
The consensus service uses a separate DB with its own buckets
const (
WALEntryBucket BucketConsensus = iota // key: WAL_prefix + Height + MsgIndex. Val: Encoded Tendermint consensus message.
)
Pebble does not support buckets to differentiate between groups of keys like Bolt or MDBX does. We use a global prefix list as a poor man's bucket alternative.
func BucketConsensusString ¶
func BucketConsensusString(s string) (BucketConsensus, error)
BucketConsensusString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func BucketConsensusValues ¶
func BucketConsensusValues() []BucketConsensus
BucketConsensusValues returns all values of the enum
func (BucketConsensus) IsABucketConsensus ¶
func (i BucketConsensus) IsABucketConsensus() bool
IsABucketConsensus returns "true" if the value is listed in the enum definition. "false" otherwise
func (BucketConsensus) Key ¶
func (b BucketConsensus) Key(key ...[]byte) []byte
Key flattens a prefix and series of byte arrays into a single []byte.
func (BucketConsensus) String ¶
func (i BucketConsensus) String() string
type TendermintDB ¶
type TendermintDB[V types.Hashable[H], H types.Hash, A types.Addr] interface { // Flush writes the accumulated batch operations to the underlying database. Flush() error // GetWALEntries retrieves all WAL messages (consensus messages and timeouts) stored for a given height from the database. GetWALEntries(height types.Height) ([]WalEntry[V, H, A], error) // SetWALEntry schedules the storage of a WAL message in the batch. SetWALEntry(entry types.Message[V, H, A]) error // DeleteWALEntries schedules the deletion of all WAL messages for a specific height in the batch. DeleteWALEntries(height types.Height) error }
TendermintDB defines the methods for interacting with the Tendermint WAL database.
The purpose of the WAL is to record any event that may result in a state change. These events fall into the following categories: 1. Incoming messages. We do not need to store outgoing messages. 2. When we propose a value. 3. When a timeout is triggered (not when it is scheduled). The purpose of the WAL is to allow the node to recover the state it was in before the crash. No new messages should be broadcast during replay.
We commit the WAL to disk when: 1. We start a new round 2. Right before we broadcast a message
We call Delete when we start a new height and commit a block
func NewTendermintDB ¶
func NewTendermintDB[V types.Hashable[H], H types.Hash, A types.Addr](db db.KeyValueStore, h types.Height) TendermintDB[V, H, A]
NewTendermintDB creates a new TMDB instance implementing the TMDBInterface.