link

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package link provides a measured transport.Socket link

Package link provides a measured link on top of a transport.Socket

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLinkClosed = errors.New("link closed")
)

Functions

func Address

func Address(a string) options.Option

The address to use for the link. Connect must be called for this to be used, its otherwise unused.

func Id

func Id(id string) options.Option

Sets the link id which otherwise defaults to "local"

func Socket

func Socket(s transport.Socket) options.Option

Socket sets the socket to use instead of dialing.

func Transport

func Transport(t transport.Transport) options.Option

The transport to use for the link where we want to dial the connection first.

Types

type Link interface {
	// provides the transport.Socket interface
	transport.Socket
	// Connect connects the link. It must be called first
	// if there's an expectation to create a new socket.
	Connect() error
	// Id of the link is "local" if not specified
	Id() string
	// Status of the link
	Status() string
	// Depth of the buffers
	Weight() int
	// Rate of the link
	Length() int
}

Link is a layer on top of a transport socket with the buffering send and recv queue's with the ability to measure the actual transport link and reconnect if an address is specified.

func NewLink(opts ...options.Option) Link

NewLink creates a new link on top of a socket

Jump to

Keyboard shortcuts

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