privdata

package
v0.0.0-...-fbe82ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCollectionKVSKey

func BuildCollectionKVSKey(ccname string) string

buildCollectionKvsky为给定的链码名称构造集合配置键

func GetCCNameFromCollectionConfigKey

func GetCCNameFromCollectionConfigKey(key string) string

getccnamefromcollectionconfigkey返回给定集合配置键的链码名称

func IsCollectionConfigKey

func IsCollectionConfigKey(key string) bool

iscollectionconfigkey检测密钥是否是集合密钥

func ParseCollectionConfig

func ParseCollectionConfig(colBytes []byte) (*common.CollectionConfigPackage, error)

PARSECURLISTION CONFIG从给定的序列化表示解析集合配置

func RetrieveCollectionConfigPackageFromState

func RetrieveCollectionConfigPackageFromState(cc common.CollectionCriteria, state State) (*common.CollectionConfigPackage, error)

RetrieveCollectionConfigPackageFromState从给定的键从给定的状态检索集合配置包

Types

type Collection

type Collection interface {

	//collection id返回此集合的ID
	CollectionID() string

	//memberOrgs以MSP ID的形式返回集合的成员。这是
	//一种人类可读的快速识别谁是集合的一部分的方法。
	MemberOrgs() []string
}

集合定义集合的公共接口

type CollectionAccessPolicy

type CollectionAccessPolicy interface {
	//accessfilter返回集合的成员筛选器函数
	AccessFilter() Filter

	//将发送到的对等机私有数据的最小数目
	//背书。如果至少传播到
	//没有达到这一数量的同龄人。
	RequiredPeerCount() int

	//将私人数据发送到的对等机的最大数目
	//背书后。此数字必须大于RequiredPeerCount()。
	MaximumPeerCount() int

	//memberOrgs以MSP ID的形式返回集合的成员。这是
	//一种人类可读的快速识别谁是集合的一部分的方法。
	MemberOrgs() []string

	//IsMemberOnlyLead如果只有集合成员可以读取,则返回true
	//私人数据
	IsMemberOnlyRead() bool
}

collection access policy封装集合访问策略的函数

type CollectionFilter

type CollectionFilter interface {
	//AccessFilter检索与给定通道和CollectionPolicyConfig匹配的集合筛选器
	AccessFilter(channelName string, collectionPolicyConfig *common.CollectionPolicyConfig) (Filter, error)
}

type CollectionPersistenceConfigs

type CollectionPersistenceConfigs interface {
	//BlockToLive返回收集数据过期后的块数。
	//例如,如果该值设置为10,则最后由块编号100修改的键
	//将在111号块处清除。零值的处理方式与maxuint64相同。
	BlockToLive() uint64
}

CollectionPersistenceConfigs封装与集合的Persistece相关的配置

type CollectionStore

type CollectionStore interface {
	//getCollection按以下方式检索集合:
	//如果txid存在于分类帐中,则返回的集合具有
	//在此txid之前提交到分类帐的最新配置
	//承诺。
	//Else - it's the latest configuration for the collection.
	RetrieveCollection(common.CollectionCriteria) (Collection, error)

	//getCollectionAccessPolicy检索集合的访问策略
	RetrieveCollectionAccessPolicy(common.CollectionCriteria) (CollectionAccessPolicy, error)

	//RetrieveCollectionConfigPackage检索整个配置包
	//对于具有提供标准的链码
	RetrieveCollectionConfigPackage(common.CollectionCriteria) (*common.CollectionConfigPackage, error)

	//RetrieveCollectionPersistenceConfigs检索集合的与持久性相关的配置
	RetrieveCollectionPersistenceConfigs(common.CollectionCriteria) (CollectionPersistenceConfigs, error)

	//HasReadAccess检查已签名的Proposal的创建者是否对
	//给定集合
	HasReadAccess(common.CollectionCriteria, *pb.SignedProposal, ledger.QueryExecutor) (bool, error)

	CollectionFilter
}

