channel

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMAC

func GenerateMAC(pkiID common.PKIidType, channelID common.ChainID) []byte

generatemac返回从对等机的pki-id派生的字节片 还有一个频道名

Types

type Adapter

type Adapter interface {
	Sign(msg *proto.GossipMessage) (*proto.SignedGossipMessage, error)

	//getconf返回此gossipchannel将拥有的配置
	GetConf() Config

	//流言蜚语在频道里传递信息
	Gossip(message *proto.SignedGossipMessage)

	//转发将消息发送到下一个跃点
	Forward(message proto.ReceivedMessage)

	//多路解复用将项目多路复用到订阅服务器
	DeMultiplex(interface{})

	//getmembership返回已知的活动对等点及其信息
	GetMembership() []discovery.NetworkMember

	//查找返回网络成员,如果未找到,则返回nil
	Lookup(PKIID common.PKIidType) *discovery.NetworkMember

	//发送向对等方列表发送消息
	Send(msg *proto.SignedGossipMessage, peers ...*comm.RemotePeer)

	//如果消息
	//签名不正确,否则为零。
	ValidateStateInfoMessage(message *proto.SignedGossipMessage) error

	//getorgofpeer返回给定对等pki-id的组织ID
	GetOrgOfPeer(pkiID common.PKIidType) api.OrgIdentityType

	//GetIdentityByPkiid返回具有特定
	//pkiid,如果找不到则为nil
	GetIdentityByPKIID(pkiID common.PKIidType) api.PeerIdentityType
}

适配器启用gossipchannel 与gossipserviceimpl通信。

type Config

type Config struct {
	ID                          string
	PublishStateInfoInterval    time.Duration
	MaxBlockCountToStore        int
	PullPeerNum                 int
	PullInterval                time.Duration
	RequestStateInfoInterval    time.Duration
	BlockExpirationInterval     time.Duration
	StateInfoCacheSweepInterval time.Duration
	TimeForMembershipTracker    time.Duration
}

配置是一个配置项 频道商店的

type GossipChannel

type GossipChannel interface {
	//self返回有关对等机的stateInfoMessage
	Self() *proto.SignedGossipMessage

	//getpeers返回由其发布元数据的对等方列表
	GetPeers() []discovery.NetworkMember

	//PeerFilter接收子通道SelectionCriteria并返回一个选择
	//仅匹配给定条件的对等标识
	PeerFilter(api.SubChannelSelectionCriteria) filter.RoutingFilter

	//ismemberinchan检查给定成员是否有资格加入频道
	IsMemberInChan(member discovery.NetworkMember) bool

	//更新LedgerHeight更新Ledger Height the Peer
	//发布到频道中的其他对等端
	UpdateLedgerHeight(height uint64)

	//更新链码更新对等发布的链码
	//到渠道中的其他同行
	UpdateChaincodes(chaincode []*proto.Chaincode)

	//isorginchannel返回给定组织是否在通道中
	IsOrgInChannel(membersOrg api.OrgIdentityType) bool

	//eligibleForChannel返回给定成员是否应获取块
	//对于这个频道
	EligibleForChannel(member discovery.NetworkMember) bool

	//handlemessage处理远程对等机发送的消息
	HandleMessage(proto.ReceivedMessage)

	//addtomsgsstore向消息存储添加给定的gossipmessage
	AddToMsgStore(msg *proto.SignedGossipMessage)

	//configurechannel(re)配置组织列表
	//有资格进入频道的
	ConfigureChannel(joinMsg api.JoinChannelMessage)

	//LeaveChannel使对等方离开通道
	LeaveChannel()

	//停止停止停止频道的活动
	Stop()
}

gossipchannel定义处理所有与通道相关的消息的对象

func NewGossipChannel

func NewGossipChannel(pkiID common.PKIidType, org api.OrgIdentityType, mcs api.MessageCryptoService,
	chainID common.ChainID, adapter Adapter, joinMsg api.JoinChannelMessage) GossipChannel

new gossipchannel创建新的gossipchannel

Jump to

Keyboard shortcuts

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