stream

package
v0.1.2-fix-4 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PayloadStream

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

PayloadStream implements a one-way data flow, writes bytes of any size read the fixed data size with payload metadata

func NewAsyncPayloadStream

func NewAsyncPayloadStream() *PayloadStream

NewAsyncPayloadStream returns an instance of PayloadStream, and start async read stream TODO:: implement the SyncPayloadStream in the future base on requirements

func (*PayloadStream) AsyncStreamRead

func (stream *PayloadStream) AsyncStreamRead() <-chan *PieceEntry

AsyncStreamRead returns a channel which receives PieceEntry

func (*PayloadStream) Close

func (stream *PayloadStream) Close()

Close writes and reads stream by the safe way

func (*PayloadStream) InitAsyncPayloadStream

func (stream *PayloadStream) InitAsyncPayloadStream(objectID uint64, redundancyType storagetypes.RedundancyType,
	pieceSize uint64, ecPieceIndex uint32) error

InitAsyncPayloadStream only be called once, init the payload metadata must be called before write or read stream

func (*PayloadStream) StreamClose

func (stream *PayloadStream) StreamClose() error

StreamClose closes write stream without error

func (*PayloadStream) StreamCloseWithError

func (stream *PayloadStream) StreamCloseWithError(err error) error

StreamCloseWithError closes write stream with error

func (*PayloadStream) StreamWrite

func (stream *PayloadStream) StreamWrite(data []byte) (n int, err error)

StreamWrite writes data with the bytes of any size

type PieceEntry added in v0.1.1

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

PieceEntry is used to stream produce piece data.

func (*PieceEntry) Data added in v0.1.1

func (entry *PieceEntry) Data() []byte

Data returns piece data

func (*PieceEntry) Error added in v0.1.1

func (entry *PieceEntry) Error() error

Error returns stream read error

func (*PieceEntry) ObjectID added in v0.1.1

func (entry *PieceEntry) ObjectID() uint64

ObjectID returns piece's object id

func (*PieceEntry) PieceKey added in v0.1.1

func (entry *PieceEntry) PieceKey() string

PieceKey returns piece key, may be ECPieceKey/SegmentPieceKey

Jump to

Keyboard shortcuts

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