stream

package
v0.1.0-fix-1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const StreamResultSize = 10

Variables

This section is empty.

Functions

This section is empty.

Types

type PayloadStream

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

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

func NewAsyncPayloadStream

func NewAsyncPayloadStream() *PayloadStream

NewAsyncPayloadStream return 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 *SegmentEntry

AsyncStreamRead return a channel that receive the payload and it's metadata

func (*PayloadStream) Close

func (stream *PayloadStream) Close()

Close write and read stream by the safe way

func (*PayloadStream) InitAsyncPayloadStream

func (stream *PayloadStream) InitAsyncPayloadStream(objectID uint64, rIdx uint32, segSize uint64,
	redundancyType storagetypes.RedundancyType) 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 close write stream without error

func (*PayloadStream) StreamCloseWithError

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

StreamCloseWithError close 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 SegmentEntry

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

func (SegmentEntry) Data

func (entry SegmentEntry) Data() []byte

func (SegmentEntry) Error

func (entry SegmentEntry) Error() error

func (SegmentEntry) ID

func (entry SegmentEntry) ID() uint64

func (SegmentEntry) Key

func (entry SegmentEntry) Key() string

Jump to

Keyboard shortcuts

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