channel

package
v1.0.0-preview Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2017 License: Apache-2.0 Imports: 14 Imported by: 274

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStateInfoMessageStore

func NewStateInfoMessageStore() msgstore.MessageStore

NewStateInfoMessageStore returns a MessageStore

Types

type Adapter

type Adapter interface {
	// GetConf returns the configuration that this GossipChannel will posses
	GetConf() Config

	// Gossip gossips a message in the channel
	Gossip(*proto.GossipMessage)

	// DeMultiplex de-multiplexes an item to subscribers
	DeMultiplex(interface{})

	// GetMembership returns the known alive peers and their information
	GetMembership() []discovery.NetworkMember

	// Send sends a message to a list of peers
	Send(msg *proto.GossipMessage, peers ...*comm.RemotePeer)

	// ValidateStateInfoMessage returns an error if a message
	// hasn't been signed correctly, nil otherwise.
	ValidateStateInfoMessage(*proto.GossipMessage) error

	// OrgByPeerIdentity returns the organization ID of a given peer identity
	OrgByPeerIdentity(identity api.PeerIdentityType) api.OrgIdentityType

	// GetOrgOfPeer returns the organization ID of a given peer PKI-ID
	GetOrgOfPeer(common.PKIidType) api.OrgIdentityType
}

Adapter enables the gossipChannel to communicate with gossipServiceImpl.

type Config

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

Config is a configuration item of the channel store

type GossipChannel

type GossipChannel interface {

	// GetPeers returns a list of peers with metadata as published by them
	GetPeers() []discovery.NetworkMember

	// IsMemberInChan checks whether the given member is eligible to be in the channel
	IsMemberInChan(member discovery.NetworkMember) bool

	// UpdateStateInfo updates this channel's StateInfo message
	// that is periodically published
	UpdateStateInfo(msg *proto.GossipMessage)

	// IsOrgInChannel returns whether the given organization is in the channel
	IsOrgInChannel(membersOrg api.OrgIdentityType) bool

	// IsSubscribed returns whether the given member published
	// its participation in the channel
	IsSubscribed(member discovery.NetworkMember) bool

	// HandleMessage processes a message sent by a remote peer
	HandleMessage(comm.ReceivedMessage)

	// AddToMsgStore adds a given GossipMessage to the message store
	AddToMsgStore(msg *proto.GossipMessage)

	// ConfigureChannel (re)configures the list of organizations
	// that are eligible to be in the channel
	ConfigureChannel(joinMsg api.JoinChannelMessage)

	// Stop stops the channel's activity
	Stop()
}

GossipChannel defines an object that deals with all channel-related messages

func NewGossipChannel

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

NewGossipChannel creates a new GossipChannel

Jump to

Keyboard shortcuts

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