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) ChaincodeDeployDone(succeeded bool)
- 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) GetPrivateDataMetadataByHash(namespace, collection string, keyHash []byte) ([]byte, 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) GetStateMetadata(namespace, key string) ([]byte, error)
- func (s *CommonStorageDB) GetValueHash(namespace, collection string, keyHash []byte) (*statedb.VersionedValue, error)
- func (s *CommonStorageDB) HandleChaincodeDeploy(chaincodeDefinition *cceventmgmt.ChaincodeDefinition, dbArtifactsTar []byte) 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
- func (h HashedUpdateBatch) Contains(ns, coll string, keyHash []byte) bool
- func (h HashedUpdateBatch) Delete(ns, coll string, key []byte, version *version.Height)
- func (h HashedUpdateBatch) Put(ns, coll string, key []byte, value []byte, version *version.Height)
- func (h HashedUpdateBatch) PutValHashAndMetadata(ns, coll string, key []byte, value []byte, metadata []byte, ...)
- func (h HashedUpdateBatch) ToCompositeKeyMap() map[HashedCompositeKey]*statedb.VersionedValue
- type LevelDBCommonStorageTestEnv
- type PubUpdateBatch
- type PvtKVWrite
- type PvtUpdateBatch
- type PvtdataCompositeKey
- type PvtdataCompositeKeyMap
- type TestEnv
- type UpdateBatch
- type UpdateMap
- func (b UpdateMap) Contains(ns, coll, key string) bool
- func (b UpdateMap) Delete(ns, coll, key string, version *version.Height)
- func (b UpdateMap) Get(ns, coll, key string) *statedb.VersionedValue
- func (b UpdateMap) IsEmpty() bool
- func (b UpdateMap) Put(ns, coll, key string, value []byte, version *version.Height)
- func (b UpdateMap) PutValAndMetadata(ns, coll, key string, value []byte, metadata []byte, version *version.Height)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonStorageDB ¶
type CommonStorageDB struct { statedb.VersionedDB // contains filtered or unexported fields }
CommonStorageDB实现接口DB。此实现使用单个数据库来维护 公共和私人数据
func (*CommonStorageDB) ApplyPrivacyAwareUpdates ¶
func (s *CommonStorageDB) ApplyPrivacyAwareUpdates(updates *UpdateBatch, height *version.Height) error
applyprivacyawareupdates在接口db中实现相应功能
func (*CommonStorageDB) ApplyUpdates ¶
func (s *CommonStorageDB) ApplyUpdates(batch *statedb.UpdateBatch, height *version.Height) error
ApplyUpdates重写statedb.versioneddb中的函数,并引发相应的错误消息 否则,在代码的某个地方,使用此函数可能只会导致更新公共数据。
func (*CommonStorageDB) ChaincodeDeployDone ¶
func (s *CommonStorageDB) ChaincodeDeployDone(succeeded bool)
chaincodedeploydone是couchdb state impl的noop
func (*CommonStorageDB) ClearCachedVersions ¶
func (s *CommonStorageDB) ClearCachedVersions()
ClearCachedVersions在接口数据库中实现相应的功能
func (CommonStorageDB) ExecuteQueryOnPrivateData ¶
func (s CommonStorageDB) ExecuteQueryOnPrivateData(namespace, collection, query string) (statedb.ResultsIterator, error)
ExecuteEqueryOnPrivateData在接口数据库中实现相应功能
func (*CommonStorageDB) GetCachedKeyHashVersion ¶
func (s *CommonStorageDB) GetCachedKeyHashVersion(namespace, collection string, keyHash []byte) (*version.Height, bool)
getcachedKeyHashVersion从缓存中检索keyHash版本
func (*CommonStorageDB) GetChaincodeEventListener ¶
func (s *CommonStorageDB) GetChaincodeEventListener() cceventmgmt.ChaincodeLifecycleEventListener
getchaincodeEventListener在接口db中实现相应功能
func (*CommonStorageDB) GetKeyHashVersion ¶
func (s *CommonStorageDB) GetKeyHashVersion(namespace, collection string, keyHash []byte) (*version.Height, error)
GetKeyHashVersion在接口数据库中实现相应的函数
func (*CommonStorageDB) GetPrivateData ¶
func (s *CommonStorageDB) GetPrivateData(namespace, collection, key string) (*statedb.VersionedValue, error)
getprivatedata在接口db中实现相应的函数
func (*CommonStorageDB) GetPrivateDataMetadataByHash ¶
func (s *CommonStorageDB) GetPrivateDataMetadataByHash(namespace, collection string, keyHash []byte) ([]byte, error)
getprivatedatametadatabyhash在接口db中实现相应的函数。有关更多详细信息,请参阅 类似函数“getStateMetadata”的说明
func (*CommonStorageDB) GetPrivateDataMultipleKeys ¶
func (s *CommonStorageDB) GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([]*statedb.VersionedValue, error)
getprivatedatamultiplekeys在接口db中实现相应的功能
func (*CommonStorageDB) GetPrivateDataRangeScanIterator ¶
func (s *CommonStorageDB) GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (statedb.ResultsIterator, error)
getprivatedatarangescaniterator在接口db中实现相应的函数
func (*CommonStorageDB) GetStateMetadata ¶
func (s *CommonStorageDB) GetStateMetadata(namespace, key string) ([]byte, error)
getStateMetadata在接口db中实现相应的函数。此实现提供 一种优化,以便跟踪命名空间是否从未为任何 其项,返回值“nil”,而不转到db。这是有意调用的 在验证和提交路径中。这样可以避免链式代码支付不必要的性能。 如果他们不使用利用元数据的功能(如关键级别的认可),则将受到惩罚,
func (*CommonStorageDB) GetValueHash ¶
func (s *CommonStorageDB) GetValueHash(namespace, collection string, keyHash []byte) (*statedb.VersionedValue, error)
getValueHash在接口db中实现相应的函数
func (*CommonStorageDB) HandleChaincodeDeploy ¶
func (s *CommonStorageDB) HandleChaincodeDeploy(chaincodeDefinition *cceventmgmt.ChaincodeDefinition, dbArtifactsTar []byte) error
handlechaincodedeploy初始化与命名空间关联的数据库的数据库项目 此函数可以动态地抑制在couchdb上创建索引期间发生的错误。 这是因为,在目前的代码中,由于couchdb交互,我们不区分错误。 以及由于索引文件不好而导致的错误——后者是管理员无法修复的。注意错误抑制 是可接受的,因为对等方可以在没有索引的情况下继续执行提交角色。但是,执行链码查询 可能会受到影响,直到安装并实例化具有固定索引的新链码
func (*CommonStorageDB) IsBulkOptimizable ¶
func (s *CommonStorageDB) IsBulkOptimizable() bool
isBulkOptimizable在接口db中实现相应的功能
func (*CommonStorageDB) LoadCommittedVersionsOfPubAndHashedKeys ¶
func (s *CommonStorageDB) LoadCommittedVersionsOfPubAndHashedKeys(pubKeys []*statedb.CompositeKey, hashedKeys []*HashedCompositeKey) error
LoadCommittedVersionsOfPubandHashedKeys在接口DB中实现了相应的功能
type CommonStorageDBProvider ¶
type CommonStorageDBProvider struct { statedb.VersionedDBProvider HealthCheckRegistry ledger.HealthCheckRegistry // contains filtered or unexported fields }
CommonStorageDBProvider实现接口DBProvider
func (*CommonStorageDBProvider) Close ¶
func (p *CommonStorageDBProvider) Close()
close从接口dbprovider实现函数
func (*CommonStorageDBProvider) GetDBHandle ¶
func (p *CommonStorageDBProvider) GetDBHandle(id string) (DB, error)
GetDBHandle从接口DBProvider实现函数
func (*CommonStorageDBProvider) RegisterHealthChecker ¶
func (p *CommonStorageDBProvider) RegisterHealthChecker() error
type CouchDBCommonStorageTestEnv ¶
type CouchDBCommonStorageTestEnv struct {
// contains filtered or unexported fields
}
couchdbcommonstoragetestenv为基于couchdb的存储实现testenv接口
func (*CouchDBCommonStorageTestEnv) Cleanup ¶
func (env *CouchDBCommonStorageTestEnv) Cleanup()
cleanup从接口testenv实现相应的函数
func (*CouchDBCommonStorageTestEnv) GetDBHandle ¶
func (env *CouchDBCommonStorageTestEnv) GetDBHandle(id string) DB
getdbhandle从接口testenv实现相应的函数
func (*CouchDBCommonStorageTestEnv) GetName ¶
func (env *CouchDBCommonStorageTestEnv) GetName() string
getname从接口testenv实现相应的函数
func (*CouchDBCommonStorageTestEnv) Init ¶
func (env *CouchDBCommonStorageTestEnv) Init(t testing.TB)
init从接口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) GetStateMetadata(namespace, key string) ([]byte, error) GetPrivateDataMetadataByHash(namespace, collection string, keyHash []byte) ([]byte, error) ExecuteQueryOnPrivateData(namespace, collection, query string) (statedb.ResultsIterator, error) ApplyPrivacyAwareUpdates(updates *UpdateBatch, height *version.Height) error }
数据库扩展版本数据库接口。此接口提供用于管理私有数据状态的附加功能
func NewCommonStorageDB ¶
func NewCommonStorageDB(vdb statedb.VersionedDB, ledgerid string, metadataHint *metadataHint) (DB, error)
newcommonstoragedb包装一个versioneddb实例。公共数据由封装的版本数据库直接管理。 为了管理散列数据和私有数据,此实现在包装的数据库中创建单独的命名空间。
type DBProvider ¶
type DBProvider interface { //getdbhandle返回pvtversioneddb的句柄 GetDBHandle(id string) (DB, error) //close关闭所有pvversioneddb实例并释放versioneddbprovider持有的任何资源 Close() }
dbprovider提供pvtversioneddb的句柄
func NewCommonStorageDBProvider ¶
func NewCommonStorageDBProvider(bookkeeperProvider bookkeeping.Provider, metricsProvider metrics.Provider, healthCheckRegistry ledger.HealthCheckRegistry) (DBProvider, error)
newcommonstoragedbprovider构造dbprovider的实例
type HashedCompositeKey ¶
HashedCompositeKey包含命名空间、CollectionName和KeyHash组件
func (*HashedCompositeKey) String ¶
func (hck *HashedCompositeKey) String() string
字符串返回哈希复合键的打印友好形式
type HashedUpdateBatch ¶
type HashedUpdateBatch struct {
UpdateMap
}
hashedupdatebatch包含对私有数据哈希的更新
func NewHashedUpdateBatch ¶
func NewHashedUpdateBatch() *HashedUpdateBatch
NewHashEdupDateBatch创建空的HashEdupDateBatch
func (HashedUpdateBatch) Contains ¶
func (h HashedUpdateBatch) Contains(ns, coll string, keyHash []byte) bool
如果批处理中存在给定的<ns、coll、keyhash>元组,则包含返回true
func (HashedUpdateBatch) Delete ¶
func (h HashedUpdateBatch) Delete(ns, coll string, key []byte, version *version.Height)
delete重写updateMap中的函数,以允许键为[]字节而不是字符串
func (HashedUpdateBatch) PutValHashAndMetadata ¶
func (h HashedUpdateBatch) PutValHashAndMetadata(ns, coll string, key []byte, value []byte, metadata []byte, version *version.Height)
putvalhashandmetadata添加一个带有值和元数据的键 要引入新函数以限制重构。稍后在单独的CR中,应删除上面的“Put”函数
func (HashedUpdateBatch) ToCompositeKeyMap ¶
func (h HashedUpdateBatch) ToCompositeKeyMap() map[HashedCompositeKey]*statedb.VersionedValue
若要组合键映射,请以单个映射的形式重新排列更新批处理数据。
type LevelDBCommonStorageTestEnv ¶
type LevelDBCommonStorageTestEnv struct {
// contains filtered or unexported fields
}
leveldbcommonstoragetestenv为基于leveldb的存储实现testenv接口
func (*LevelDBCommonStorageTestEnv) Cleanup ¶
func (env *LevelDBCommonStorageTestEnv) Cleanup()
cleanup从接口testenv实现相应的函数
func (*LevelDBCommonStorageTestEnv) GetDBHandle ¶
func (env *LevelDBCommonStorageTestEnv) GetDBHandle(id string) DB
getdbhandle从接口testenv实现相应的函数
func (*LevelDBCommonStorageTestEnv) GetName ¶
func (env *LevelDBCommonStorageTestEnv) GetName() string
getname从接口testenv实现相应的函数
func (*LevelDBCommonStorageTestEnv) Init ¶
func (env *LevelDBCommonStorageTestEnv) Init(t testing.TB)
init从接口testenv实现相应的函数
type PubUpdateBatch ¶
type PubUpdateBatch struct {
*statedb.UpdateBatch
}
pubUpdateBatch包含公共数据的更新
func NewPubUpdateBatch ¶
func NewPubUpdateBatch() *PubUpdateBatch
NewPubUpdateBatch创建空的PubUpdateBatch
type PvtKVWrite ¶
pvtkvwrite包含密钥、isDelete、值和版本组件
type PvtUpdateBatch ¶
type PvtUpdateBatch struct {
UpdateMap
}
pvtupdateBatch包含私有数据的更新
func NewPvtUpdateBatch ¶
func NewPvtUpdateBatch() *PvtUpdateBatch
newpvtupdateBatch创建空pvtupdateBatch
func (PvtUpdateBatch) ToCompositeKeyMap ¶
func (p PvtUpdateBatch) ToCompositeKeyMap() PvtdataCompositeKeyMap
若要组合键映射,请以单个映射的形式重新排列更新批处理数据。
type PvtdataCompositeKey ¶
pvtDataCompositeKey包含命名空间、集合名和密钥组件
type PvtdataCompositeKeyMap ¶
type PvtdataCompositeKeyMap map[PvtdataCompositeKey]*statedb.VersionedValue
pvtdatacompositekey map是pvtdatacompositekey到versionedValue的映射
type UpdateBatch ¶
type UpdateBatch struct { PubUpdates *PubUpdateBatch HashUpdates *HashedUpdateBatch PvtUpdates *PvtUpdateBatch }
updateBatch封装对公共、私有和哈希数据的更新。 这将包含一组一致的更新
type UpdateMap ¶
type UpdateMap map[string]nsBatch
updateMap维护tuple<namespace,updatesForNamespace>
func (UpdateMap) Get ¶
func (b UpdateMap) Get(ns, coll, key string) *statedb.VersionedValue
get从批中检索给定命名空间和集合名称组合的值