segments

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2019 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package segments is a generated GoMock package.

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 *pb.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 MockStore

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

MockStore is a mock of Store interface

func NewMockStore

func NewMockStore(ctrl *gomock.Controller) *MockStore

NewMockStore creates a new mock instance

func (*MockStore) Delete

func (m *MockStore) Delete(ctx context.Context, path storj.Path) error

Delete mocks base method

func (*MockStore) EXPECT

func (m *MockStore) EXPECT() *MockStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockStore) Get

func (m *MockStore) Get(ctx context.Context, path storj.Path) (ranger.Ranger, Meta, error)

Get mocks base method

func (*MockStore) List

func (m *MockStore) List(ctx context.Context, prefix, startAfter, endBefore storj.Path, recursive bool, limit int, metaFlags uint32) ([]ListItem, bool, error)

List mocks base method

func (*MockStore) Meta

func (m *MockStore) Meta(ctx context.Context, path storj.Path) (Meta, error)

Meta mocks base method

func (*MockStore) Put

func (m *MockStore) Put(ctx context.Context, data io.Reader, expiration time.Time, segmentInfo func() (storj.Path, []byte, error)) (Meta, error)

Put mocks base method

func (*MockStore) Repair

func (m *MockStore) Repair(ctx context.Context, path storj.Path, lostPieces []int32) error

Repair mocks base method

type MockStoreMockRecorder

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

MockStoreMockRecorder is the mock recorder for MockStore

func (*MockStoreMockRecorder) Delete

func (mr *MockStoreMockRecorder) Delete(ctx, path interface{}) *gomock.Call

Delete indicates an expected call of Delete

func (*MockStoreMockRecorder) Get

func (mr *MockStoreMockRecorder) Get(ctx, path interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockStoreMockRecorder) List

func (mr *MockStoreMockRecorder) List(ctx, prefix, startAfter, endBefore, recursive, limit, metaFlags interface{}) *gomock.Call

List indicates an expected call of List

func (*MockStoreMockRecorder) Meta

func (mr *MockStoreMockRecorder) Meta(ctx, path interface{}) *gomock.Call

Meta indicates an expected call of Meta

func (*MockStoreMockRecorder) Put

func (mr *MockStoreMockRecorder) Put(ctx, data, expiration, segmentInfo interface{}) *gomock.Call

Put indicates an expected call of Put

func (*MockStoreMockRecorder) Repair

func (mr *MockStoreMockRecorder) Repair(ctx, path, lostPieces interface{}) *gomock.Call

Repair indicates an expected call of Repair

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 Repairer

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

Repairer for segments

func NewSegmentRepairer

func NewSegmentRepairer(metainfo *metainfo.Service, orders *orders.Service, cache *overlay.Cache, ec ecclient.Client, identity *identity.FullIdentity, timeout time.Duration) *Repairer

NewSegmentRepairer creates a new instance of SegmentRepairer

func (*Repairer) Repair

func (repairer *Repairer) Repair(ctx context.Context, path storj.Path) (err error)

Repair retrieves an at-risk segment and repairs and stores lost pieces on new nodes

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 {
	Meta(ctx context.Context, path storj.Path) (meta Meta, err error)
	Get(ctx context.Context, path storj.Path) (rr ranger.Ranger, meta Meta, err error)
	Put(ctx context.Context, data io.Reader, expiration time.Time, segmentInfo func() (storj.Path, []byte, error)) (meta Meta, err error)
	Delete(ctx context.Context, path storj.Path) (err error)
	List(ctx context.Context, prefix, startAfter, endBefore storj.Path, recursive bool, limit int, metaFlags uint32) (items []ListItem, more bool, 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