net

package
v0.0.0-...-9727c61 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stats

type Stats interface {
	Sent(nBytes int, label string)
	Received(nBytes int, label string)
	Dropped(nBytes int, label string)
}

Stats represents a statistics tracker for networking. It tracks the amount of data that is sent, received, and dropped (i.e., not sent). The data can be categorized using string labels, and it is the implementation's choice how to interpret them. All method implementations must be thread-safe, as they can be called concurrently.

type Transport

type Transport interface {
	modules.ActiveModule

	// Start starts the networking module by initializing and starting the corresponding network services.
	Start() error

	// Stop closes all open connections to other nodes and stops the network services.
	Stop()

	// Send sends msg to the node with ID dest.
	// TODO: Remove this method from the interface definition. Sending is invoked by event processing, not externally.
	Send(dest t.NodeID, msg *messagepb.Message) error

	// Connect initiates the establishing of network connections to the provided nodes.
	// When Connect returns, the connections might not yet have been established though (see WaitFor).
	Connect(nodes *trantorpbtypes.Membership)

	// WaitFor waits until at least n connections (including the potentially virtual connection to self)
	// have been established and returns nil.
	// If the networking module is stopped while WaitFor is invoked, WaitFor returns a non-nil error.
	WaitFor(n int) error

	// CloseOldConnections closes connections to the nodes that don't needed.
	CloseOldConnections(newNodes *trantorpbtypes.Membership)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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