Documentation ¶
Index ¶
- Constants
- func Run(t *testing.T, storeCreator func() VersionStore)
- func SetupTestDB(t *testing.T, store VersionStore)
- type MultiStore
- func (s *MultiStore) CacheMultiStore() sdk.CacheMultiStore
- func (s *MultiStore) CacheMultiStoreWithVersion(version int64) (sdk.CacheMultiStore, error)
- func (s *MultiStore) CacheWrap() types.CacheWrap
- func (s *MultiStore) CacheWrapWithTrace(_ io.Writer, _ types.TraceContext) types.CacheWrap
- func (s *MultiStore) GetKVStore(storeKey types.StoreKey) sdk.KVStore
- func (s *MultiStore) GetStore(storeKey types.StoreKey) sdk.Store
- func (s *MultiStore) GetStoreType() types.StoreType
- func (s *MultiStore) LatestVersion() int64
- func (s *MultiStore) MountMemoryStores(keys map[string]*types.MemoryStoreKey)
- func (s *MultiStore) MountTransientStores(keys map[string]*types.TransientStoreKey)
- func (s *MultiStore) SetTracer(w io.Writer) types.MultiStore
- func (s *MultiStore) SetTracingContext(tc types.TraceContext) types.MultiStore
- func (s *MultiStore) TracingEnabled() bool
- type Store
- func (st *Store) CacheWrap() types.CacheWrap
- func (st *Store) CacheWrapWithListeners(storeKey types.StoreKey, listeners []types.WriteListener) types.CacheWrap
- func (st *Store) CacheWrapWithTrace(w io.Writer, tc types.TraceContext) types.CacheWrap
- func (st *Store) Delete(key []byte)
- func (st *Store) Get(key []byte) []byte
- func (st *Store) GetStoreType() types.StoreType
- func (st *Store) Has(key []byte) (exists bool)
- func (st *Store) Iterator(start, end []byte) types.Iterator
- func (st *Store) ReverseIterator(start, end []byte) types.Iterator
- func (st *Store) Set(key, value []byte)
- type StreamingService
- func (fss *StreamingService) Close() error
- func (fss *StreamingService) ListenBeginBlock(ctx context.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock) error
- func (fss *StreamingService) ListenCommit(ctx context.Context, res abci.ResponseCommit) error
- func (fss *StreamingService) ListenDeliverTx(ctx context.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx) error
- func (fss *StreamingService) ListenEndBlock(ctx context.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock) error
- func (fss *StreamingService) Listeners() map[types.StoreKey][]types.WriteListener
- func (fss *StreamingService) Stream(wg *sync.WaitGroup) error
- type VersionStore
Constants ¶
const StoreTypeVersionDB = 100
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(t *testing.T, storeCreator func() VersionStore)
func SetupTestDB ¶
func SetupTestDB(t *testing.T, store VersionStore)
Types ¶
type MultiStore ¶
type MultiStore struct {
// contains filtered or unexported fields
}
MultiStore wraps `VersionStore` to implement `MultiStore` interface.
func NewMultiStore ¶
func NewMultiStore(versionDB VersionStore, storeKeys []types.StoreKey) *MultiStore
NewMultiStore returns a new versiondb `MultiStore`.
func (*MultiStore) CacheMultiStore ¶
func (s *MultiStore) CacheMultiStore() sdk.CacheMultiStore
CacheMultiStore implements `MultiStore` interface
func (*MultiStore) CacheMultiStoreWithVersion ¶
func (s *MultiStore) CacheMultiStoreWithVersion(version int64) (sdk.CacheMultiStore, error)
CacheMultiStoreWithVersion implements `MultiStore` interface
func (*MultiStore) CacheWrap ¶
func (s *MultiStore) CacheWrap() types.CacheWrap
CacheWrap implements CacheWrapper/MultiStore/CommitStore.
func (*MultiStore) CacheWrapWithTrace ¶
func (s *MultiStore) CacheWrapWithTrace(_ io.Writer, _ types.TraceContext) types.CacheWrap
CacheWrapWithTrace implements the CacheWrapper interface.
func (*MultiStore) GetKVStore ¶
func (s *MultiStore) GetKVStore(storeKey types.StoreKey) sdk.KVStore
GetKVStore implements `MultiStore` interface
func (*MultiStore) GetStore ¶
func (s *MultiStore) GetStore(storeKey types.StoreKey) sdk.Store
GetStore implements `MultiStore` interface
func (*MultiStore) GetStoreType ¶
func (s *MultiStore) GetStoreType() types.StoreType
GetStoreType implements `MultiStore` interface.
func (*MultiStore) LatestVersion ¶
func (s *MultiStore) LatestVersion() int64
LatestVersion returns the latest version saved in versiondb
func (*MultiStore) MountMemoryStores ¶
func (s *MultiStore) MountMemoryStores(keys map[string]*types.MemoryStoreKey)
MountMemoryStores simlates the same behavior as sdk to support grpc query service.
func (*MultiStore) MountTransientStores ¶
func (s *MultiStore) MountTransientStores(keys map[string]*types.TransientStoreKey)
MountTransientStores simlates the same behavior as sdk to support grpc query service.
func (*MultiStore) SetTracer ¶
func (s *MultiStore) 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 (*MultiStore) SetTracingContext ¶
func (s *MultiStore) 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 (*MultiStore) TracingEnabled ¶
func (s *MultiStore) TracingEnabled() bool
TracingEnabled returns if tracing is enabled for the MultiStore.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store Implements types.KVStore
func NewKVStore ¶
func NewKVStore(store VersionStore, storeKey types.StoreKey, version *int64) *Store
func (*Store) CacheWrapWithListeners ¶
func (st *Store) CacheWrapWithListeners(storeKey types.StoreKey, listeners []types.WriteListener) types.CacheWrap
CacheWrapWithListeners implements the CacheWrapper interface.
func (*Store) CacheWrapWithTrace ¶
CacheWrapWithTrace implements the Store interface.
func (*Store) ReverseIterator ¶
Implements types.KVStore.
type StreamingService ¶
type StreamingService struct {
// contains filtered or unexported fields
}
StreamingService is a concrete implementation of StreamingService that accumulate the state changes in current block, writes the ordered changeset out to version storage.
func NewStreamingService ¶
func NewStreamingService(versionStore VersionStore, storeKeys []types.StoreKey) *StreamingService
NewStreamingService creates a new StreamingService for the provided writeDir, (optional) filePrefix, and storeKeys
func (*StreamingService) Close ¶
func (fss *StreamingService) Close() error
Close satisfies the io.Closer interface, which satisfies the baseapp.StreamingService interface
func (*StreamingService) ListenBeginBlock ¶
func (fss *StreamingService) ListenBeginBlock(ctx context.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock) error
ListenBeginBlock satisfies the baseapp.ABCIListener interface It sets the currentBlockNumber.
func (*StreamingService) ListenCommit ¶
func (fss *StreamingService) ListenCommit(ctx context.Context, res abci.ResponseCommit) error
func (*StreamingService) ListenDeliverTx ¶
func (fss *StreamingService) ListenDeliverTx(ctx context.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx) error
ListenDeliverTx satisfies the baseapp.ABCIListener interface
func (*StreamingService) ListenEndBlock ¶
func (fss *StreamingService) ListenEndBlock(ctx context.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock) error
ListenEndBlock satisfies the baseapp.ABCIListener interface It merge the state caches of all the listeners together, and write out to the versionStore.
func (*StreamingService) Listeners ¶
func (fss *StreamingService) Listeners() map[types.StoreKey][]types.WriteListener
Listeners satisfies the baseapp.StreamingService interface
type VersionStore ¶
type VersionStore interface { GetAtVersion(storeKey string, key []byte, version *int64) ([]byte, error) HasAtVersion(storeKey string, key []byte, version *int64) (bool, error) IteratorAtVersion(storeKey string, start, end []byte, version *int64) (types.Iterator, error) ReverseIteratorAtVersion(storeKey string, start, end []byte, version *int64) (types.Iterator, error) GetLatestVersion() (int64, error) // Persist the change set of a block, // the `changeSet` should be ordered by (storeKey, key), // the version should be latest version plus one. PutAtVersion(version int64, changeSet []types.StoreKVPair) error }
VersionStore is a versioned storage of a flat key-value pairs. it don't need to support merkle proof, so could be implemented in a much more efficient way. `nil` version means the latest version.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package extsort implements external sorting algorithm, it has several differnet design choices compared with alternatives like https://github.com/lanrat/extsort:
|
Package extsort implements external sorting algorithm, it has several differnet design choices compared with alternatives like https://github.com/lanrat/extsort: |