localstore

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const StoreEpochValue = "store epoch"

StoreEpochValue is a context key of object storing epoch number.

Variables

View Source
var (
	ErrInvalidLengthLocalstore        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowLocalstore          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupLocalstore = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrEmptyMetaHandler = errors.New("meta handler is nil")

ErrEmptyMetaHandler is returned by functions that expect a non-nil MetaHandler, but received nil.

View Source
var ErrOutOfRange = errors.New("range is out of payload bounds")

ErrOutOfRange is returned when requested object payload range is out of object payload bounds.

Functions

This section is empty.

Types

type Address

type Address = refs.Address

Address is a type alias of Address from refs package of neofs-api-go.

type CID

type CID = refs.CID

CID is a type alias of CID from refs package of neofs-api-go.

type FilterCode

type FilterCode int

FilterCode is an enumeration of filter return codes.

const (
	// CodeUndefined is a undefined FilterCode.
	CodeUndefined FilterCode = iota

	// CodePass is a FilterCode of filter passage.
	CodePass

	// CodeFail is a FilterCode of filter failure.
	CodeFail

	// CodeIgnore is a FilterCode of filter ignoring.
	CodeIgnore
)

func (FilterCode) String

func (r FilterCode) String() string

type FilterFunc

type FilterFunc func(ctx context.Context, meta *ObjectMeta) *FilterResult

FilterFunc is a function that checks whether an ObjectMeta matches a specific criterion.

func ContainerFilterFunc

func ContainerFilterFunc(cidList []CID) FilterFunc

ContainerFilterFunc returns a FilterFunc that returns:

  • result with CodePass code and nil error if CID of ObjectMeta if from the CID list;
  • result with CodeFail code an nil error otherwise.

func StoredEarlierThanFilterFunc

func StoredEarlierThanFilterFunc(epoch uint64) FilterFunc

StoredEarlierThanFilterFunc returns a FilterFunc that returns:

  • result with CodePass code and nil error if StoreEpoch is less that argument;
  • result with CodeFail code and nil error otherwise.

type FilterParams

type FilterParams struct {
	Name       string
	Priority   uint64
	FilterFunc FilterFunc
}

FilterParams groups the parameters of FilterPipeline constructor.

type FilterPipeline

type FilterPipeline interface {
	Pass(ctx context.Context, meta *ObjectMeta) *FilterResult
	PutSubFilter(params SubFilterParams) error
	GetPriority() uint64
	SetPriority(uint64)
	GetName() string
}

FilterPipeline is an interface of ObjectMeta filtering tool with sub-filters and priorities.

func AllPassIncludingFilter

func AllPassIncludingFilter(name string, params ...*FilterParams) (FilterPipeline, error)

AllPassIncludingFilter returns FilterPipeline with sub-filters composed from parameters. Result filter fails with CodeFail code if any of the sub-filters returns not a CodePass code.

func NewFilter

func NewFilter(p *FilterParams) FilterPipeline

NewFilter is a FilterPipeline constructor.

type FilterResult

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

FilterResult groups of ObjectMeta filter result values.

func ResultFail

func ResultFail() *FilterResult

ResultFail returns the FilterResult with CodeFail code and nil error.

func ResultIgnore

func ResultIgnore() *FilterResult

ResultIgnore returns the FilterResult with CodeIgnore code and nil error.

func ResultPass

func ResultPass() *FilterResult

ResultPass returns the FilterResult with CodePass code and nil error.

func ResultUndefined

func ResultUndefined() *FilterResult

ResultUndefined returns the FilterResult with CodeUndefined code and nil error.

func ResultWithError

func ResultWithError(c FilterCode, e error) *FilterResult

ResultWithError returns the FilterResult with passed code and error.

func SkippingFilterFunc

func SkippingFilterFunc(_ context.Context, _ *ObjectMeta) *FilterResult

SkippingFilterFunc is a FilterFunc that always returns result with CodePass code and nil error.

func (*FilterResult) Code

func (s *FilterResult) Code() FilterCode

Code returns the filter result code.

func (*FilterResult) Err

func (s *FilterResult) Err() error

Err returns the filter result error.

type Hash

type Hash = hash.Hash

Hash is a type alias of Hash from hash package of neofs-api-go.

type Header = object.Header

Header is a type alias of Header from object package of neofs-api-go.

type Iterator

type Iterator interface {
	Iterate(FilterPipeline, MetaHandler) error
}

Iterator is an interface of the iterator over local object storage.

type ListItem

type ListItem struct {
	ObjectMeta
}

ListItem is an ObjectMeta wrapper.

func ListItems

func ListItems(it Iterator, f FilterPipeline) ([]ListItem, error)

ListItems iterates over Iterator with FilterPipeline and returns all passed items.

type Localstore

type Localstore interface {
	Put(context.Context, *Object) error
	Get(Address) (*Object, error)
	Del(Address) error
	Meta(Address) (*ObjectMeta, error)
	Iterator
	Has(Address) (bool, error)
	ObjectsCount() (uint64, error)

	object.PositionReader
	Size() int64
}

Localstore is an interface of local object storage.

func New

func New(p Params) (Localstore, error)

New is a local object storage constructor.

type MetaHandler

type MetaHandler func(*ObjectMeta) bool

MetaHandler is a function that handles ObjectMeta.

type Object

type Object = object.Object

Object is a type alias of Object from object package of neofs-api-go.

type ObjectID

type ObjectID = refs.ObjectID

ObjectID is a type alias of ObjectID from refs package of neofs-api-go.

type ObjectMeta

type ObjectMeta struct {
	Object               *object.Object `protobuf:"bytes,1,opt,name=Object,proto3" json:"Object,omitempty"`
	PayloadHash          Hash           `protobuf:"bytes,2,opt,name=PayloadHash,proto3,customtype=Hash" json:"PayloadHash"`
	PayloadSize          uint64         `protobuf:"varint,3,opt,name=PayloadSize,proto3" json:"PayloadSize,omitempty"`
	StoreEpoch           uint64         `protobuf:"varint,4,opt,name=StoreEpoch,proto3" json:"StoreEpoch,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*ObjectMeta) Descriptor

func (*ObjectMeta) Descriptor() ([]byte, []int)

func (*ObjectMeta) GetObject

func (m *ObjectMeta) GetObject() *object.Object

func (*ObjectMeta) GetPayloadSize

func (m *ObjectMeta) GetPayloadSize() uint64

func (*ObjectMeta) GetStoreEpoch

func (m *ObjectMeta) GetStoreEpoch() uint64

func (*ObjectMeta) Marshal

func (m *ObjectMeta) Marshal() (dAtA []byte, err error)

func (*ObjectMeta) MarshalTo

func (m *ObjectMeta) MarshalTo(dAtA []byte) (int, error)

func (*ObjectMeta) MarshalToSizedBuffer

func (m *ObjectMeta) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ObjectMeta) ProtoMessage

func (*ObjectMeta) ProtoMessage()

func (*ObjectMeta) Reset

func (m *ObjectMeta) Reset()

func (*ObjectMeta) Size

func (m *ObjectMeta) Size() (n int)

func (*ObjectMeta) String

func (m *ObjectMeta) String() string

func (*ObjectMeta) Unmarshal

func (m *ObjectMeta) Unmarshal(dAtA []byte) error

func (*ObjectMeta) XXX_DiscardUnknown

func (m *ObjectMeta) XXX_DiscardUnknown()

func (*ObjectMeta) XXX_Marshal

func (m *ObjectMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ObjectMeta) XXX_Merge

func (m *ObjectMeta) XXX_Merge(src proto.Message)

func (*ObjectMeta) XXX_Size

func (m *ObjectMeta) XXX_Size() int

func (*ObjectMeta) XXX_Unmarshal

func (m *ObjectMeta) XXX_Unmarshal(b []byte) error

type Params

type Params struct {
	BlobBucket bucket.Bucket
	MetaBucket bucket.Bucket
	Logger     *zap.Logger
	Collector  metrics2.Collector
}

Params groups the parameters of local object storage constructor.

type PriorityFlag

type PriorityFlag int

PriorityFlag is an enumeration of priority flags.

const (
	// PriorityValue is a PriorityFlag of the sub-filter registration with GetPriority() value.
	PriorityValue PriorityFlag = iota

	// PriorityMax is a PriorityFlag of the sub-filter registration with maximum priority.
	PriorityMax

	// PriorityMin is a PriorityFlag of the sub-filter registration with minimum priority.
	PriorityMin
)

type SGID

type SGID = refs.ObjectID

SGID is a type alias of SGID from refs package of neofs-api-go.

type SubFilterParams

type SubFilterParams struct {
	PriorityFlag
	FilterPipeline
	OnIgnore FilterCode
	OnPass   FilterCode
	OnFail   FilterCode
}

SubFilterParams groups the parameters of sub-filter registration.

Jump to

Keyboard shortcuts

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