streambatcher

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batcher

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

Batcher issues batch items related to a single stream. It aggregates information about the stream required by callers to commit the stream. It also learns the stream ID (unless already provided for part uploads) and automatically injects it into batch items that need it.

func New

func New(miBatcher metaclient.Batcher, streamID storj.StreamID) *Batcher

New returns a new Batcher that issues batch items for a stream. The streamID can be nil (in the case of an object upload) or not (in the case of a part upload). The batcher will discover the streamID in the former case when it processes a BeginObject.

func (*Batcher) Batch

func (s *Batcher) Batch(ctx context.Context, batchItems ...metaclient.BatchItem) ([]metaclient.BatchResponse, error)

Batch issues batch items for a stream. Once the streamID is known, it will be injected into batch items that need it. If a BeginObject is issued, the stream ID will be gleaned from it. If a BeginObject needs to be issued, it must be the first batch item issued by the batcher.

func (*Batcher) Info

func (s *Batcher) Info() (Info, error)

Info returns the stream information gathered by the batch items.

func (*Batcher) StreamID

func (s *Batcher) StreamID() storj.StreamID

StreamID returns the stream ID either provided to the Batcher or gleaned from issuing a BeginObject request.

type Info

type Info struct {
	// CreationDate is the creation date of the stream extracted by the
	// stream ID that is provided to the Batcher or gathered from the
	// BeginObject response.
	CreationDate time.Time

	// PlainSize is the plain-text size of the stream aggregated from all
	// MakeInlineSegment or CommitSegment batch items.
	PlainSize int64

	// Version is object version retrieved from CommitObject batch item.
	Version []byte
}

Info returns stream information gathered by the Batcher.

Jump to

Keyboard shortcuts

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