protocol

package
v1.0.0-compat Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToBase10

func ByteToBase10(b []byte) (n uint64, err error)

func IsValidChannelName

func IsValidChannelName(name string) bool

IsValidChannelName checks a channel name for correctness

func IsValidTopicName

func IsValidTopicName(name string) bool

IsValidTopicName checks a topic name for correctness

func SendFramedResponse

func SendFramedResponse(w io.Writer, frameType int32, data []byte) (int, error)

SendFramedResponse is a server side utility function to prefix data with a length header and frame header and write to the supplied Writer

func SendResponse

func SendResponse(w io.Writer, data []byte) (int, error)

SendResponse is a server side utility function to prefix data with a length header and write to the supplied Writer

func TCPServer

func TCPServer(listener net.Listener, handler TCPHandler, l app.Logger)

Types

type ChildErr

type ChildErr interface {
	Parent() error
}

type ClientErr

type ClientErr struct {
	ParentErr error
	Code      string
	Desc      string
}

ClientErr provides a way for NSQ daemons to log a human reabable error string and return a machine readable string to the client.

see docs/protocol.md for error codes by command

func NewClientErr

func NewClientErr(parent error, code string, description string) *ClientErr

NewClientErr creates a ClientErr with the supplied human and machine readable strings

func (*ClientErr) Error

func (e *ClientErr) Error() string

Error returns the machine readable form

func (*ClientErr) Parent

func (e *ClientErr) Parent() error

Parent returns the parent error

type FatalClientErr

type FatalClientErr struct {
	ParentErr error
	Code      string
	Desc      string
}

func NewFatalClientErr

func NewFatalClientErr(parent error, code string, description string) *FatalClientErr

NewClientErr creates a ClientErr with the supplied human and machine readable strings

func (*FatalClientErr) Error

func (e *FatalClientErr) Error() string

Error returns the machine readable form

func (*FatalClientErr) Parent

func (e *FatalClientErr) Parent() error

Parent returns the parent error

type Protocol

type Protocol interface {
	IOLoop(conn net.Conn) error
}

Protocol describes the basic behavior of any protocol in the system

type TCPHandler

type TCPHandler interface {
	Handle(net.Conn)
}

Jump to

Keyboard shortcuts

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