stream

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 17 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

This section is empty.

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) ReadStream added in v0.7.4

func (c *Conn) ReadStream(frameType uint32, closeConnOnClose bool) (_ *StreamReader, err error)

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, err *ReadStreamError)

func (*Conn) SendStream

func (c *Conn) SendStream(ctx context.Context, stream io.ReadCloser, frameType uint32) (err error)

func (*Conn) WriteStreamedMessage

func (c *Conn) WriteStreamedMessage(ctx context.Context, buf io.Reader, frameType uint32) (err 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

This function is deprecated in net.Error and since this function is not involved in .Accept() code path, nothing really needs this method to be here.

func (ReadStreamError) Timeout

func (e ReadStreamError) Timeout() bool

type ReadStreamErrorKind

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

type StreamReader added in v0.7.4

type StreamReader struct {
	*io.PipeReader
	// contains filtered or unexported fields
}

func (*StreamReader) Close added in v0.7.4

func (r *StreamReader) Close() error

Jump to

Keyboard shortcuts

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