stream

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StreamErrTrailer uint32 = 1 << (16 + iota)
	End
)

Frame types used by this package. 4 MSBs are reserved for frameconn, next 4 MSB for heartbeatconn, next 4 MSB for us.

View Source
const FramePayloadShift = 19

Variables

View Source
var ErrReadFramesStopped = fmt.Errorf("stream: reading frames stopped")

Functions

func IsPublicFrameType

func IsPublicFrameType(ft uint32) bool

Check whether the given frame type is allowed to be used by consumers of this package. Intended for use in unit tests.

func WithLogger

func WithLogger(ctx context.Context, log Logger) context.Context

Types

type Conn

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

func Wrap

func Wrap(nc timeoutconn.Wire, sendHeartbeatInterval, peerTimeout time.Duration) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) ReadStreamInto

func (c *Conn) ReadStreamInto(w io.Writer, frameType uint32) zfs.StreamCopierError

WriteStreamTo reads a stream from Conn and writes it to w.

func (*Conn) ReadStreamedMessage

func (c *Conn) ReadStreamedMessage(ctx context.Context, maxSize uint32, frameType uint32) ([]byte, *ReadStreamError)

func (*Conn) SendStream

func (c *Conn) SendStream(ctx context.Context, src zfs.StreamCopier, frameType uint32) error

func (*Conn) WriteStreamedMessage

func (c *Conn) WriteStreamedMessage(ctx context.Context, buf io.Reader, frameType uint32) error

type Logger

type Logger = logger.Logger

type ReadStreamError

type ReadStreamError struct {
	Kind ReadStreamErrorKind
	Err  error
}

func (*ReadStreamError) Error

func (e *ReadStreamError) Error() string

func (ReadStreamError) IsReadError

func (e ReadStreamError) IsReadError() bool

func (ReadStreamError) IsWriteError

func (e ReadStreamError) IsWriteError() bool

func (ReadStreamError) Temporary

func (e ReadStreamError) Temporary() bool

func (ReadStreamError) Timeout

func (e ReadStreamError) Timeout() bool

type ReadStreamErrorKind

type ReadStreamErrorKind int
const (
	ReadStreamErrorKindConn ReadStreamErrorKind = 1 + iota
	ReadStreamErrorKindWrite
	ReadStreamErrorKindSource
	ReadStreamErrorKindStreamErrTrailerEncoding
	ReadStreamErrorKindUnexpectedFrameType
)

Jump to

Keyboard shortcuts

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