CollectionStore提供各种API来检索存储的集合并执行 基于集合属性的成员资格检查和读取权限检查。 TODO:重构集合存储-FAB-13082 (1)RetrieveCollection()和RetrieveCollectionConfigPackage()等函数是 除非在模拟和测试文件中,否则不得使用。 (2)在八卦中,至少在7个不同的地方,以下3个操作 可以通过引入名为isamberof()的API来避免重复。 (i)通过调用RetrieveCollectionAccessPolicy()检索集合访问策略 (ii)从收集访问策略中获取访问筛选器func (三)制定评估政策,检查会员资格 (3)我们需要在收集存储中有一个缓存,以避免重复的加密操作。 当我们引入isamberof()API时,这很容易实现。

func NewSimpleCollectionStore

func NewSimpleCollectionStore(s Support) CollectionStore

NewSimpleCollectionStore返回存储在备份中的集合 由指定的Ledgergetter提供的分类帐 由提供的 collectionnamer函数

type Filter

type Filter func(common.SignedData) bool

筛选器定义一个规则,根据由其签名的数据筛选对等方。 SignedData中的标识是对等机的序列化实体。 数据是对等签名的消息,签名是对应的 在数据上签名。 如果策略保留给定的签名数据,则返回:true。 否则假

type MembershipProvider

type MembershipProvider struct {
	IdentityDeserializerFactory func(chainID string) msp.IdentityDeserializer
	// contains filtered or unexported fields
}

MembershipProvider可用于检查对等方是否符合集合的条件

func NewMembershipInfoProvider

func NewMembershipInfoProvider(selfSignedData common.SignedData, identityDeserializerFunc func(chainID string) msp.IdentityDeserializer) *MembershipProvider

NewMembershipInfoProvider返回MembershipProvider

func (*MembershipProvider) AmMemberOf

func (m *MembershipProvider) AmMemberOf(channelName string, collectionPolicyConfig *common.CollectionPolicyConfig) (bool, error)

ammemberof检查当前对等方是否为给定集合配置的成员

type NoSuchCollectionError

type NoSuchCollectionError common.CollectionCriteria

func (NoSuchCollectionError) Error

func (f NoSuchCollectionError) Error() string

type SimpleCollection

type SimpleCollection struct {
	// contains filtered or unexported fields
}

SimpleCollection实现具有静态属性的集合 和一个公共成员集

func (*SimpleCollection) AccessFilter

func (sc *SimpleCollection) AccessFilter() Filter

accessfilter返回计算签名数据的成员筛选器函数 根据此集合的成员访问策略

func (*SimpleCollection) CollectionID

func (sc *SimpleCollection) CollectionID() string

collection id返回集合的ID

func (*SimpleCollection) IsMemberOnlyRead

func (sc *SimpleCollection) IsMemberOnlyRead() bool

func (*SimpleCollection) MaximumPeerCount

func (sc *SimpleCollection) MaximumPeerCount() int

func (*SimpleCollection) MemberOrgs

func (sc *SimpleCollection) MemberOrgs() []string

memberOrgs返回属于此集合的MSP ID

func (*SimpleCollection) RequiredPeerCount

func (sc *SimpleCollection) RequiredPeerCount() int

RequiredPeerCount返回最小对等数 需要将私人数据发送到

func (*SimpleCollection) Setup

func (sc *SimpleCollection) Setup(collectionConfig *common.StaticCollectionConfig, deserializer msp.IdentityDeserializer) error

安装程序基于给定的 具有所有必要信息的StaticCollectionConfig协议

type SimpleCollectionPersistenceConfigs

type SimpleCollectionPersistenceConfigs struct {
	// contains filtered or unexported fields
}

func (*SimpleCollectionPersistenceConfigs) BlockToLive

func (s *SimpleCollectionPersistenceConfigs) BlockToLive() uint64

BlockToLive返回集合的块到活动配置

type State

type State interface {
	//GetState retrieves the value for the given key in the given namespace
	GetState(namespace string, key string) ([]byte, error)
}

Stategetter从状态中检索数据

type Support

type Support interface {
	//GetQueryExecutorForLedger返回指定通道的查询执行器
	GetQueryExecutorForLedger(cid string) (ledger.QueryExecutor, error)

	//GetIdentityDeserializer返回IdentityDeserializer
	//指定链的实例
	GetIdentityDeserializer(chainID string) msp.IdentityDeserializer
}

支持是用于注入依赖项的接口

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL