Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is a state database Provider
func (*Provider) QueryExecutorProviderForChannel ¶ added in v0.1.6
func (p *Provider) QueryExecutorProviderForChannel(channelID string) QueryExecutorProvider
QueryExecutorProviderForChannel returns the query executor provider for the given channel
func (*Provider) Register ¶
func (p *Provider) Register(channelID string, db StateDB, qep QueryExecutorProvider)
Register registers a state database for the given channel
func (*Provider) StateDBForChannel ¶
StateDBForChannel returns the state database for the given channel
type QueryExecutorProvider ¶ added in v0.1.6
type QueryExecutorProvider interface {
// NewQueryExecutor returns a query executor that first acquires a commit read lock.
// Done() must be called when finished using it.
NewQueryExecutor() (ledger.QueryExecutor, error)
// NewQueryExecutorNoLock returns a query executor that does not acquire a commit read lock.
// Done() must NOT be called.
NewQueryExecutorNoLock() (ledger.QueryExecutor, error)
}
QueryExecutorProvider provides a query executor with and without a commit lock
type StateDB ¶
type StateDB interface {
// GetState gets the value for given namespace and key. For a chaincode, the namespace corresponds to the chaincodeId
GetState(namespace string, key string) ([]byte, error)
// GetStateMultipleKeys gets the values for multiple keys in a single call
GetStateMultipleKeys(namespace string, keys []string) ([][]byte, error)
// GetStateRangeScanIterator returns an iterator that contains all the key-values between given key ranges.
// startKey is inclusive
// endKey is exclusive
// The returned ResultsIterator contains results of type *VersionedKV
GetStateRangeScanIterator(namespace string, startKey string, endKey string) (statedb.ResultsIterator, error)
// GetStateRangeScanIteratorWithPagination returns an iterator that contains all the key-values between given key ranges.
// startKey is inclusive
// endKey is exclusive
// pageSize parameter limits the number of returned results
// The returned ResultsIterator contains results of type *VersionedKV
GetStateRangeScanIteratorWithPagination(namespace string, startKey string, endKey string, pageSize int32) (statedb.QueryResultsIterator, error)
// ExecuteQuery executes the given query and returns an iterator that contains results of type *VersionedKV.
ExecuteQuery(namespace, query string) (statedb.ResultsIterator, error)
// ExecuteQueryWithPagination executes the given query and
// returns an iterator that contains results of type *VersionedKV.
// The bookmark and page size parameters are associated with the pagination query.
ExecuteQueryWithPagination(namespace, query, bookmark string, pageSize int32) (statedb.QueryResultsIterator, error)
// BytesKeySupported returns true if the implementation (underlying db) supports the any bytes to be used as key.
// For instance, leveldb supports any bytes for the key while the couchdb supports only valid utf-8 string
BytesKeySupported() bool
// UpdateCache updates the state cache with the given updates. The format of the updates depends on the database implementation.
UpdateCache(blockNum uint64, updates []byte) error
}
StateDB declares functions that allow for retrieving and querying from a state database
Click to show internal directories.
Click to hide internal directories.