network

package
v0.0.0-...-fbf4a61 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastFacade

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

func NewBroadcastFacade

func NewBroadcastFacade(rb ReliableBroadcast) BroadcastFacade

func (BroadcastFacade) Egress

func (bf BroadcastFacade) Egress() chan<- []*types.Message

Egress is for messages that are sent by this node into the network.

func (BroadcastFacade) Run

func (bf BroadcastFacade) Run(ctx context.Context) error

func (BroadcastFacade) Send

func (bf BroadcastFacade) Send(ctx context.Context, msgs []*types.Message) error

func (BroadcastFacade) Subscribe

func (bf BroadcastFacade) Subscribe(ctx context.Context) (*Subscription, error)

type Config

type Config struct {
	NodeID      uint64
	QueueSize   int
	Fanout      int
	DialTimeout time.Duration
	SendTimeout time.Duration
	RetryPeriod time.Duration
}

type Connection

type Connection interface {
	Send(context.Context, []*types.Message) error
	Close() error
}

type Dialer

type Dialer interface {
	BroadcasterClient(context.Context, *types.Node) (Connection, error)
}

type Multiplexer

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

func NewMultiplexer

func NewMultiplexer(rb ReliableBroadcast) Multiplexer

func (Multiplexer) Run

func (m Multiplexer) Run(ctx context.Context) error

func (Multiplexer) Subscribe

func (m Multiplexer) Subscribe(ctx context.Context) (*Subscription, error)

type Network

type Network interface {
	RegisterBroadcasterServer(func(context.Context, []*types.Message) error)
	Dialer
}

type ReliableBroadcast

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

ReliableBroadcast guarantees that any sequnece of messages will be delivered atleast once and in order. Until peer is suspected by failure detector broadcaster will buffer and transmit message periodically. Once an ack received and message are in peer memory it is safe to stop. If peer crashes - it is peer responsbility to get missing data.

func NewReliableBroadcast

func NewReliableBroadcast(logger *zap.SugaredLogger,
	network Network,
	configuration *types.LastConfiguration,
	conf Config) ReliableBroadcast

func (ReliableBroadcast) Egress

func (rb ReliableBroadcast) Egress() chan<- []*types.Message

func (ReliableBroadcast) Run

func (rb ReliableBroadcast) Run(ctx context.Context) error

func (ReliableBroadcast) Watch

func (rb ReliableBroadcast) Watch() <-chan []*types.Message

type Subscription

type Subscription struct {
	Messages chan []*types.Message
	// contains filtered or unexported fields
}

func (*Subscription) Stop

func (s *Subscription) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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