Documentation ¶
Index ¶
- func ApplyQueryWrapper(queryString string, queryLimit, querySkip int) (string, error)
- func CleanupDB(dbName string)
- type BatchableDocument
- type CommittedVersions
- type TestVDBEnv
- type VersionedDB
- func (vdb *VersionedDB) ApplyUpdates(batch *statedb.UpdateBatch, height *version.Height) error
- func (vdb *VersionedDB) BytesKeySuppoted() bool
- func (vdb *VersionedDB) ClearCachedVersions()
- func (vdb *VersionedDB) Close()
- func (vdb *VersionedDB) ExecuteQuery(namespace, query string) (statedb.ResultsIterator, error)
- func (vdb *VersionedDB) GetCachedVersion(namespace string, key string) (*version.Height, bool)
- func (vdb *VersionedDB) GetLatestSavePoint() (*version.Height, error)
- func (vdb *VersionedDB) GetState(namespace string, key string) (*statedb.VersionedValue, error)
- func (vdb *VersionedDB) GetStateMultipleKeys(namespace string, keys []string) ([]*statedb.VersionedValue, error)
- func (vdb *VersionedDB) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (statedb.ResultsIterator, error)
- func (vdb *VersionedDB) GetVersion(namespace string, key string) (*version.Height, error)
- func (vdb *VersionedDB) HandleChaincodeDeploy(chaincodeDefinition *cceventmgmt.ChaincodeDefinition, dbArtifactsTar []byte) error
- func (vdb *VersionedDB) LoadCommittedVersions(keys []*statedb.CompositeKey) error
- func (vdb *VersionedDB) Open() error
- func (vdb *VersionedDB) ValidateKey(key string) error
- type VersionedDBProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyQueryWrapper ¶
ApplyQueryWrapper parses the query string passed to CouchDB the wrapper prepends the wrapper "data." to all fields specified in the query All fields in the selector must have "data." prepended to the field names Fields listed in fields key will have "data." prepended Fields in the sort key will have "data." prepended
- limit be added to the query and is based on config - skip is defaulted to 0 and is currently not used, this is for future paging implementation
In the example a contextID of "marble" is assumed.
Example:
Source Query: {"selector":{"owner": {"$eq": "tom"}}, "fields": ["owner", "asset_name", "color", "size"], "sort": ["size", "color"]}
Result Wrapped Query: {"selector":{"data.owner":{"$eq":"tom"}}, "fields": ["data.owner","data.asset_name","data.color","data.size","_id","version"], "sort":["data.size","data.color"],"limit":10,"skip":0}
Types ¶
type BatchableDocument ¶
BatchableDocument defines a document for a batch
type CommittedVersions ¶
type CommittedVersions struct {
// contains filtered or unexported fields
}
CommittedVersions contains maps of committedVersions and revisionNumbers. Used as a local cache during bulk processing of a block. committedVersions - used for state validation of readsets revisionNumbers - used during commit phase for couchdb bulk updates
type TestVDBEnv ¶
type TestVDBEnv struct { DBProvider statedb.VersionedDBProvider // contains filtered or unexported fields }
TestVDBEnv provides a couch db backed versioned db for testing
func NewTestVDBEnv ¶
func NewTestVDBEnv(t testing.TB) *TestVDBEnv
NewTestVDBEnv instantiates and new couch db backed TestVDB
func (*TestVDBEnv) Cleanup ¶
func (env *TestVDBEnv) Cleanup(dbName string)
Cleanup drops the test couch databases and closes the db provider
type VersionedDB ¶
type VersionedDB struct {
// contains filtered or unexported fields
}
VersionedDB implements VersionedDB interface
func (*VersionedDB) ApplyUpdates ¶
func (vdb *VersionedDB) ApplyUpdates(batch *statedb.UpdateBatch, height *version.Height) error
ApplyUpdates implements method in VersionedDB interface
func (*VersionedDB) BytesKeySuppoted ¶
func (vdb *VersionedDB) BytesKeySuppoted() bool
BytesKeySuppoted implements method in VersionedDB interface
func (*VersionedDB) ClearCachedVersions ¶
func (vdb *VersionedDB) ClearCachedVersions()
ClearCachedVersions clears committedVersions and revisionNumbers
func (*VersionedDB) Close ¶
func (vdb *VersionedDB) Close()
Close implements method in VersionedDB interface
func (*VersionedDB) ExecuteQuery ¶
func (vdb *VersionedDB) ExecuteQuery(namespace, query string) (statedb.ResultsIterator, error)
ExecuteQuery implements method in VersionedDB interface
func (*VersionedDB) GetCachedVersion ¶
GetCachedVersion implements method in VersionedDB interface
func (*VersionedDB) GetLatestSavePoint ¶
func (vdb *VersionedDB) GetLatestSavePoint() (*version.Height, error)
GetLatestSavePoint implements method in VersionedDB interface
func (*VersionedDB) GetState ¶
func (vdb *VersionedDB) GetState(namespace string, key string) (*statedb.VersionedValue, error)
GetState implements method in VersionedDB interface
func (*VersionedDB) GetStateMultipleKeys ¶
func (vdb *VersionedDB) GetStateMultipleKeys(namespace string, keys []string) ([]*statedb.VersionedValue, error)
GetStateMultipleKeys implements method in VersionedDB interface
func (*VersionedDB) GetStateRangeScanIterator ¶
func (vdb *VersionedDB) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (statedb.ResultsIterator, error)
GetStateRangeScanIterator implements method in VersionedDB interface startKey is inclusive endKey is exclusive
func (*VersionedDB) GetVersion ¶
GetVersion implements method in VersionedDB interface
func (*VersionedDB) HandleChaincodeDeploy ¶
func (vdb *VersionedDB) HandleChaincodeDeploy(chaincodeDefinition *cceventmgmt.ChaincodeDefinition, dbArtifactsTar []byte) error
HandleChaincodeDeploy initializes database artifacts for the database associated with the namespace
func (*VersionedDB) LoadCommittedVersions ¶
func (vdb *VersionedDB) LoadCommittedVersions(keys []*statedb.CompositeKey) error
LoadCommittedVersions populates committedVersions and revisionNumbers into cache. A bulk retrieve from couchdb is used to populate the cache. committedVersions cache will be used for state validation of readsets revisionNumbers cache will be used during commit phase for couchdb bulk updates
func (*VersionedDB) Open ¶
func (vdb *VersionedDB) Open() error
Open implements method in VersionedDB interface
func (*VersionedDB) ValidateKey ¶
func (vdb *VersionedDB) ValidateKey(key string) error
ValidateKey implements method in VersionedDB interface
type VersionedDBProvider ¶
type VersionedDBProvider struct {
// contains filtered or unexported fields
}
VersionedDBProvider implements interface VersionedDBProvider
func NewVersionedDBProvider ¶
func NewVersionedDBProvider() (*VersionedDBProvider, error)
NewVersionedDBProvider instantiates VersionedDBProvider
func (*VersionedDBProvider) Close ¶
func (provider *VersionedDBProvider) Close()
Close closes the underlying db instance
func (*VersionedDBProvider) GetDBHandle ¶
func (provider *VersionedDBProvider) GetDBHandle(dbName string) (statedb.VersionedDB, error)
GetDBHandle gets the handle to a named database