channel

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMAC

func GenerateMAC(pkiID common.PKIidType, channelID string) common.ChainMac

GenerateMAC returns a byte slice that is derived from the peer's PKI-ID and a channel name

Types

type Adapter

type Adapter interface {
	GetChannelConfig() Config
	Gossip(message *protos.SignedRKSyncMessage)
	Forward(message protos.ReceivedMessage)
	Send(message *protos.SignedRKSyncMessage, peers ...*common.NetworkMember)
	SendWithAck(message *protos.SignedRKSyncMessage, timeout time.Duration, minAck int, peers ...*common.NetworkMember) error
	GetMembership() []common.NetworkMember
	Lookup(pkiID common.PKIidType) *common.NetworkMember
	DeMultiplex(interface{})
	Unregister([]byte)
	Accept(acceptor common.MessageAcceptor, mac []byte, passThrough bool) (<-chan *protos.RKSyncMessage, <-chan protos.ReceivedMessage)
	CreateLeaveChainMessage(chainMac common.ChainMac) (*protos.SignedRKSyncMessage, error)
}

Adapter enables the gossipChannel to communicate with gossipService

type Channel

type Channel interface {
	Self() *protos.ChainState

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

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

	// Initialize allocates the ChainState and should be invoked once per channel per creation
	Initialize(string, []common.PKIidType, []*common.FileSyncInfo) (*protos.ChainState, error)

	// InitializeWithChanState allocates the ChainState message
	InitializeWithChainState(*protos.ChainState) error

	// AddMember adds member to the channel
	AddMember(common.PKIidType) (*protos.ChainState, error)

	// RemoveMember removes member contained in the channel
	RemoveMember(common.PKIidType) (*protos.ChainState, error)

	// AddFile adds files to the channel
	AddFile([]*common.FileSyncInfo) (*protos.ChainState, error)

	// RemoveFile removes file contained in the channel
	RemoveFile([]string) (*protos.ChainState, error)

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

Channel defines an object that deals with all channel-related message

func NewGossipChannel

func NewGossipChannel(pkiID common.PKIidType, chainMac common.ChainMac, chainID string, leader bool, adapter Adapter, idMapper identity.Identity) Channel

NewGossipChannel creates a new gossip Channel

type Config

type Config struct {
	FileSystem                  config.FileSystem
	PublishStateInfoInterval    time.Duration
	PullPeerNum                 int
	PullInterval                time.Duration
	RequestStateInfoInterval    time.Duration
	StateInfoCacheSweepInterval time.Duration
}

Config is a configuration item of the channel

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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