payload

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBin

func NewBin(size int64, opener sts.Open, renamer sts.Rename) sts.Payload

NewBin creates a new Bin reference

func NewDecoder

func NewDecoder(n int, sep string, r io.Reader) (sts.PayloadDecoder, error)

NewDecoder expects the number of bytes devoted to the metadata array and the path delimeter string as inputs

Types

type Bin

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

Bin is the struct for managing the chunk of data sent in a single request

func (*Bin) Add

func (bin *Bin) Add(chunk sts.Binnable) (added bool)

Add adds what it can of the input Binnable to the bin. Returns false if no bytes were added.

func (*Bin) EncodeHeader

func (bin *Bin) EncodeHeader() (byteMeta []byte, err error)

EncodeHeader returns a byte-array encoding of the metadata for this payload

func (*Bin) GetCompleted

func (bin *Bin) GetCompleted() time.Time

GetCompleted returns the time this bin was marked "done"

func (*Bin) GetEncoder

func (bin *Bin) GetEncoder() io.ReadCloser

GetEncoder returns an io.Reader for reading the bin content

func (*Bin) GetParts

func (bin *Bin) GetParts() []sts.Binned

GetParts returns the slice of inner binnables that make up the payload

func (*Bin) GetSize

func (bin *Bin) GetSize() int64

GetSize returns the total size of this bin in bytes

func (*Bin) GetStarted

func (bin *Bin) GetStarted() time.Time

GetStarted returns the time this bin started to be read

func (*Bin) IsFull

func (bin *Bin) IsFull() bool

IsFull is for determining whether or not a bin has reached its acceptable capacity

func (*Bin) Remove

func (bin *Bin) Remove(binned sts.Binned)

Remove removes the part specified

func (*Bin) Split

func (bin *Bin) Split(n int) sts.Payload

Split splits a bin after n parts; the new bin is from position "n" forward

type Decoder

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

Decoder is responsible for parsing "bin" requests on the receiving end

func (*Decoder) GetParts

func (b *Decoder) GetParts() []sts.Binned

GetParts returns the part metadata

func (*Decoder) Next

func (b *Decoder) Next() (io.Reader, bool)

Next gets the next part decoder for this bin decoder

type Encoder

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

Encoder is the struct that manages writing a bin

func NewEncoder

func NewEncoder(bin *Bin) *Encoder

NewEncoder returns a new BinWriter instance

func (*Encoder) Close

func (b *Encoder) Close() error

func (*Encoder) Read

func (b *Encoder) Read(p []byte) (n int, err error)

Read reads the next bit of bytes from the current file part

type PartDecoder

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

PartDecoder is responsible for parsing individual "parts" of "bin" requests

func (*PartDecoder) Read

func (pr *PartDecoder) Read(out []byte) (n int, err error)

Read reads the incoming stream (either raw or gzipped) to the input []byte

Jump to

Keyboard shortcuts

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