ray

package
v2.16.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReadTimeout = errors.New("Ray: timeout.")

Functions

This section is empty.

Types

type InboundRay

type InboundRay interface {
	// InboundInput provides a stream to retrieve the request from client.
	// The inbound connection shall close the channel after the entire request
	// is received and put into the channel.
	InboundInput() OutputStream

	// InboudBound provides a stream of data for the inbound connection to write
	// as response. The inbound connection shall write all the data from the
	// channel until it is closed.
	InboundOutput() InputStream
}

InboundRay is a transport interface for inbound connections.

type InputStream added in v1.11.1

type InputStream interface {
	buf.Reader
	RayStream
	ReadTimeout(time.Duration) (*buf.Buffer, error)
}

type Inspector

type Inspector interface {
	Input(*buf.Buffer)
}

type InspectorChain

type InspectorChain struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*InspectorChain) AddInspector

func (ic *InspectorChain) AddInspector(inspector Inspector)

func (*InspectorChain) Input

func (ic *InspectorChain) Input(b *buf.Buffer)

type NoOpInspector

type NoOpInspector struct{}

func (NoOpInspector) Input

func (NoOpInspector) Input(*buf.Buffer)

type OutboundRay

type OutboundRay interface {
	// OutboundInput provides a stream for the input of the outbound connection.
	// The outbound connection shall write all the input until it is closed.
	OutboundInput() InputStream

	// OutboundOutput provides a stream to retrieve the response from the
	// outbound connection. The outbound connection shall close the channel
	// after all responses are receivced and put into the channel.
	OutboundOutput() OutputStream
}

OutboundRay is a transport interface for outbound connections.

type OutputStream added in v1.11.1

type OutputStream interface {
	buf.Writer
	RayStream
}

type Ray

type Ray interface {
	InboundRay
	OutboundRay
	AddInspector(Inspector)
}

Ray is an internal tranport channel between inbound and outbound connection.

func NewRay

func NewRay(ctx context.Context) Ray

NewRay creates a new Ray for direct traffic transport.

type RayStream

type RayStream interface {
	Close()
	CloseError()
}

type Stream added in v1.11.1

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

func NewStream added in v1.11.1

func NewStream(ctx context.Context) *Stream

func (*Stream) Close added in v1.11.1

func (v *Stream) Close()

func (*Stream) CloseError

func (v *Stream) CloseError()

func (*Stream) Read added in v1.11.1

func (v *Stream) Read() (*buf.Buffer, error)

func (*Stream) ReadTimeout

func (v *Stream) ReadTimeout(timeout time.Duration) (*buf.Buffer, error)

func (*Stream) Release added in v1.11.1

func (v *Stream) Release()

func (*Stream) Write added in v1.11.1

func (v *Stream) Write(data *buf.Buffer) (err error)

Jump to

Keyboard shortcuts

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