memchan

package
v1.0.0-rc1.0...-c90ccdb Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer represents a reactive outbound buffer implementation

func NewBuffer

func NewBuffer(
	buf []byte,
	onFlush func([]byte) error,
) Buffer

NewBuffer allocates a new buffer

func (*Buffer) Close

func (buf *Buffer) Close() (err error)

Close flushes the buffer to the reader

func (*Buffer) Write

func (buf *Buffer) Write(p []byte) (int, error)

Write writes a portion of data to the buffer

type ClientTransport

type ClientTransport struct {
	Server *Transport
}

ClientTransport implements the ClientTransport interface

func (*ClientTransport) NewSocket

func (cltTrans *ClientTransport) NewSocket(
	dialTimeout time.Duration,
) (wwr.ClientSocket, error)

NewSocket implements the ClientTransport interface

type ErrSockRead

type ErrSockRead struct {
	// contains filtered or unexported fields
}

ErrSockRead implements the ErrSockRead interface

func (ErrSockRead) Error

func (err ErrSockRead) Error() string

Error implements the Go error interface

func (ErrSockRead) IsCloseErr

func (err ErrSockRead) IsCloseErr() bool

IsCloseErr implements the ErrSockRead interface

type RemoteAddress

type RemoteAddress struct {
	// contains filtered or unexported fields
}

RemoteAddress represents a net.Addr interface implementation

func (RemoteAddress) Network

func (addr RemoteAddress) Network() string

Network implements the net.Addr interface

func (RemoteAddress) String

func (addr RemoteAddress) String() string

String implements the net.Addr interface

type Socket

type Socket struct {
	// contains filtered or unexported fields
}

Socket implements the transport.Socket interface using the fasthttp/websocket library

func NewEntangledSockets

func NewEntangledSockets(server *Transport) (srv, clt *Socket)

NewEntangledSockets creates a new socket pair

func (*Socket) Close

func (sock *Socket) Close() error

Close implements the transport.Socket interface

func (*Socket) Dial

func (sock *Socket) Dial(deadline time.Time) error

Dial implements the transport.Socket interface

func (*Socket) GetWriter

func (sock *Socket) GetWriter() (io.WriteCloser, error)

GetWriter implements the transport.Socket interface

func (*Socket) IsConnected

func (sock *Socket) IsConnected() bool

IsConnected implements the transport.Socket interface

func (*Socket) Read

func (sock *Socket) Read(
	msg *message.Message,
	deadline time.Time,
) (err wwr.ErrSockRead)

Read implements the transport.Socket interface

func (*Socket) RemoteAddr

func (sock *Socket) RemoteAddr() net.Addr

RemoteAddr implements the transport.Socket interface

type SocketType

type SocketType uint

SocketType represents the type of a socket

const (
	// SocketUninitialized is the default type of an uninitialized socket
	SocketUninitialized SocketType = iota

	// SocketServer represents server-side sockets
	SocketServer

	// SocketClient represents client-side sockets
	SocketClient
)

type Transport

type Transport struct {
	// OnBeforeCreation is called before the creation of a new connection and
	// must return the options to be assigned to the new connection
	OnBeforeCreation func() wwr.ConnectionOptions
	// contains filtered or unexported fields
}

Transport implements the Transport

func (*Transport) Address

func (srv *Transport) Address() url.URL

Address implements the Transport interface

func (*Transport) Initialize

func (srv *Transport) Initialize(
	options wwr.ServerOptions,
	isShuttingdown wwr.IsShuttingDown,
	onNewConnection wwr.OnNewConnection,
) error

Initialize implements the Transport interface

func (*Transport) Serve

func (srv *Transport) Serve() error

Serve implements the Transport interface

func (*Transport) Shutdown

func (srv *Transport) Shutdown() error

Shutdown implements the Transport interface

Jump to

Keyboard shortcuts

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