segments

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Error is the errs class of standard segment errors

Functions

func CalcNeededNodes

func CalcNeededNodes(rs storj.RedundancyScheme) int32

CalcNeededNodes calculate how many minimum nodes are needed for download, based on t = k + (n-o)k/o

Types

type ListItem

type ListItem struct {
	Path     storj.Path
	Meta     Meta
	IsPrefix bool
}

ListItem is a single item in a listing

type Meta

type Meta struct {
	Modified   time.Time
	Expiration time.Time
	Size       int64
	Data       []byte
}

Meta info about a segment

type PeekThresholdReader

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

PeekThresholdReader allows a check to see if the size of a given reader exceeds the maximum inline segment size or not.

func NewPeekThresholdReader

func NewPeekThresholdReader(r io.Reader) (pt *PeekThresholdReader)

NewPeekThresholdReader creates a new instance of PeekThresholdReader

func (*PeekThresholdReader) IsLargerThan

func (pt *PeekThresholdReader) IsLargerThan(thresholdSize int) (bool, error)

IsLargerThan returns a bool to determine whether a reader's size is larger than the given threshold or not.

func (*PeekThresholdReader) Read

func (pt *PeekThresholdReader) Read(p []byte) (n int, err error)

Read initially reads bytes from the internal buffer, then continues reading from the wrapped data reader. The number of bytes read `n` is returned.

type SizedReader

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

SizedReader allows to check the total number of bytes read so far.

func SizeReader

func SizeReader(r io.Reader) *SizedReader

SizeReader create a new instance of SizedReader.

func (*SizedReader) Read

func (r *SizedReader) Read(p []byte) (n int, err error)

Read implements io.Reader.Read

func (*SizedReader) Size

func (r *SizedReader) Size() int64

Size returns the total number of bytes read so far.

type Store

type Store interface {
	Get(ctx context.Context, streamID storj.StreamID, segmentIndex int32, objectRS storj.RedundancyScheme) (rr ranger.Ranger, encryption storj.SegmentEncryption, err error)
	Put(ctx context.Context, streamID storj.StreamID, data io.Reader, expiration time.Time, segmentInfo func() (int64, storj.SegmentEncryption, error)) (meta Meta, err error)
	Delete(ctx context.Context, streamID storj.StreamID, segmentIndex int32) (err error)
}

Store for segments

func NewSegmentStore

func NewSegmentStore(metainfo *metainfo.Client, ec ecclient.Client, rs eestream.RedundancyStrategy, threshold int, maxEncryptedSegmentSize int64) Store

NewSegmentStore creates a new instance of segmentStore

Jump to

Keyboard shortcuts

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