Documentation ¶
Overview ¶
Package badgerdb contains ledger store implementation on top of BadgerDB engine.
Index ¶
- type HashIterator
- type Store
- func (s *Store) Close() error
- func (s *Store) Get(key []byte) ([]byte, error)
- func (s *Store) GetClassIndex(ref *record.Reference) (*index.ClassLifeline, error)
- func (s *Store) GetCurrentPulse() record.PulseNum
- func (s *Store) GetDrop(pulse record.PulseNum) (*jetdrop.JetDrop, error)
- func (s *Store) GetEntropy(pulse record.PulseNum) ([]byte, error)
- func (s *Store) GetObjectIndex(ref *record.Reference) (*index.ObjectLifeline, error)
- func (s *Store) GetRecord(ref *record.Reference) (record.Record, error)
- func (s *Store) GetSlotHashes(n record.PulseNum) ([][]byte, error)
- func (s *Store) ProcessSlotHashes(n record.PulseNum, ifn func(it HashIterator) error) error
- func (s *Store) Set(key, value []byte) error
- func (s *Store) SetClassIndex(ref *record.Reference, idx *index.ClassLifeline) error
- func (s *Store) SetCurrentPulse(pulse record.PulseNum)
- func (s *Store) SetDrop(pulse record.PulseNum, prevdrop *jetdrop.JetDrop) (*jetdrop.JetDrop, error)
- func (s *Store) SetEntropy(pulse record.PulseNum, entropy []byte) error
- func (s *Store) SetObjectIndex(ref *record.Reference, idx *index.ObjectLifeline) error
- func (s *Store) SetRecord(rec record.Record) (*record.Reference, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashIterator ¶
type HashIterator interface { // Next moves the iterator to the next key/value pair. // It returns false then iterator is exhausted. Next() bool // Hash returns record's hash copy. That allows use returned value // on any iteration step or outside of iteration function. Hash() []byte // ShallowHash returns unsafe record's hash, that could be used only // in current iteration step. It could be useful for processing hashes // on the fly to avoid unnecessary copy and memory allocations. ShallowHash() []byte }
HashIterator iterates over a database record's hashes. An iterator provides methods for record's hash access.
HashIterator supposed to be used only in functions like ProcessSlotHashes. Any release of iterator resources not needed.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store represents BadgerDB storage implementation.
func NewStore ¶
NewStore returns badgerdb.Store with BadgerDB instance initialized by opts. Creates database in provided dir or in current directory if dir parameter is empty.
func (*Store) Close ¶
Close wraps BadgerDB Close method.
From https://godoc.org/github.com/dgraph-io/badger#DB.Close: «It's crucial to call it to ensure all the pending updates make their way to disk. Calling DB.Close() multiple times is not safe and wouldcause panic.»
func (*Store) GetClassIndex ¶
GetClassIndex fetches class lifeline's index.
func (*Store) GetCurrentPulse ¶
GetCurrentPulse returns current pulse number.
func (*Store) GetEntropy ¶
GetEntropy returns entropy from storage for given pulse.
Entropy is used for calculating node roles.
func (*Store) GetObjectIndex ¶
GetObjectIndex fetches object lifeline index.
func (*Store) GetRecord ¶
GetRecord returns record from BadgerDB by *record.Reference.
It returns storage.ErrNotFound if the DB does not contain the key.
func (*Store) GetSlotHashes ¶
GetSlotHashes returns array of all record's hashes in provided PulseNum.
func (*Store) ProcessSlotHashes ¶
ProcessSlotHashes executes a iteration function ifn and provides HashIterator inside it to iterate over all records hashes with the same record.PulseNum.
Error returned by the ProcessSlotRecords is based on iteration function result or BadgerDB iterator error if any.
func (*Store) SetClassIndex ¶
SetClassIndex stores class lifeline index.
func (*Store) SetCurrentPulse ¶
SetCurrentPulse sets current pulse number.
func (*Store) SetDrop ¶
SetDrop stores jet drop for given pulse number. Previous JetDrop should be provided. On success returns saved drop hash.
func (*Store) SetEntropy ¶
SetEntropy stores given entropy for given pulse in storage.
Entropy is used for calculating node roles.
func (*Store) SetObjectIndex ¶
SetObjectIndex stores object lifeline index.
Directories ¶
Path | Synopsis |
---|---|
Package badgertestutils provides sharable utils for testing BadgerDB store implementation.
|
Package badgertestutils provides sharable utils for testing BadgerDB store implementation. |