network

package
v0.20.4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Network

type Network struct {
	p2p.ReadyDoneAwareNetwork
	// contains filtered or unexported fields
}

Network is the splitter network. It is a wrapper around the default network implementation and should be passed in to engine constructors that require a network to register with. When an engine is registered with the splitter network, a splitter engine is created for the given channel (if one doesn't already exist) and the engine is registered with that splitter engine. As a result, multiple engines can register with the splitter network on the same channel and will each receive all events on that channel.

func NewNetwork

func NewNetwork(
	net p2p.ReadyDoneAwareNetwork,
	log zerolog.Logger,
) (*Network, error)

NewNetwork returns a new splitter network.

func (*Network) Done

func (n *Network) Done() <-chan struct{}

Done returns a done channel that is closed once the network has fully stopped. For the splitter network, this is true once the wrapped network has stopped.

func (*Network) Ready

func (n *Network) Ready() <-chan struct{}

Ready returns a ready channel that is closed once the network has fully started. For the splitter network, this is true once the wrapped network has started.

func (*Network) Register

func (n *Network) Register(channel network.Channel, e network.Engine) (network.Conduit, error)

Register will subscribe the given engine with the spitter on the given channel, and all registered engines will be notified with incoming messages on the channel. The returned Conduit can be used to send messages to engines on other nodes subscribed to the same channel

Jump to

Keyboard shortcuts

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