Documentation ¶
Overview ¶
nolint
Index ¶
- func ErrNotASubTransaction() errors.TMError
- func IsNotASubTransactionErr(err error) bool
- type Bonsai
- func (b *Bonsai) Checkpoint() SimpleDB
- func (b *Bonsai) Commit(sub SimpleDB) error
- func (b *Bonsai) Discard()
- func (b *Bonsai) First(start, end []byte) Model
- func (b *Bonsai) Get(key []byte) []byte
- func (b *Bonsai) GetVersionedWithProof(key []byte, version int64) ([]byte, *iavl.RangeProof, error)
- func (b *Bonsai) GetWithProof(key []byte) ([]byte, *iavl.RangeProof, error)
- func (b *Bonsai) Has(key []byte) bool
- func (b *Bonsai) Last(start, end []byte) Model
- func (b *Bonsai) List(start, end []byte, limit int) []Model
- func (b *Bonsai) Remove(key []byte) (value []byte)
- func (b *Bonsai) Set(key, value []byte)
- func (b *Bonsai) String() string
- type ChainState
- type KVStore
- type MemKVCache
- func (c *MemKVCache) Checkpoint() SimpleDB
- func (c *MemKVCache) Commit(sub SimpleDB) error
- func (c *MemKVCache) Discard()
- func (c *MemKVCache) First(start, end []byte) Model
- func (c *MemKVCache) Get(key []byte) (value []byte)
- func (c *MemKVCache) Has(key []byte) bool
- func (c *MemKVCache) Last(start, end []byte) Model
- func (c *MemKVCache) List(start, end []byte, limit int) []Model
- func (c *MemKVCache) Remove(key []byte) (value []byte)
- func (c *MemKVCache) Set(key []byte, value []byte)
- type MemKVStore
- func (m *MemKVStore) Checkpoint() SimpleDB
- func (m *MemKVStore) Commit(sub SimpleDB) error
- func (m *MemKVStore) Discard()
- func (m *MemKVStore) First(start, end []byte) Model
- func (m *MemKVStore) Get(key []byte) (value []byte)
- func (m *MemKVStore) Has(key []byte) (has bool)
- func (m *MemKVStore) Last(start, end []byte) Model
- func (m *MemKVStore) List(start, end []byte, limit int) []Model
- func (m *MemKVStore) Remove(key []byte) (value []byte)
- func (m *MemKVStore) Set(key []byte, value []byte)
- type Model
- type SimpleDB
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrNotASubTransaction ¶
func IsNotASubTransactionErr ¶
Types ¶
type Bonsai ¶
type Bonsai struct { Tree *iavl.VersionedTree // contains filtered or unexported fields }
Bonsai is a deformed tree forced to fit in a small pot
func NewBonsai ¶
func NewBonsai(tree *iavl.VersionedTree) *Bonsai
NewBonsai wraps a merkle tree and tags it to track children
func (*Bonsai) Checkpoint ¶
func (*Bonsai) GetVersionedWithProof ¶
func (*Bonsai) GetWithProof ¶
type ChainState ¶
type ChainState struct {
// contains filtered or unexported fields
}
ChainState maintains general information for the chain
func (*ChainState) GetChainID ¶
func (s *ChainState) GetChainID(store KVStore) string
GetChainID gets the chain id from the cache or the store
func (*ChainState) SetChainID ¶
func (s *ChainState) SetChainID(store KVStore, chainID string)
SetChainID stores the chain id in the store
type MemKVCache ¶
type MemKVCache struct {
// contains filtered or unexported fields
}
MemKVCache is designed to wrap MemKVStore as a cache
func NewMemKVCache ¶
func NewMemKVCache(store SimpleDB) *MemKVCache
NewMemKVCache wraps a cache around MemKVStore
You probably don't want to use directly, but rather via MemKVCache.Checkpoint()
func (*MemKVCache) Checkpoint ¶
func (c *MemKVCache) Checkpoint() SimpleDB
Checkpoint returns the same state, but where writes are buffered and don't affect the parent
func (*MemKVCache) Commit ¶
func (c *MemKVCache) Commit(sub SimpleDB) error
Commit will take all changes from the checkpoint and write them to the parent. Returns an error if this is not a child of this one
func (*MemKVCache) First ¶
func (c *MemKVCache) First(start, end []byte) Model
First is done with List, but could be much more efficient
func (*MemKVCache) Get ¶
func (c *MemKVCache) Get(key []byte) (value []byte)
Get gets a key, fulfills KVStore interface
func (*MemKVCache) Has ¶
func (c *MemKVCache) Has(key []byte) bool
Has checks existence of a key, fulfills KVStore interface
func (*MemKVCache) Last ¶
func (c *MemKVCache) Last(start, end []byte) Model
Last is done with List, but could be much more efficient
func (*MemKVCache) List ¶
func (c *MemKVCache) List(start, end []byte, limit int) []Model
List is also inefficiently implemented...
func (*MemKVCache) Remove ¶
func (c *MemKVCache) Remove(key []byte) (value []byte)
Remove uses nil value as a flag to delete... not ideal but good enough for testing
func (*MemKVCache) Set ¶
func (c *MemKVCache) Set(key []byte, value []byte)
Set sets a key, fulfills KVStore interface
type MemKVStore ¶
type MemKVStore struct {
// contains filtered or unexported fields
}
MemKVStore is a simple implementation of SimpleDB. It is only intended for quick testing, not to be used in production or with large data stores.
func (*MemKVStore) Checkpoint ¶
func (m *MemKVStore) Checkpoint() SimpleDB
func (*MemKVStore) Commit ¶
func (m *MemKVStore) Commit(sub SimpleDB) error
func (*MemKVStore) Discard ¶
func (m *MemKVStore) Discard()
func (*MemKVStore) First ¶
func (m *MemKVStore) First(start, end []byte) Model
First iterates through all keys to find the one that matches
func (*MemKVStore) Get ¶
func (m *MemKVStore) Get(key []byte) (value []byte)
func (*MemKVStore) Has ¶
func (m *MemKVStore) Has(key []byte) (has bool)
func (*MemKVStore) Last ¶
func (m *MemKVStore) Last(start, end []byte) Model
func (*MemKVStore) Remove ¶
func (m *MemKVStore) Remove(key []byte) (value []byte)
func (*MemKVStore) Set ¶
func (m *MemKVStore) Set(key []byte, value []byte)
type SimpleDB ¶
type SimpleDB interface { KVStore Has(key []byte) (has bool) Remove(key []byte) (value []byte) // returns old value if there was one // Start is inclusive, End is exclusive... // Thus List ([]byte{12, 13}, []byte{12, 14}) will return anything with // the prefix []byte{12, 13} List(start, end []byte, limit int) []Model First(start, end []byte) Model Last(start, end []byte) Model // Checkpoint returns the same state, but where writes // are buffered and don't affect the parent Checkpoint() SimpleDB // Commit will take all changes from the checkpoint and write // them to the parent. // Returns an error if this is not a child of this one Commit(SimpleDB) error // Discard will remove reference to this Discard() }
SimpleDB allows us to do some basic range queries on a db
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents the app states, separating the commited state (for queries) from the working state (for CheckTx and AppendTx)
func NewState ¶
func NewState(tree *iavl.VersionedTree, historySize int64) *State
NewState wraps a versioned tree and maintains all needed states for the abci app
func (State) Append ¶
Append gives us read-write access to the current working state (to be committed at EndBlock)
func (State) Check ¶
Append gives us read-write access to the current scratch state (to be reset at EndBlock)
func (State) Committed ¶
Committed gives us read-only access to the committed state(s), including historical queries
func (State) IsEmpty ¶
IsEmpty is true is no data was ever in the tree (and signals it is unsafe to save)
func (State) LatestHash ¶
LatestHash is the root hash of the last state we have committed
func (State) LatestHeight ¶
LatestHeight is the last block height we have committed