Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExceedsMTU = fmt.Errorf("payload size exceeds MTU")
Functions ¶
func RunDialer ¶
func RunDialer(ctx context.Context, pr ProtocolRunner, cost float32, dialer ConnFunc)
RunDialer abstractly implements retry logic for repeatedly dialing a peer until it connects
func RunListener ¶
func RunListener(ctx context.Context, pr ProtocolRunner, cost float32, acceptor ConnFunc)
RunListener abstractly implements the accept loop of a listener
Types ¶
type BackendConnection ¶
type BackendConnection interface { MTU() int WriteMessage([]byte) error ReadMessage() ([]byte, error) Close() error SetReadDeadline(time.Time) error SetWriteDeadline(time.Time) error IsServer() bool }
BackendConnection represents a single back-end connection. Message transport need not be reliable, but Backends must guarantee that whole messages transit the network intact - ie, that ReadMessage, if it returns anything, always returns the entire message that was provided (on another node) to WriteMessage, not just a fragment of it.
type ConnFunc ¶
type ConnFunc func() (BackendConnection, error)
ConnFunc is a type of function that gets a new BackendConnection, such as by dialing or accepting
type ProtocolRunner ¶
type ProtocolRunner interface {
RunProtocol(context.Context, float32, BackendConnection)
}
ProtocolRunner is called by backends to run a protocol over a connection
Click to show internal directories.
Click to hide internal directories.