protocol

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 10 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, logf lg.AppLogFunc) error

Types

type ChildErr

type ChildErr interface {
	Parent() error
}

type Client added in v1.2.1

type Client interface {
	Close() 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 {
	NewClient(net.Conn) Client
	IOLoop(Client) 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