segmentupload

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncodedReader

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

EncodedReader provides a redundant piece for given reader.

func NewEncodedReader

func NewEncodedReader(r io.Reader, rs eestream.RedundancyStrategy, num int) *EncodedReader

NewEncodedReader provides a reader that returns a redundant piece for the reader using the given redundancy strategy and piece number.

func (*EncodedReader) Read

func (er *EncodedReader) Read(p []byte) (n int, err error)

Read reads the redundant piece data.

type Scheduler

type Scheduler interface {
	Join(ctx context.Context) (scheduler.Handle, bool)
}

Scheduler is used to coordinate and constrain resources between concurrent segment uploads.

type Upload

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

Upload is a segment upload that has been started and returned by the Begin method.

func Begin

func Begin(ctx context.Context,
	beginSegment *metaclient.BeginSegmentResponse,
	segment splitter.Segment,
	limitsExchanger pieceupload.LimitsExchanger,
	piecePutter pieceupload.PiecePutter,
	scheduler Scheduler,
	longTailMargin int,
) (_ *Upload, err error)

Begin starts a segment upload identified by the segment ID provided in the beginSegment response. The returned upload will complete when enough piece uploads to fulfill the optimal threshold for the segment redundancy strategy plus a small long tail margin. It cancels remaining piece uploads once that threshold has been hit.

func (*Upload) Wait

func (upload *Upload) Wait() (_ *metaclient.CommitSegmentParams, err error)

Wait blocks until the segment upload completes. It will be successful as long as enough pieces have uploaded successfully.

Jump to

Keyboard shortcuts

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