hostport

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Peer

type Peer struct {
	PeerIdentifier
	// contains filtered or unexported fields
}

Peer keeps a subscriber to send status updates to it, and the peer.Transport that created it

func NewPeer

func NewPeer(pid PeerIdentifier, transport peer.Transport) *Peer

NewPeer creates a new hostport.Peer from a hostport.PeerIdentifier, peer.Transport, and peer.Subscriber

func (*Peer) EndRequest added in v1.0.0

func (p *Peer) EndRequest(s peer.Subscriber)

EndRequest should be run after a request has finished.

func (*Peer) HostPort

func (p *Peer) HostPort() string

HostPort surfaces the HostPort in this function, if you want to access the hostport directly (for a downstream call) You need to cast the Peer to a *hostport.Peer and run this function

func (*Peer) NumSubscribers

func (p *Peer) NumSubscribers() int

NumSubscribers returns the number of subscriptions attached to the peer This function isn't thread safe

func (*Peer) SetStatus

func (p *Peer) SetStatus(status peer.ConnectionStatus)

SetStatus sets the status of the Peer (to be used by the peer.Transport)

func (*Peer) StartRequest

func (p *Peer) StartRequest(s peer.Subscriber)

StartRequest runs at the beginning of a request and returns a callback for when the request finished

func (*Peer) Status

func (p *Peer) Status() peer.Status

Status returns the current status of the hostport.Peer

func (*Peer) Subscribe added in v1.0.0

func (p *Peer) Subscribe(sub peer.Subscriber)

Subscribe adds a subscriber to the peer's subscriber map This function isn't thread safe

func (*Peer) Transport added in v1.0.0

func (p *Peer) Transport() peer.Transport

Transport returns the peer.Transport that is in charge of this hostport.Peer (and should be the one to handle requests)

func (*Peer) Unsubscribe added in v1.0.0

func (p *Peer) Unsubscribe(sub peer.Subscriber) error

Unsubscribe removes a subscriber from the peer's subscriber map This function isn't thread safe

type PeerIdentifier

type PeerIdentifier string

PeerIdentifier uniquely references a host:port combination using a common interface

func (PeerIdentifier) Identifier

func (p PeerIdentifier) Identifier() string

Identifier generates a (should be) unique identifier for this PeerIdentifier (to use in maps, etc)

Jump to

Keyboard shortcuts

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