peermgr

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerManager

type PeerManager interface {
	// Start
	Start() error

	// Stop
	Stop() error

	// AsyncSend sends message to peer with peer info.
	AsyncSend(uint64, *pb.Message) error

	// SendWithStream sends message using existed stream
	SendWithStream(network.Stream, *pb.Message) error

	// Send sends message waiting response
	Send(uint64, *pb.Message) (*pb.Message, error)

	// Broadcast message to all node
	Broadcast(*pb.Message) error

	// CountConnectedPeers counts connected peer numbers
	CountConnectedPeers() uint64

	// Peers
	Peers() map[uint64]*pb.VpInfo

	// OtherPeers
	OtherPeers() map[uint64]*peer.AddrInfo

	// SubscribeOrderMessage
	SubscribeOrderMessage(ch chan<- events.OrderMessageEvent) event.Subscription

	// AddNode adds a vp peer.
	AddNode(newNodeID uint64, vpInfo *pb.VpInfo)

	// DelNode deletes a vp peer.
	DelNode(delID uint64)

	// UpdateRouter update the local router to quorum router.
	UpdateRouter(vpInfos map[uint64]*pb.VpInfo, isNew bool) bool

	// Disconnect disconnect with all vp peers.
	Disconnect(vpInfos map[uint64]*pb.VpInfo)

	// PierManager
	PierManager() PierManager

	// ReConfig
	ReConfig(config *repo.Config) error
}

type PierManager added in v1.5.0

type PierManager interface {
	Piers() *Piers

	AskPierMaster(string) (bool, error)
}

type Piers added in v1.5.0

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

func (*Piers) CheckMaster added in v1.5.0

func (p *Piers) CheckMaster(address string) bool

func (*Piers) HasPier added in v1.5.0

func (p *Piers) HasPier(address string) bool

func (*Piers) HeartBeat added in v1.5.0

func (p *Piers) HeartBeat(address string, index string) error

func (*Piers) SetMaster added in v1.5.0

func (p *Piers) SetMaster(address string, index string, timeout int64) error

type Swarm

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

func New

func New(repoConfig *repo.Repo, logger logrus.FieldLogger, ledger *ledger.Ledger) (*Swarm, error)

func (*Swarm) AddNode added in v1.4.0

func (swarm *Swarm) AddNode(newNodeID uint64, vpInfo *pb.VpInfo)

func (*Swarm) AskPierMaster added in v1.5.0

func (swarm *Swarm) AskPierMaster(address string) (bool, error)

func (*Swarm) AsyncSend

func (swarm *Swarm) AsyncSend(id uint64, msg *pb.Message) error

func (*Swarm) Broadcast

func (swarm *Swarm) Broadcast(msg *pb.Message) error

func (*Swarm) CountConnectedPeers added in v1.4.0

func (swarm *Swarm) CountConnectedPeers() uint64

func (*Swarm) DelNode added in v1.4.0

func (swarm *Swarm) DelNode(delID uint64)

func (*Swarm) Disconnect added in v1.4.0

func (swarm *Swarm) Disconnect(vpInfos map[uint64]*pb.VpInfo)

func (*Swarm) OtherPeers

func (swarm *Swarm) OtherPeers() map[uint64]*peer.AddrInfo

func (*Swarm) Peers

func (swarm *Swarm) Peers() map[uint64]*pb.VpInfo

func (*Swarm) PierManager added in v1.5.0

func (swarm *Swarm) PierManager() PierManager

func (*Swarm) Piers added in v1.5.0

func (swarm *Swarm) Piers() *Piers

func (*Swarm) Ping added in v1.4.0

func (swarm *Swarm) Ping()

func (*Swarm) ReConfig added in v1.6.3

func (swarm *Swarm) ReConfig(config *repo.Config) error

func (*Swarm) Send

func (swarm *Swarm) Send(id uint64, msg *pb.Message) (*pb.Message, error)

func (*Swarm) SendWithStream

func (swarm *Swarm) SendWithStream(s network.Stream, msg *pb.Message) error

func (*Swarm) Start

func (swarm *Swarm) Start() error

func (*Swarm) Stop

func (swarm *Swarm) Stop() error

func (*Swarm) SubscribeOrderMessage

func (swarm *Swarm) SubscribeOrderMessage(ch chan<- events.OrderMessageEvent) event.Subscription

func (*Swarm) UpdateRouter added in v1.4.0

func (swarm *Swarm) UpdateRouter(vpInfos map[uint64]*pb.VpInfo, isNew bool) bool

Directories

Path Synopsis
Package mock_peermgr is a generated GoMock package.
Package mock_peermgr is a generated GoMock package.

Jump to

Keyboard shortcuts

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