cachemulti

package
v0.0.0-...-2a91c6f Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store holds many branched stores. Implements MultiStore. NOTE: a Store (and MultiStores in general) should never expose the keys for the substores.

func NewFromKVStore

func NewFromKVStore(
	store types.KVStore, stores map[types.StoreKey]types.CacheWrapper,
	keys map[string]types.StoreKey, traceWriter io.Writer, traceContext types.TraceContext,
) Store

NewFromKVStore creates a new Store object from a mapping of store keys to CacheWrapper objects and a KVStore as the database. Each CacheWrapper store is a branched store.

func NewStore

func NewStore(
	db dbm.DB, stores map[types.StoreKey]types.CacheWrapper, keys map[string]types.StoreKey,
	traceWriter io.Writer, traceContext types.TraceContext,
) Store

NewStore creates a new Store object from a mapping of store keys to CacheWrapper objects. Each CacheWrapper store is a branched store.

func (Store) CacheMultiStore

func (cms Store) CacheMultiStore() types.CacheMultiStore

Implements MultiStore.

func (Store) CacheMultiStoreWithVersion

func (cms Store) CacheMultiStoreWithVersion(_ int64) (types.CacheMultiStore, error)

CacheMultiStoreWithVersion implements the MultiStore interface. It will panic as an already cached multi-store cannot load previous versions.

TODO: The store implementation can possibly be modified to support this as it seems safe to load previous versions (heights).

func (Store) CacheWrap

func (cms Store) CacheWrap() types.CacheWrap

Implements CacheWrapper.

func (Store) CacheWrapWithTrace

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

CacheWrapWithTrace implements the CacheWrapper interface.

func (Store) GetKVStore

func (cms Store) GetKVStore(key types.StoreKey) types.KVStore

GetKVStore returns an underlying KVStore by key.

func (Store) GetStore

func (cms Store) GetStore(key types.StoreKey) types.Store

GetStore returns an underlying Store by key.

func (Store) GetStoreType

func (cms Store) GetStoreType() types.StoreType

GetStoreType returns the type of the store.

func (Store) SetTracer

func (cms 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 (cms 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 (cms Store) TracingEnabled() bool

TracingEnabled returns if tracing is enabled for the MultiStore.

func (Store) Write

func (cms Store) Write()

Write calls Write on each underlying store.

Jump to

Keyboard shortcuts

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