conn

package
v0.0.0-...-541d478 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package conn contains a simple datastructure and some general purpose methods for interacting with it

Index

Constants

This section is empty.

Variables

View Source
var NodeID string

NodeID is the unique identifier for this node. It should be set before New connections are generated

Functions

This section is empty.

Types

type Conn

type Conn struct {
	ID        ID     `json:"id"`
	Presence  string `json:"presence,omitempty"`
	IsBackend bool   `json:"isBackend,omitempty"`
}

Conn represents all the information needed to be stored about a connection

func New

func New() Conn

New returns a new Conn object with a brand new ID

func (*Conn) DecodeMsg

func (z *Conn) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Conn) EncodeMsg

func (z Conn) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Conn) MarshalBinary

func (c Conn) MarshalBinary() ([]byte, error)

MarshalBinary takes returns a binary string representation of the Conn

func (Conn) MarshalMsg

func (z Conn) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Conn) Msgsize

func (z Conn) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Conn) UnmarshalBinary

func (c *Conn) UnmarshalBinary(b []byte) error

UnmarshalBinary unmarshals a binary string returned from MarshalBinary into the Conn

func (*Conn) UnmarshalMsg

func (z *Conn) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ID

type ID string

ID is used to identify a single connection across all instances of otter in a cluster

func (*ID) DecodeMsg

func (z *ID) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (ID) EncodeMsg

func (z ID) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (ID) MarshalMsg

func (z ID) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ID) Msgsize

func (z ID) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (ID) NodeID

func (id ID) NodeID() string

NodeID returns the id of the node that this ID was created on

func (*ID) UnmarshalMsg

func (z *ID) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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