ray

package
v0.0.0-...-b765225 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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

type InputStream interface {
	buf.Reader
	buf.TimeoutReader
	RayStream
	Peek(*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

type OutputStream interface {
	buf.Writer
	RayStream
}

type Ray

type Ray interface {
	InboundRay
	OutboundRay
}

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

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

Stream is a sequential container for data in bytes.

func NewStream

func NewStream(ctx context.Context) *Stream

NewStream creates a new Stream.

func (*Stream) Close

func (s *Stream) Close()

Close closes the stream for writing. Read() still works until EOF.

func (*Stream) CloseError

func (s *Stream) CloseError()

CloseError closes the Stream with error. Read() will return an error afterwards.

func (*Stream) Peek

func (s *Stream) Peek(b *buf.Buffer)

Peek fills in the given buffer with data from head of the Stream.

func (*Stream) Read

func (s *Stream) Read() (buf.MultiBuffer, error)

Read reads data from the Stream.

func (*Stream) ReadTimeout

func (s *Stream) ReadTimeout(timeout time.Duration) (buf.MultiBuffer, error)

ReadTimeout reads from the Stream with a specified timeout.

func (*Stream) Size

func (s *Stream) Size() uint64

Size returns the number of bytes hold in the Stream.

func (*Stream) Write

func (s *Stream) Write(data buf.MultiBuffer) error

Write writes more data into the Stream.

Jump to

Keyboard shortcuts

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