stream

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 8 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, object storj.Object, streams *streams.Store) *Download

NewDownload creates new stream download.

func NewDownloadRange

func NewDownloadRange(ctx context.Context, object storj.Object, 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 *metainfo.MutableStream, streamsStore *streams.Store) *Upload

NewUpload creates new stream upload.

func (*Upload) Abort added in v1.2.0

func (upload *Upload) Abort() error

Abort closes the stream with an error so that it does not successfully commit and releases the underlying resources.

func (*Upload) Close

func (upload *Upload) Close() error

Close closes the stream and releases the underlying resources.

func (*Upload) Meta

func (upload *Upload) Meta() *streams.Meta

Meta returns the metadata of the uploaded object.

Will return nil if the upload is still in progress.

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