bptree

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2026 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProofOpBptreeCommitment = "ics23:bptree"
)

Variables

View Source
var FastIndexEnabled bool

FastIndexEnabled controls whether stores built by StoreConstructor enable the bptree fast index — an unauthenticated read accelerator outside the Merkle commitment (see bptree.FastIndexOption). It is a package-level toggle because StoreConstructor's signature is fixed by CommitStoreConstructor and types.StoreOptions is shared with the IAVL store. Set it before stores are mounted (e.g. at process init). Off by default; toggling it does not change the app hash, so nodes may differ without forking.

Functions

func BptreeCommitmentOpDecoder

func BptreeCommitmentOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)

BptreeCommitmentOpDecoder decodes a merkle.ProofOp into a CommitmentOp.

func RegisterProofRuntime

func RegisterProofRuntime(prt *merkle.ProofRuntime)

RegisterProofRuntime registers the B+ tree proof decoder with the given runtime. This should be called during app initialization alongside the existing IAVL and simple merkle decoders.

func StoreConstructor

func StoreConstructor(db dbm.DB, opts types.StoreOptions) types.CommitStore

StoreConstructor implements store.CommitStoreConstructor.

Types

type CommitmentOp

type CommitmentOp struct {
	Key   []byte
	Proof *ics23.CommitmentProof
}

CommitmentOp wraps an ICS23 proof for the B+ tree.

func NewBptreeCommitmentOp

func NewBptreeCommitmentOp(key []byte, proof *ics23.CommitmentProof) CommitmentOp

func (CommitmentOp) GetKey

func (op CommitmentOp) GetKey() []byte

func (CommitmentOp) ProofOp

func (op CommitmentOp) ProofOp() merkle.ProofOp

func (CommitmentOp) Run

func (op CommitmentOp) Run(args [][]byte) ([][]byte, error)

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store implements types.Store and CommitStore backed by a B+ tree.

func UnsafeNewStore

func UnsafeNewStore(tree *bp.MutableTree, opts types.StoreOptions) *Store

func (*Store) CacheWrap

func (st *Store) CacheWrap() types.Store

func (*Store) Commit

func (st *Store) Commit() types.CommitID

func (*Store) Delete

func (st *Store) Delete(gctx *types.GasContext, key []byte)

func (*Store) ExpectedGetReadDepth100

func (st *Store) ExpectedGetReadDepth100() int64

For the B+ tree, GET/SET descents and the COW write path all touch one node per level — all three depths equal the traversal depth.

func (*Store) ExpectedSetReadDepth100

func (st *Store) ExpectedSetReadDepth100() int64

func (*Store) ExpectedWriteDepth100

func (st *Store) ExpectedWriteDepth100() int64

func (*Store) Get

func (st *Store) Get(gctx *types.GasContext, key []byte) (value []byte)

func (*Store) GetImmutable

func (st *Store) GetImmutable(version int64) (*Store, error)

GetImmutable returns a read-only store at a specific version.

func (*Store) GetStoreOptions

func (st *Store) GetStoreOptions() types.StoreOptions

func (*Store) Has

func (st *Store) Has(gctx *types.GasContext, key []byte) (exists bool)

func (*Store) Iterator

func (st *Store) Iterator(gctx *types.GasContext, start, end []byte) types.Iterator

func (*Store) LastCommitID

func (st *Store) LastCommitID() types.CommitID

func (*Store) LoadLatestVersion

func (st *Store) LoadLatestVersion() error

func (*Store) LoadVersion

func (st *Store) LoadVersion(ver int64) error

func (*Store) Query

func (st *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery)

func (*Store) ReverseIterator

func (st *Store) ReverseIterator(gctx *types.GasContext, start, end []byte) types.Iterator

func (*Store) Set

func (st *Store) Set(gctx *types.GasContext, key, value []byte)

func (*Store) SetInitialVersion

func (st *Store) SetInitialVersion(v int64)

SetInitialVersion sets the version the first SaveVersion commits as, to align the multistore's commit version with the chain's InitialHeight when starting a hardfork chain at height > 1. Has no effect on the tree once it has any saved versions; the initialVersion field is set unconditionally for the prune guard. Implements types.InitialVersionSetter.

func (*Store) SetStoreOptions

func (st *Store) SetStoreOptions(opts types.StoreOptions)

func (*Store) VersionExists

func (st *Store) VersionExists(version int64) bool

func (*Store) Write

func (st *Store) Write()

type Tree

type Tree interface {
	Has(key []byte) (bool, error)
	Get(key []byte) ([]byte, error)
	Set(key, value []byte) (bool, error)
	Remove(key []byte) ([]byte, bool, error)
	SaveVersion() ([]byte, int64, error)
	DeleteVersionsTo(version int64) error
	Version() int64
	Size() int64
	Hash() []byte
	GetLatestVersion() (int64, error)
	VersionExists(version int64) bool
	GetVersioned(key []byte, version int64) ([]byte, error)
	GetImmutableTree(version int64) (*bp.ImmutableTree, error)
}

Tree is the interface for both mutable and immutable B+ trees. Mirrors the iavl store's Tree interface but uses bptree types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL