rootmulti

package
v0.0.0-...-21d70e9 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const MemoryCacheCapacity = 12
View Source
const ProofOpMultiStore = "multistore"

the multi-store proof operation constant value

Variables

View Source
var (
	ErrInvalidLengthRootmulti        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRootmulti          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupRootmulti = fmt.Errorf("proto: unexpected end of group")
)

Functions

func DefaultProofRuntime

func DefaultProofRuntime() (prt *merkle.ProofRuntime)

XXX: This should be managed by the rootMultiStore which may want to register more proof ops?

func MultiStoreProofOpDecoder

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

MultiStoreProofOpDecoder returns a multi-store merkle proof operator from a given proof operation.

func RequireProof

func RequireProof(subpath string) bool

RequireProof returns whether proof is required for the subpath.

Types

type CommitID

type CommitID struct {
	Version int64  `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	Hash    []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
}

func (*CommitID) Descriptor

func (*CommitID) Descriptor() ([]byte, []int)

func (*CommitID) GetHash

func (m *CommitID) GetHash() []byte

func (*CommitID) GetVersion

func (m *CommitID) GetVersion() int64

func (*CommitID) Marshal

func (m *CommitID) Marshal() (dAtA []byte, err error)

func (*CommitID) MarshalTo

func (m *CommitID) MarshalTo(dAtA []byte) (int, error)

func (*CommitID) MarshalToSizedBuffer

func (m *CommitID) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CommitID) ProtoMessage

func (*CommitID) ProtoMessage()

func (*CommitID) Reset

func (m *CommitID) Reset()

func (*CommitID) Size

func (m *CommitID) Size() (n int)

func (*CommitID) String

func (m *CommitID) String() string

func (*CommitID) Unmarshal

func (m *CommitID) Unmarshal(dAtA []byte) error

func (*CommitID) XXX_DiscardUnknown

func (m *CommitID) XXX_DiscardUnknown()

func (*CommitID) XXX_Marshal

func (m *CommitID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CommitID) XXX_Merge

func (m *CommitID) XXX_Merge(src proto.Message)

func (*CommitID) XXX_Size

func (m *CommitID) XXX_Size() int

func (*CommitID) XXX_Unmarshal

func (m *CommitID) XXX_Unmarshal(b []byte) error

type CommitInfo

type CommitInfo struct {
	Version    int64       `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	StoreInfos []StoreInfo `protobuf:"bytes,2,rep,name=store_infos,json=storeInfos,proto3" json:"store_infos"`
}

CommitInfo defines commit information used by the multi-store when committing a version/height.

func (*CommitInfo) CommitID

func (ci *CommitInfo) CommitID() types.CommitID

func (*CommitInfo) Descriptor

func (*CommitInfo) Descriptor() ([]byte, []int)

func (*CommitInfo) GetStoreInfos

func (m *CommitInfo) GetStoreInfos() []StoreInfo

func (*CommitInfo) GetVersion

func (m *CommitInfo) GetVersion() int64

func (*CommitInfo) Hash

func (ci *CommitInfo) Hash() []byte

Hash returns the simple merkle root hash of the stores sorted by name.

func (*CommitInfo) Marshal

func (m *CommitInfo) Marshal() (dAtA []byte, err error)

func (*CommitInfo) MarshalTo

func (m *CommitInfo) MarshalTo(dAtA []byte) (int, error)

func (*CommitInfo) MarshalToSizedBuffer

func (m *CommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CommitInfo) ProtoMessage

func (*CommitInfo) ProtoMessage()

func (*CommitInfo) Reset

func (m *CommitInfo) Reset()

func (*CommitInfo) Size

func (m *CommitInfo) Size() (n int)

func (*CommitInfo) String

func (m *CommitInfo) String() string

func (*CommitInfo) Unmarshal

func (m *CommitInfo) Unmarshal(dAtA []byte) error

func (*CommitInfo) XXX_DiscardUnknown

func (m *CommitInfo) XXX_DiscardUnknown()

func (*CommitInfo) XXX_Marshal

func (m *CommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CommitInfo) XXX_Merge

func (m *CommitInfo) XXX_Merge(src proto.Message)

func (*CommitInfo) XXX_Size

func (m *CommitInfo) XXX_Size() int

func (*CommitInfo) XXX_Unmarshal

func (m *CommitInfo) XXX_Unmarshal(b []byte) error

type MultiStoreProof

type MultiStoreProof struct {
	StoreInfos []StoreInfo `protobuf:"bytes,1,rep,name=storeInfos,proto3" json:"storeInfos"`
}

func NewMultiStoreProof

func NewMultiStoreProof(storeInfos []StoreInfo) *MultiStoreProof

MultiStoreProof defines a collection of store proofs in a multi-store

type MultiStoreProof struct {
	StoreInfos []StoreInfo
}

func (*MultiStoreProof) ComputeRootHash

func (proof *MultiStoreProof) ComputeRootHash() []byte

ComputeRootHash returns the root hash for a given multi-store proof.

func (*MultiStoreProof) Descriptor

func (*MultiStoreProof) Descriptor() ([]byte, []int)

func (*MultiStoreProof) GetStoreInfos

func (m *MultiStoreProof) GetStoreInfos() []StoreInfo

func (*MultiStoreProof) Marshal

func (m *MultiStoreProof) Marshal() (dAtA []byte, err error)

func (*MultiStoreProof) MarshalTo

func (m *MultiStoreProof) MarshalTo(dAtA []byte) (int, error)

func (*MultiStoreProof) MarshalToSizedBuffer

func (m *MultiStoreProof) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MultiStoreProof) ProtoMessage

func (*MultiStoreProof) ProtoMessage()

func (*MultiStoreProof) Reset

func (m *MultiStoreProof) Reset()

func (*MultiStoreProof) Size

func (m *MultiStoreProof) Size() (n int)

func (*MultiStoreProof) String

func (m *MultiStoreProof) String() string

func (*MultiStoreProof) Unmarshal

func (m *MultiStoreProof) Unmarshal(dAtA []byte) error

func (*MultiStoreProof) XXX_DiscardUnknown

func (m *MultiStoreProof) XXX_DiscardUnknown()

func (*MultiStoreProof) XXX_Marshal

func (m *MultiStoreProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MultiStoreProof) XXX_Merge

func (m *MultiStoreProof) XXX_Merge(src proto.Message)

func (*MultiStoreProof) XXX_Size

func (m *MultiStoreProof) XXX_Size() int

func (*MultiStoreProof) XXX_Unmarshal

func (m *MultiStoreProof) XXX_Unmarshal(b []byte) error

type MultiStoreProofOp

type MultiStoreProofOp struct {
	Key   []byte           `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Proof *MultiStoreProof `protobuf:"bytes,2,opt,name=proof,proto3" json:"proof"`
}

func NewMultiStoreProofOp

func NewMultiStoreProofOp(key []byte, proof *MultiStoreProof) *MultiStoreProofOp

func (*MultiStoreProofOp) Descriptor

func (*MultiStoreProofOp) Descriptor() ([]byte, []int)

func (*MultiStoreProofOp) GetKey

func (m *MultiStoreProofOp) GetKey() []byte

func (*MultiStoreProofOp) GetProof

func (m *MultiStoreProofOp) GetProof() *MultiStoreProof

func (*MultiStoreProofOp) Marshal

func (m *MultiStoreProofOp) Marshal() (dAtA []byte, err error)

func (*MultiStoreProofOp) MarshalTo

func (m *MultiStoreProofOp) MarshalTo(dAtA []byte) (int, error)

func (*MultiStoreProofOp) MarshalToSizedBuffer

func (m *MultiStoreProofOp) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MultiStoreProofOp) ProofOp

func (op *MultiStoreProofOp) ProofOp() merkle.ProofOp

ProofOp return a merkle proof operation from a given multi-store proof operation.

func (*MultiStoreProofOp) ProtoMessage

func (*MultiStoreProofOp) ProtoMessage()

func (*MultiStoreProofOp) Reset

func (m *MultiStoreProofOp) Reset()

func (MultiStoreProofOp) Run

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

Run executes a multi-store proof operation for a given value. It returns the root hash if the value matches all the store's commitID's hash or an error otherwise.

func (*MultiStoreProofOp) Size

func (m *MultiStoreProofOp) Size() (n int)

func (*MultiStoreProofOp) String

func (m *MultiStoreProofOp) String() string

func (*MultiStoreProofOp) Unmarshal

func (m *MultiStoreProofOp) Unmarshal(dAtA []byte) error

func (*MultiStoreProofOp) XXX_DiscardUnknown

func (m *MultiStoreProofOp) XXX_DiscardUnknown()

func (*MultiStoreProofOp) XXX_Marshal

func (m *MultiStoreProofOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MultiStoreProofOp) XXX_Merge

func (m *MultiStoreProofOp) XXX_Merge(src proto.Message)

func (*MultiStoreProofOp) XXX_Size

func (m *MultiStoreProofOp) XXX_Size() int

func (*MultiStoreProofOp) XXX_Unmarshal

func (m *MultiStoreProofOp) XXX_Unmarshal(b []byte) error

type Store

type Store struct {
	DB    dbm.DB
	Cache types.MultiStoreCache
	// contains filtered or unexported fields
}

Store is composed of many CommitStores. Name contrasts with cacheMultiStore which is for cache-wrapping other MultiStores. It implements the CommitMultiStore interface.

func NewStore

func NewStore(db dbm.DB, cache bool, iavlCacheSize int64) *Store

func (*Store) CacheMultiStore

func (rs *Store) CacheMultiStore() types.CacheMultiStore

Implements MultiStore.

func (*Store) CacheMultiStoreWithVersion

func (rs *Store) CacheMultiStoreWithVersion(version int64) (types.CacheMultiStore, error)

CacheMultiStoreWithVersion is analogous to CacheMultiStore except that it attempts to load stores at a given version (height). An error is returned if any store cannot be loaded. This should only be used for querying and iterating at past heights.

func (*Store) CacheWrap

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

Implements CacheWrapper/Store/CommitStore.

func (*Store) CacheWrapWithTrace

func (rs *Store) CacheWrapWithTrace(_ io.Writer, _ types.TraceContext) types.CacheWrap

CacheWrapWithTrace implements the CacheWrapper interface.

func (*Store) Commit

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

Implements Committer/CommitStore.

func (*Store) CopyStore

func (rs *Store) CopyStore() *types.Store

func (*Store) GetCommitKVStore

func (rs *Store) GetCommitKVStore(key types.StoreKey) types.CommitKVStore

Implements CommitMultiStore.

func (*Store) GetCommitStore

func (rs *Store) GetCommitStore(key types.StoreKey) types.CommitStore

Implements CommitMultiStore.

func (*Store) GetKVStore

func (rs *Store) GetKVStore(key types.StoreKey) types.KVStore

GetKVStore implements the MultiStore interface. If tracing is enabled on the Store, a wrapped TraceKVStore will be returned with the given tracer, otherwise, the original KVStore will be returned. If the store does not exist, panics.

func (*Store) GetStore

func (rs *Store) GetStore(key types.StoreKey) types.Store

Implements MultiStore. If the store does not exist, panics.

func (*Store) GetStoreType

func (rs *Store) GetStoreType() types.StoreType

Implements Store.

func (*Store) LastCommitID

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

Implements Committer/CommitStore.

func (*Store) LoadLatestVersion

func (rs *Store) LoadLatestVersion() error

Implements CommitMultiStore.

func (*Store) LoadLazyVersion

func (rs *Store) LoadLazyVersion(ver int64) (*types.Store, error)

func (*Store) LoadVersion

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

Implements CommitMultiStore.

func (*Store) MountStoreWithDB

func (rs *Store) MountStoreWithDB(key types.StoreKey, typ types.StoreType, db dbm.DB)

Implements CommitMultiStore.

func (*Store) Query

func (rs *Store) Query(req abci.RequestQuery) abci.ResponseQuery

Query calls substore.Query with the same `req` where `req.Path` is modified to remove the substore prefix. Ie. `req.Path` here is `/<substore>/<path>`, and trimmed to `/<path>` for the substore. TODO: add proof for `multistore -> substore`.

func (*Store) RollbackVersion

func (rs *Store) RollbackVersion(height int64) error

Implements CommitMultiStore.

func (*Store) SetLazyLoading

func (rs *Store) SetLazyLoading(lazyLoading bool)

SetLazyLoading sets if the iavl store should be loaded lazily or not

func (*Store) SetPruning

func (rs *Store) SetPruning(pruningOpts types.PruningOptions)

Implements CommitMultiStore

func (*Store) SetTracer

func (rs *Store) SetTracer(w io.Writer) types.MultiStore

SetTracer sets the tracer for the MultiStore that the underlying stores will utilize to trace operations. A MultiStore is returned.

func (*Store) SetTracingContext

func (rs *Store) SetTracingContext(tc types.TraceContext) types.MultiStore

SetTracingContext updates the tracing context for the MultiStore by merging the given context with the existing context by Key. Any existing keys will be overwritten. It is implied that the caller should update the context when necessary between tracing operations. It returns a modified MultiStore.

func (*Store) TracingEnabled

func (rs *Store) TracingEnabled() bool

TracingEnabled returns if tracing is enabled for the MultiStore.

type StoreCore

type StoreCore struct {
	CommitID github_com_pokt_network_pocket_core_store_types.CommitID `protobuf:"bytes,2,opt,name=commitID,proto3,casttype=github.com/pokt-network/pocket-core/store/types.CommitID" json:"commitID"`
}

func (*StoreCore) Descriptor

func (*StoreCore) Descriptor() ([]byte, []int)

func (*StoreCore) Marshal

func (m *StoreCore) Marshal() (dAtA []byte, err error)

func (*StoreCore) MarshalTo

func (m *StoreCore) MarshalTo(dAtA []byte) (int, error)

func (*StoreCore) MarshalToSizedBuffer

func (m *StoreCore) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StoreCore) ProtoMessage

func (*StoreCore) ProtoMessage()

func (*StoreCore) Reset

func (m *StoreCore) Reset()

func (*StoreCore) Size

func (m *StoreCore) Size() (n int)

func (*StoreCore) String

func (m *StoreCore) String() string

func (*StoreCore) Unmarshal

func (m *StoreCore) Unmarshal(dAtA []byte) error

func (*StoreCore) XXX_DiscardUnknown

func (m *StoreCore) XXX_DiscardUnknown()

func (*StoreCore) XXX_Marshal

func (m *StoreCore) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StoreCore) XXX_Merge

func (m *StoreCore) XXX_Merge(src proto.Message)

func (*StoreCore) XXX_Size

func (m *StoreCore) XXX_Size() int

func (*StoreCore) XXX_Unmarshal

func (m *StoreCore) XXX_Unmarshal(b []byte) error

type StoreInfo

type StoreInfo struct {
	Name string    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Core StoreCore `protobuf:"bytes,2,opt,name=core,proto3" json:"core"`
}

StoreInfo defines store-specific commit information. It contains a reference between a store name and the commit ID.

func (*StoreInfo) Descriptor

func (*StoreInfo) Descriptor() ([]byte, []int)

func (*StoreInfo) GetCore

func (m *StoreInfo) GetCore() StoreCore

func (*StoreInfo) GetName

func (m *StoreInfo) GetName() string

func (StoreInfo) Hash

func (si StoreInfo) Hash() []byte

Implements merkle.Hasher.

func (*StoreInfo) Marshal

func (m *StoreInfo) Marshal() (dAtA []byte, err error)

func (*StoreInfo) MarshalTo

func (m *StoreInfo) MarshalTo(dAtA []byte) (int, error)

func (*StoreInfo) MarshalToSizedBuffer

func (m *StoreInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StoreInfo) ProtoMessage

func (*StoreInfo) ProtoMessage()

func (*StoreInfo) Reset

func (m *StoreInfo) Reset()

func (*StoreInfo) Size

func (m *StoreInfo) Size() (n int)

func (*StoreInfo) String

func (m *StoreInfo) String() string

func (*StoreInfo) Unmarshal

func (m *StoreInfo) Unmarshal(dAtA []byte) error

func (*StoreInfo) XXX_DiscardUnknown

func (m *StoreInfo) XXX_DiscardUnknown()

func (*StoreInfo) XXX_Marshal

func (m *StoreInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StoreInfo) XXX_Merge

func (m *StoreInfo) XXX_Merge(src proto.Message)

func (*StoreInfo) XXX_Size

func (m *StoreInfo) XXX_Size() int

func (*StoreInfo) XXX_Unmarshal

func (m *StoreInfo) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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