localstore

package
v0.12.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressFromMeta

func AddressFromMeta(m *ObjectMeta) *objectSDK.Address

AddressFromMeta extracts the Address from object meta.

Types

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.

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 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 (*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 ObjectMeta

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

ObjectMeta represents meta information about the object that is stored in meta storage.

func (*ObjectMeta) Head

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

Head returns the object w/o payload.

func (*ObjectMeta) SavedAtEpoch

func (m *ObjectMeta) SavedAtEpoch() uint64

SavedAtEpoch returns the number of epoch at which the object was saved locally.

type Option added in v0.12.0

type Option func(*cfg)

Option is an option of Storage constructor.

func WithLogger added in v0.12.0

func WithLogger(l *logger.Logger) Option

WithLogger returns Storage option of used logger.

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 Storage added in v0.12.0

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

Storage represents NeoFS local object storage.

func New

func New(blob, meta bucket.Bucket, opts ...Option) *Storage

New is a local object storage constructor.

func (*Storage) Delete added in v0.12.0

func (s *Storage) Delete(addr *objectSDK.Address) error

func (*Storage) Get added in v0.12.0

func (s *Storage) Get(addr *objectSDK.Address) (*object.Object, error)

func (*Storage) Head added in v0.12.0

func (s *Storage) Head(addr *objectSDK.Address) (*ObjectMeta, error)

func (*Storage) Iterate

func (s *Storage) Iterate(filter FilterPipeline, handler func(*ObjectMeta) bool) error

func (*Storage) Put added in v0.12.0

func (s *Storage) Put(obj *object.Object) error

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