peermgr

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 23 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

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

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

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

type Swarm

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

func New

func New(repo *repo.Repo, logger logrus.FieldLogger, ledger ledger.Ledger) (*Swarm, 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) OtherPeers

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

func (*Swarm) Peers

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

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

Jump to

Keyboard shortcuts

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