adapter

package
v1.3.17 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PeerDiff added in v1.3.11

func PeerDiff(oldPeers TransportPeers, newPeers TransportPeers) (peersToRemove TransportPeers, peersToAdd TransportPeers)

Types

type InterceptableTransport added in v1.3.0

type InterceptableTransport interface {
	Transport
	SendWithInterceptor(ctx context.Context, data *TransportData, intercept InterceptorFunc) error
}

type InterceptorFunc added in v1.3.0

type InterceptorFunc func(ctx context.Context, peerAddress primitives.NodeAddress, data *TransportData, transmit TransmitFunc) error

type TransmitFunc added in v1.3.0

type TransmitFunc func(ctx context.Context, peerAddress primitives.NodeAddress, data *TransportData)

type Transport

type Transport interface {
	supervised.GracefulShutdowner
	govnr.ShutdownWaiter
	RegisterListener(listener TransportListener, listenerNodeAddress primitives.NodeAddress)
	Send(ctx context.Context, data *TransportData) error // TODO don't return error. misleading meaning. use panics instead
	UpdateTopology(bgCtx context.Context, newPeers TransportPeers)
}

type TransportData

type TransportData struct {
	SenderNodeAddress      primitives.NodeAddress
	RecipientMode          gossipmessages.RecipientsListMode
	RecipientNodeAddresses []primitives.NodeAddress
	Payloads               [][]byte // the first payload is normally gossipmessages.Header
}

func (*TransportData) Clone added in v1.3.0

func (d *TransportData) Clone() *TransportData

func (*TransportData) TotalSize added in v0.7.11

func (d *TransportData) TotalSize() (res int)

type TransportListener

type TransportListener interface {
	fmt.Stringer // TODO smelly
	OnTransportMessageReceived(ctx context.Context, payloads [][]byte)
}

type TransportPeer added in v1.3.14

type TransportPeer interface {
	Port() int
	Endpoint() string
	HexOrbsAddress() string
}

func NewGossipPeer added in v1.3.11

func NewGossipPeer(gossipPort int, gossipEndpoint string, hexAddress string) TransportPeer

type TransportPeers added in v1.3.14

type TransportPeers map[string]TransportPeer

func NewGossipPeers added in v1.3.14

func NewGossipPeers(servicePeers []*services.GossipPeer) TransportPeers

Directories

Path Synopsis
Package memory provides an in-memory implementation of the Gossip Transport adapter, meant for usage in fast tests that should not use the TCP-based adapter, such as acceptance tests or sociable unit tests, or in other in-process network use cases
Package memory provides an in-memory implementation of the Gossip Transport adapter, meant for usage in fast tests that should not use the TCP-based adapter, such as acceptance tests or sociable unit tests, or in other in-process network use cases
Package testkit extends the in-process transport adapter with Tampering capabilities, intended to be used by system-wide acceptance tests
Package testkit extends the in-process transport adapter with Tampering capabilities, intended to be used by system-wide acceptance tests

Jump to

Keyboard shortcuts

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