stream

package
v0.29.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error = errs.Class("stream error")

Error is the errs class of stream errors

Functions

This section is empty.

Types

type Download

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

Download implements Reader, Seeker and Closer for reading from stream.

func NewDownload

func NewDownload(ctx context.Context, stream kvmetainfo.ReadOnlyStream, streams streams.Store) *Download

NewDownload creates new stream download.

func NewDownloadRange added in v0.18.0

func NewDownloadRange(ctx context.Context, stream kvmetainfo.ReadOnlyStream, streams streams.Store, offset, limit int64) *Download

NewDownloadRange creates new stream range download with range from offset to offset+limit.

func (*Download) Close

func (download *Download) Close() error

Close closes the stream and releases the underlying resources.

func (*Download) Read

func (download *Download) Read(data []byte) (n int, err error)

Read reads up to len(data) bytes into data.

If this is the first call it will read from the beginning of the stream. Use Seek to change the current offset for the next Read call.

See io.Reader for more details.

type Upload

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

Upload implements Writer and Closer for writing to stream.

func NewUpload

func NewUpload(ctx context.Context, stream kvmetainfo.MutableStream, streams streams.Store) *Upload

NewUpload creates new stream upload.

func (*Upload) Close

func (upload *Upload) Close() error

Close closes the stream and releases the underlying resources.

func (*Upload) Write

func (upload *Upload) Write(data []byte) (n int, err error)

Write writes len(data) bytes from data to the underlying data stream.

See io.Writer for more details.

Jump to

Keyboard shortcuts

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