Documentation ¶
Index ¶
- type CommonStorageDB
- func (s *CommonStorageDB) ApplyPrivacyAwareUpdates(updates *UpdateBatch, height *version.Height) error
- func (s *CommonStorageDB) ApplyUpdates(batch *statedb.UpdateBatch, height *version.Height) error
- func (s *CommonStorageDB) ClearCachedVersions()
- func (s CommonStorageDB) ExecuteQueryOnPrivateData(namespace, collection, query string) (statedb.ResultsIterator, error)
- func (s *CommonStorageDB) GetCachedKeyHashVersion(namespace, collection string, keyHash []byte) (*version.Height, bool)
- func (s *CommonStorageDB) GetChaincodeEventListener() cceventmgmt.ChaincodeLifecycleEventListener
- func (s *CommonStorageDB) GetKeyHashVersion(namespace, collection string, keyHash []byte) (*version.Height, error)
- func (s *CommonStorageDB) GetPrivateData(namespace, collection, key string) (*statedb.VersionedValue, error)
- func (s *CommonStorageDB) GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([]*statedb.VersionedValue, error)
- func (s *CommonStorageDB) GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (statedb.ResultsIterator, error)
- func (s *CommonStorageDB) GetValueHash(namespace, collection string, keyHash []byte) (*statedb.VersionedValue, error)
- func (s *CommonStorageDB) IsBulkOptimizable() bool
- func (s *CommonStorageDB) LoadCommittedVersionsOfPubAndHashedKeys(pubKeys []*statedb.CompositeKey, hashedKeys []*HashedCompositeKey) error
- type CommonStorageDBProvider
- type CouchDBCommonStorageTestEnv
- type DB
- type DBProvider
- type HashedCompositeKey
- type HashedUpdateBatch
- type LevelDBCommonStorageTestEnv
- type PubUpdateBatch
- type PvtUpdateBatch
- type TestEnv
- type UpdateBatch
- type UpdateMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonStorageDB ¶ added in v1.1.0
type CommonStorageDB struct {
statedb.VersionedDB
}
CommonStorageDB implements interface DB. This implementation uses a single database to maintain both the public and private data
func (*CommonStorageDB) ApplyPrivacyAwareUpdates ¶ added in v1.1.0
func (s *CommonStorageDB) ApplyPrivacyAwareUpdates(updates *UpdateBatch, height *version.Height) error
ApplyPrivacyAwareUpdates implements corresponding function in interface DB
func (*CommonStorageDB) ApplyUpdates ¶ added in v1.1.0
func (s *CommonStorageDB) ApplyUpdates(batch *statedb.UpdateBatch, height *version.Height) error
ApplyUpdates overrides the funciton in statedb.VersionedDB and throws appropriate error message Otherwise, somewhere in the code, usage of this function could lead to updating only public data.
func (*CommonStorageDB) ClearCachedVersions ¶ added in v1.1.0
func (s *CommonStorageDB) ClearCachedVersions()
ClearCachedVersions implements corresponding function in interface DB
func (CommonStorageDB) ExecuteQueryOnPrivateData ¶ added in v1.1.0
func (s CommonStorageDB) ExecuteQueryOnPrivateData(namespace, collection, query string) (statedb.ResultsIterator, error)
ExecuteQueryOnPrivateData implements corresponding function in interface DB
func (*CommonStorageDB) GetCachedKeyHashVersion ¶ added in v1.1.0
func (s *CommonStorageDB) GetCachedKeyHashVersion(namespace, collection string, keyHash []byte) (*version.Height, bool)
GetCachedKeyHashVersion retrieves the keyhash version from cache
func (*CommonStorageDB) GetChaincodeEventListener ¶ added in v1.1.0
func (s *CommonStorageDB) GetChaincodeEventListener() cceventmgmt.ChaincodeLifecycleEventListener
GetChaincodeEventListener implements corresponding function in interface DB
func (*CommonStorageDB) GetKeyHashVersion ¶ added in v1.1.0
func (s *CommonStorageDB) GetKeyHashVersion(namespace, collection string, keyHash []byte) (*version.Height, error)
GetKeyHashVersion implements corresponding function in interface DB
func (*CommonStorageDB) GetPrivateData ¶ added in v1.1.0
func (s *CommonStorageDB) GetPrivateData(namespace, collection, key string) (*statedb.VersionedValue, error)
GetPrivateData implements corresponding function in interface DB
func (*CommonStorageDB) GetPrivateDataMultipleKeys ¶ added in v1.1.0
func (s *CommonStorageDB) GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([]*statedb.VersionedValue, error)
GetPrivateDataMultipleKeys implements corresponding function in interface DB
func (*CommonStorageDB) GetPrivateDataRangeScanIterator ¶ added in v1.1.0
func (s *CommonStorageDB) GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (statedb.ResultsIterator, error)
GetPrivateDataRangeScanIterator implements corresponding function in interface DB
func (*CommonStorageDB) GetValueHash ¶ added in v1.1.0
func (s *CommonStorageDB) GetValueHash(namespace, collection string, keyHash []byte) (*statedb.VersionedValue, error)
GetValueHash implements corresponding function in interface DB
func (*CommonStorageDB) IsBulkOptimizable ¶ added in v1.1.0
func (s *CommonStorageDB) IsBulkOptimizable() bool
IsBulkOptimizable implements corresponding function in interface DB
func (*CommonStorageDB) LoadCommittedVersionsOfPubAndHashedKeys ¶ added in v1.1.0
func (s *CommonStorageDB) LoadCommittedVersionsOfPubAndHashedKeys(pubKeys []*statedb.CompositeKey, hashedKeys []*HashedCompositeKey) error
LoadCommittedVersionsOfPubAndHashedKeys implements corresponding function in interface DB
type CommonStorageDBProvider ¶ added in v1.1.0
type CommonStorageDBProvider struct {
statedb.VersionedDBProvider
}
CommonStorageDBProvider implements interface DBProvider
func (*CommonStorageDBProvider) Close ¶ added in v1.1.0
func (p *CommonStorageDBProvider) Close()
Close implements function from interface DBProvider
func (*CommonStorageDBProvider) GetDBHandle ¶ added in v1.1.0
func (p *CommonStorageDBProvider) GetDBHandle(id string) (DB, error)
GetDBHandle implements function from interface DBProvider
type CouchDBCommonStorageTestEnv ¶ added in v1.1.0
type CouchDBCommonStorageTestEnv struct {
// contains filtered or unexported fields
}
CouchDBCommonStorageTestEnv implements TestEnv interface for couchdb based storage
func (*CouchDBCommonStorageTestEnv) Cleanup ¶ added in v1.1.0
func (env *CouchDBCommonStorageTestEnv) Cleanup()
Cleanup implements corresponding function from interface TestEnv
func (*CouchDBCommonStorageTestEnv) GetDBHandle ¶ added in v1.1.0
func (env *CouchDBCommonStorageTestEnv) GetDBHandle(id string) DB
GetDBHandle implements corresponding function from interface TestEnv
func (*CouchDBCommonStorageTestEnv) GetName ¶ added in v1.1.0
func (env *CouchDBCommonStorageTestEnv) GetName() string
GetName implements corresponding function from interface TestEnv
func (*CouchDBCommonStorageTestEnv) Init ¶ added in v1.1.0
func (env *CouchDBCommonStorageTestEnv) Init(t testing.TB)
Init implements corresponding function from interface TestEnv
type DB ¶
type DB interface { statedb.VersionedDB IsBulkOptimizable() bool LoadCommittedVersionsOfPubAndHashedKeys(pubKeys []*statedb.CompositeKey, hashedKeys []*HashedCompositeKey) error GetCachedKeyHashVersion(namespace, collection string, keyHash []byte) (*version.Height, bool) ClearCachedVersions() GetChaincodeEventListener() cceventmgmt.ChaincodeLifecycleEventListener GetPrivateData(namespace, collection, key string) (*statedb.VersionedValue, error) GetValueHash(namespace, collection string, keyHash []byte) (*statedb.VersionedValue, error) GetKeyHashVersion(namespace, collection string, keyHash []byte) (*version.Height, error) GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([]*statedb.VersionedValue, error) GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (statedb.ResultsIterator, error) ExecuteQueryOnPrivateData(namespace, collection, query string) (statedb.ResultsIterator, error) ApplyPrivacyAwareUpdates(updates *UpdateBatch, height *version.Height) error }
DB extends VersionedDB interface. This interface provides additional functions for managing private data state
func NewCommonStorageDB ¶ added in v1.1.0
func NewCommonStorageDB(vdb statedb.VersionedDB, ledgerid string) (DB, error)
NewCommonStorageDB wraps a VersionedDB instance. The public data is managed directly by the wrapped versionedDB. For managing the hashed data and private data, this implementation creates separate namespaces in the wrapped db
type DBProvider ¶
type DBProvider interface { // GetDBHandle returns a handle to a PvtVersionedDB GetDBHandle(id string) (DB, error) // Close closes all the PvtVersionedDB instances and releases any resources held by VersionedDBProvider Close() }
DBProvider provides handle to a PvtVersionedDB
func NewCommonStorageDBProvider ¶ added in v1.1.0
func NewCommonStorageDBProvider() (DBProvider, error)
NewCommonStorageDBProvider constructs an instance of DBProvider
type HashedCompositeKey ¶
HashedCompositeKey encloses Namespace, CollectionName and KeyHash components
type HashedUpdateBatch ¶
type HashedUpdateBatch struct {
UpdateMap
}
HashedUpdateBatch contains updates for the hashes of the private data
func NewHashedUpdateBatch ¶
func NewHashedUpdateBatch() *HashedUpdateBatch
NewHashedUpdateBatch creates an empty HashedUpdateBatch
func (HashedUpdateBatch) Contains ¶
func (h HashedUpdateBatch) Contains(ns, coll string, keyHash []byte) bool
Contains returns true if the given <ns,coll,keyHash> tuple is present in the batch
type LevelDBCommonStorageTestEnv ¶ added in v1.1.0
type LevelDBCommonStorageTestEnv struct {
// contains filtered or unexported fields
}
LevelDBCommonStorageTestEnv implements TestEnv interface for leveldb based storage
func (*LevelDBCommonStorageTestEnv) Cleanup ¶ added in v1.1.0
func (env *LevelDBCommonStorageTestEnv) Cleanup()
Cleanup implements corresponding function from interface TestEnv
func (*LevelDBCommonStorageTestEnv) GetDBHandle ¶ added in v1.1.0
func (env *LevelDBCommonStorageTestEnv) GetDBHandle(id string) DB
GetDBHandle implements corresponding function from interface TestEnv
func (*LevelDBCommonStorageTestEnv) GetName ¶ added in v1.1.0
func (env *LevelDBCommonStorageTestEnv) GetName() string
GetName implements corresponding function from interface TestEnv
func (*LevelDBCommonStorageTestEnv) Init ¶ added in v1.1.0
func (env *LevelDBCommonStorageTestEnv) Init(t testing.TB)
Init implements corresponding function from interface TestEnv
type PubUpdateBatch ¶
type PubUpdateBatch struct {
*statedb.UpdateBatch
}
PubUpdateBatch contains update for the public data
func NewPubUpdateBatch ¶
func NewPubUpdateBatch() *PubUpdateBatch
NewPubUpdateBatch creates an empty PubUpdateBatch
type PvtUpdateBatch ¶
type PvtUpdateBatch struct {
UpdateMap
}
PvtUpdateBatch contains updates for the private data
func NewPvtUpdateBatch ¶
func NewPvtUpdateBatch() *PvtUpdateBatch
NewPvtUpdateBatch creates an empty PvtUpdateBatch
type UpdateBatch ¶
type UpdateBatch struct { PubUpdates *PubUpdateBatch HashUpdates *HashedUpdateBatch PvtUpdates *PvtUpdateBatch }
UpdateBatch encapsulates the updates to Public, Private, and Hashed data. This is expected to contain a consistent set of updates
func NewUpdateBatch ¶
func NewUpdateBatch() *UpdateBatch
NewUpdateBatch creates and empty UpdateBatch
type UpdateMap ¶
type UpdateMap map[string]nsBatch
UpdateMap maintains entries of tuple <Namespace, UpdatesForNamespace>
func (UpdateMap) Delete ¶
Delete removes the entry from the batch for a given combination of namespace and collection name
func (UpdateMap) Get ¶
func (b UpdateMap) Get(ns, coll, key string) *statedb.VersionedValue
Get retrieves the value from the batch for a given combination of namespace and collection name