Documentation
¶
Index ¶
- Constants
- Variables
- type Address
- type CID
- type FilterCode
- type FilterFunc
- type FilterParams
- type FilterPipeline
- type FilterResult
- type Hash
- type Header
- type Iterator
- type ListItem
- type Localstore
- type MetaHandler
- type Object
- type ObjectID
- type ObjectMeta
- func (*ObjectMeta) Descriptor() ([]byte, []int)
- func (m *ObjectMeta) GetObject() *object.Object
- func (m *ObjectMeta) GetPayloadSize() uint64
- func (m *ObjectMeta) GetStoreEpoch() uint64
- func (m *ObjectMeta) Marshal() (dAtA []byte, err error)
- func (m *ObjectMeta) MarshalTo(dAtA []byte) (int, error)
- func (m *ObjectMeta) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ObjectMeta) ProtoMessage()
- func (m *ObjectMeta) Reset()
- func (m *ObjectMeta) Size() (n int)
- func (m *ObjectMeta) String() string
- func (m *ObjectMeta) Unmarshal(dAtA []byte) error
- func (m *ObjectMeta) XXX_DiscardUnknown()
- func (m *ObjectMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ObjectMeta) XXX_Merge(src proto.Message)
- func (m *ObjectMeta) XXX_Size() int
- func (m *ObjectMeta) XXX_Unmarshal(b []byte) error
- type Params
- type PriorityFlag
- type SGID
- type SubFilterParams
Constants ¶
const StoreEpochValue = "store epoch"
StoreEpochValue is a context key of object storing epoch number.
Variables ¶
var ( ErrInvalidLengthLocalstore = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowLocalstore = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupLocalstore = fmt.Errorf("proto: unexpected end of group") )
var ErrEmptyMetaHandler = errors.New("meta handler is nil")
ErrEmptyMetaHandler is returned by functions that expect a non-nil MetaHandler, but received nil.
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 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.
type Iterator ¶
type Iterator interface {
Iterate(FilterPipeline, MetaHandler) error
}
Iterator is an interface of the iterator over local object storage.
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.
type MetaHandler ¶
type MetaHandler func(*ObjectMeta) bool
MetaHandler is a function that handles ObjectMeta.
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) 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 SubFilterParams ¶
type SubFilterParams struct {
PriorityFlag
FilterPipeline
OnIgnore FilterCode
OnPass FilterCode
OnFail FilterCode
}
SubFilterParams groups the parameters of sub-filter registration.