Documentation ¶
Index ¶
- Variables
- func EncodeBytes(w io.Writer, bz []byte) error
- func FindDbsInPath(path string) ([]string, error)
- func NewIngestSnapshotConnection(snapshotDbPath string) (*sqlite3.Conn, error)
- type Exporter
- type Iterator
- type LeafIterator
- type Logger
- type MultiTree
- func (mt *MultiTree) Close() error
- func (mt *MultiTree) Hash() []byte
- func (mt *MultiTree) LoadVersion(version int64) error
- func (mt *MultiTree) MountTree(storeKey string) error
- func (mt *MultiTree) MountTrees() error
- func (mt *MultiTree) QueryReport(bins int) error
- func (mt *MultiTree) SaveVersion() ([]byte, int64, error)
- func (mt *MultiTree) SaveVersionConcurrently() ([]byte, int64, error)
- func (mt *MultiTree) SnapshotConcurrently() error
- func (mt *MultiTree) WarmLeaves() error
- type Node
- type NodeKey
- type NodePool
- type SnapshotNode
- type SnapshotOptions
- type SqliteDb
- func (sql *SqliteDb) Close() error
- func (sql *SqliteDb) Get(nodeKey NodeKey) (*Node, error)
- func (sql *SqliteDb) GetLatestLeaf(key []byte) ([]byte, error)
- func (sql *SqliteDb) ImportMostRecentSnapshot(targetVersion int64, traverseOrder TraverseOrderType, loadLeaves bool) (*Node, int64, error)
- func (sql *SqliteDb) ImportSnapshotFromTable(version int64, traverseOrder TraverseOrderType, loadLeaves bool) (*Node, error)
- func (sql *SqliteDb) LoadRoot(version int64) (*Node, error)
- func (sql *SqliteDb) Logger() Logger
- func (sql *SqliteDb) ResetShardQueries() error
- func (sql *SqliteDb) Revert(version int) error
- func (sql *SqliteDb) SaveRoot(version int64, node *Node, isCheckpoint bool) error
- func (sql *SqliteDb) Snapshot(ctx context.Context, tree *Tree) error
- func (sql *SqliteDb) WarmLeaves() error
- func (sql *SqliteDb) WriteLatestLeaves(tree *Tree) (err error)
- func (sql *SqliteDb) WriteSnapshot(ctx context.Context, version int64, nextFn func() (*SnapshotNode, error), ...) (*Node, error)
- type SqliteDbOptions
- type SqliteKVStore
- type TraverseOrderType
- type Tree
- func (tree *Tree) Close() error
- func (tree *Tree) DeleteVersionsTo(toVersion int64) error
- func (tree *Tree) Export(order TraverseOrderType) *Exporter
- func (tree *Tree) Get(key []byte) ([]byte, error)
- func (tree *Tree) Has(key []byte) (bool, error)
- func (tree *Tree) Hash() []byte
- func (tree *Tree) Height() int8
- func (tree *Tree) Iterator(start, end []byte, inclusive bool) (itr Iterator, err error)
- func (tree *Tree) LoadSnapshot(version int64, traverseOrder TraverseOrderType) (err error)
- func (tree *Tree) LoadVersion(version int64) (err error)
- func (tree *Tree) NewNode(key []byte, value []byte) *Node
- func (tree *Tree) Remove(key []byte) ([]byte, bool, error)
- func (tree *Tree) ReverseIterator(start, end []byte) (itr Iterator, err error)
- func (tree *Tree) SaveSnapshot() (err error)
- func (tree *Tree) SaveVersion() ([]byte, int64, error)
- func (tree *Tree) Set(key, value []byte) (updated bool, err error)
- func (tree *Tree) SetShouldCheckpoint()
- func (tree *Tree) Size() int64
- func (tree *Tree) Version() int64
- func (tree *Tree) WorkingBytes() uint64
- func (tree *Tree) WriteLatestLeaves() (err error)
- type TreeIterator
- type TreeOptions
- type VersionRange
Constants ¶
This section is empty.
Variables ¶
var ErrorExportDone = errors.New("export done")
Functions ¶
func FindDbsInPath ¶
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
func (*Exporter) Next ¶
func (e *Exporter) Next() (*SnapshotNode, error)
type Iterator ¶
type Iterator interface { // Domain returns the start (inclusive) and end (exclusive) limits of the iterator. // CONTRACT: start, end readonly []byte Domain() (start []byte, end []byte) // Valid returns whether the current iterator is valid. Once invalid, the TreeIterator remains // invalid forever. Valid() bool // Next moves the iterator to the next key in the database, as defined by order of iteration. // If Valid returns false, this method will panic. Next() // Key returns the key at the current position. Panics if the iterator is invalid. // CONTRACT: key readonly []byte Key() (key []byte) // Value returns the value at the current position. Panics if the iterator is invalid. // CONTRACT: value readonly []byte Value() (value []byte) // Error returns the last error encountered by the iterator, if any. Error() error // Close closes the iterator, relasing any allocated resources. Close() error }
type LeafIterator ¶
type LeafIterator struct {
// contains filtered or unexported fields
}
func (*LeafIterator) Close ¶
func (l *LeafIterator) Close() error
func (*LeafIterator) Domain ¶
func (l *LeafIterator) Domain() (start []byte, end []byte)
func (*LeafIterator) Error ¶
func (l *LeafIterator) Error() error
func (*LeafIterator) Key ¶
func (l *LeafIterator) Key() (key []byte)
func (*LeafIterator) Next ¶
func (l *LeafIterator) Next()
func (*LeafIterator) Valid ¶
func (l *LeafIterator) Valid() bool
func (*LeafIterator) Value ¶
func (l *LeafIterator) Value() (value []byte)
type Logger ¶
type Logger interface { // Info takes a message and a set of key/value pairs and logs with level INFO. // The key of the tuple must be a string. Info(msg string, keyVals ...any) // Warn takes a message and a set of key/value pairs and logs with level WARN. // The key of the tuple must be a string. Warn(msg string, keyVals ...any) // Error takes a message and a set of key/value pairs and logs with level ERR. // The key of the tuple must be a string. Error(msg string, keyVals ...any) // Debug takes a message and a set of key/value pairs and logs with level DEBUG. // The key of the tuple must be a string. Debug(msg string, keyVals ...any) }
Logger defines basic logger that IAVL expects. It is a subset of the cosmossdk.io/core/log.Logger interface. cosmossdk.io/log/log.Logger implements this interface.
func NewTestLogger ¶
func NewTestLogger() Logger
type MultiTree ¶
MultiTree encapsulates multiple IAVL trees, each with its own "store key" in the context of the Cosmos SDK. Within IAVL v2 is only used to test the IAVL v2 implementation, and for import/export of IAVL v2 state.
func ImportMultiTree ¶
func NewMultiTree ¶
func NewMultiTree(logger Logger, rootPath string, opts TreeOptions) *MultiTree
func (*MultiTree) Hash ¶
Hash is a stand in for code at https://github.com/cosmos/cosmos-sdk/blob/80dd55f79bba8ab675610019a5764470a3e2fef9/store/types/commit_info.go#L30 it used in testing. App chains should use the store hashing code referenced above instead.
func (*MultiTree) LoadVersion ¶
func (*MultiTree) MountTrees ¶
func (*MultiTree) QueryReport ¶
func (*MultiTree) SaveVersionConcurrently ¶
func (*MultiTree) SnapshotConcurrently ¶
func (*MultiTree) WarmLeaves ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a node in a Tree.
func IngestSnapshot ¶
type NodeKey ¶
type NodeKey [12]byte
NodeKey represents a key of node in the DB.
func NewNodeKey ¶
type NodePool ¶
type NodePool struct {
// contains filtered or unexported fields
}
func NewNodePool ¶
func NewNodePool() *NodePool
type SnapshotOptions ¶
type SnapshotOptions struct { StoreLeafValues bool WriteCheckpoint bool DontWriteSnapshot bool TraverseOrder TraverseOrderType }
type SqliteDb ¶
type SqliteDb struct {
// contains filtered or unexported fields
}
func NewInMemorySqliteDb ¶
func NewSqliteDb ¶
func NewSqliteDb(pool *NodePool, opts SqliteDbOptions) (*SqliteDb, error)
func (*SqliteDb) ImportMostRecentSnapshot ¶
func (*SqliteDb) ImportSnapshotFromTable ¶
func (*SqliteDb) ResetShardQueries ¶
func (*SqliteDb) WarmLeaves ¶
func (*SqliteDb) WriteLatestLeaves ¶
func (*SqliteDb) WriteSnapshot ¶
func (sql *SqliteDb) WriteSnapshot( ctx context.Context, version int64, nextFn func() (*SnapshotNode, error), opts SnapshotOptions, ) (*Node, error)
type SqliteDbOptions ¶
type SqliteDbOptions struct { Path string Mode int MmapSize uint64 WalSize int CacheSize int ConnArgs string ShardTrees bool Logger Logger // contains filtered or unexported fields }
func (SqliteDbOptions) EstimateMmapSize ¶
func (opts SqliteDbOptions) EstimateMmapSize() (uint64, error)
type SqliteKVStore ¶
type SqliteKVStore struct {
// contains filtered or unexported fields
}
SqliteKVStore is a generic KV store which uses sqlite as the backend and be used by applications to store and retrieve generic key-value pairs, probably for metadata.
func NewSqliteKVStore ¶
func NewSqliteKVStore(opts SqliteDbOptions) (kv *SqliteKVStore, err error)
func (*SqliteKVStore) Delete ¶
func (kv *SqliteKVStore) Delete(key []byte) error
type TraverseOrderType ¶
type TraverseOrderType uint8
TraverseOrderType is the type of the order in which the tree is traversed.
const ( PreOrder TraverseOrderType = iota PostOrder )
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
func (*Tree) DeleteVersionsTo ¶
func (*Tree) Export ¶
func (tree *Tree) Export(order TraverseOrderType) *Exporter
func (*Tree) LoadSnapshot ¶
func (tree *Tree) LoadSnapshot(version int64, traverseOrder TraverseOrderType) (err error)
func (*Tree) LoadVersion ¶
func (*Tree) Remove ¶
Remove removes a key from the working tree. The given key byte slice should not be modified after this call, since it may point to data stored inside IAVL.
func (*Tree) ReverseIterator ¶
func (*Tree) SaveSnapshot ¶
func (*Tree) Set ¶
Set sets a key in the working tree. Nil values are invalid. The given key/value byte slices must not be modified after this call, since they point to slices stored within IAVL. It returns true when an existing value was updated, while false means it was a new key.
func (*Tree) SetShouldCheckpoint ¶
func (tree *Tree) SetShouldCheckpoint()
func (*Tree) WorkingBytes ¶
func (*Tree) WriteLatestLeaves ¶
type TreeIterator ¶
type TreeIterator struct {
// contains filtered or unexported fields
}
func (*TreeIterator) Close ¶
func (i *TreeIterator) Close() error
func (*TreeIterator) Domain ¶
func (i *TreeIterator) Domain() (start []byte, end []byte)
func (*TreeIterator) Error ¶
func (i *TreeIterator) Error() error
func (*TreeIterator) Key ¶
func (i *TreeIterator) Key() (key []byte)
func (*TreeIterator) Next ¶
func (i *TreeIterator) Next()
func (*TreeIterator) Valid ¶
func (i *TreeIterator) Valid() bool
func (*TreeIterator) Value ¶
func (i *TreeIterator) Value() (value []byte)
type TreeOptions ¶
type TreeOptions struct { CheckpointInterval int64 CheckpointMemory uint64 StateStorage bool HeightFilter int8 EvictionDepth int8 MetricsProxy metrics.Proxy }
func DefaultTreeOptions ¶
func DefaultTreeOptions() TreeOptions
type VersionRange ¶
type VersionRange struct {
// contains filtered or unexported fields
}
func (*VersionRange) Add ¶
func (r *VersionRange) Add(version int64) error
func (*VersionRange) Find ¶
func (r *VersionRange) Find(version int64) int64
Find returns the shard that contains the given version by binary searching the version range. If the version is after the last shard, -1 is returned.
func (*VersionRange) FindMemoized ¶
func (r *VersionRange) FindMemoized(version int64) int64
func (*VersionRange) FindPrevious ¶
func (r *VersionRange) FindPrevious(version int64) int64
func (*VersionRange) Last ¶
func (r *VersionRange) Last() int64
func (*VersionRange) Len ¶
func (r *VersionRange) Len() int