engine

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: GPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerSize added in v0.15.0

func ContainerSize(e *StorageEngine, id *cid.ID) uint64

ContainerSize returns sum of estimation container sizes among all shards.

func Get

func Get(storage *StorageEngine, addr *objectSDK.Address) (*object.Object, error)

Get reads object from local storage by provided address.

func GetRange

func GetRange(storage *StorageEngine, addr *objectSDK.Address, rng *objectSDK.Range) ([]byte, error)

GetRange reads object payload range from local storage by provided address.

func Head(storage *StorageEngine, addr *objectSDK.Address) (*object.Object, error)

Head reads object header from local storage by provided address.

func HeadRaw

func HeadRaw(storage *StorageEngine, addr *objectSDK.Address, raw bool) (*object.Object, error)

HeadRaw reads object header from local storage by provided address and raw flag.

func List

func List(storage *StorageEngine, limit uint64) ([]*object.Address, error)

List returns `limit` available physically storage object addresses in engine. If limit is zero, then returns all available object addresses.

func ListContainers added in v0.15.0

func ListContainers(e *StorageEngine) []*cid.ID

ListContainers returns unique container IDs presented in the engine objects.

func Put

func Put(storage *StorageEngine, obj *object.Object) error

Put writes provided object to local storage.

func Select

func Select(storage *StorageEngine, cid *cid.ID, fs object.SearchFilters) ([]*object.Address, error)

Select selects objects from local storage using provided filters.

Types

type ContainerSizePrm added in v0.15.0

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

func (*ContainerSizePrm) WithContainerID added in v0.15.0

func (p *ContainerSizePrm) WithContainerID(cid *cid.ID) *ContainerSizePrm

type ContainerSizeRes added in v0.15.0

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

func (*ContainerSizeRes) Size added in v0.15.0

func (r *ContainerSizeRes) Size() uint64

type DeletePrm

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

DeletePrm groups the parameters of Delete operation.

func (*DeletePrm) WithAddresses

func (p *DeletePrm) WithAddresses(addr ...*objectSDK.Address) *DeletePrm

WithAddresses is a Delete option to set the addresses of the objects to delete.

Option is required.

type DeleteRes

type DeleteRes struct{}

DeleteRes groups resulting values of Delete operation.

type ExistsPrm

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

ExistsPrm groups the parameters of Exists operation.

func (*ExistsPrm) WithAddress

func (p *ExistsPrm) WithAddress(addr *objectSDK.Address) *ExistsPrm

WithAddress is an Exists option to set object checked for existence.

type ExistsRes

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

ExistsRes groups resulting values of Exists operation.

func (*ExistsRes) Exists

func (p *ExistsRes) Exists() bool

Exists returns the fact that the object is in the storage engine.

type GetPrm

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

GetPrm groups the parameters of Get operation.

func (*GetPrm) WithAddress

func (p *GetPrm) WithAddress(addr *objectSDK.Address) *GetPrm

WithAddress is a Get option to set the address of the requested object.

Option is required.

type GetRes

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

GetRes groups resulting values of Get operation.

func (*GetRes) Object

func (r *GetRes) Object() *object.Object

Object returns the requested object.

type HeadPrm

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

HeadPrm groups the parameters of Head operation.

func (*HeadPrm) WithAddress

func (p *HeadPrm) WithAddress(addr *objectSDK.Address) *HeadPrm

WithAddress is a Head option to set the address of the requested object.

Option is required.

func (*HeadPrm) WithRaw

func (p *HeadPrm) WithRaw(raw bool) *HeadPrm

WithRaw is a Head option to set raw flag value. If flag is unset, then Head returns header of virtual object, otherwise it returns SplitInfo of virtual object.

type HeadRes

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

HeadRes groups resulting values of Head operation.

func (*HeadRes) Header

func (r *HeadRes) Header() *object.Object

Header returns the requested object header.

Instance has empty payload.

type Info

type Info struct {
	Shards []shard.Info
}

Info groups the information about StorageEngine.

type InhumePrm

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

InhumePrm encapsulates parameters for inhume operation.

func (*InhumePrm) MarkAsGarbage added in v0.16.0

func (p *InhumePrm) MarkAsGarbage(addrs ...*objectSDK.Address) *InhumePrm

MarkAsGarbage marks object to be physically removed from local storage.

Should not be called along with WithTarget.

func (*InhumePrm) WithTarget

func (p *InhumePrm) WithTarget(tombstone *objectSDK.Address, addrs ...*objectSDK.Address) *InhumePrm

WithTarget sets list of objects that should be inhumed and tombstone address as the reason for inhume operation.

tombstone should not be nil, addr should not be empty. Should not be called along with MarkAsGarbage.

type InhumeRes

type InhumeRes struct{}

InhumeRes encapsulates results of inhume operation.

type ListContainersPrm added in v0.15.0

type ListContainersPrm struct{}

type ListContainersRes added in v0.15.0

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

func (*ListContainersRes) Containers added in v0.15.0

func (r *ListContainersRes) Containers() []*cid.ID

type MetricRegister added in v0.17.0

type MetricRegister interface {
	AddListContainersDuration(d time.Duration)
	AddEstimateContainerSizeDuration(d time.Duration)
	AddDeleteDuration(d time.Duration)
	AddExistsDuration(d time.Duration)
	AddGetDuration(d time.Duration)
	AddHeadDuration(d time.Duration)
	AddInhumeDuration(d time.Duration)
	AddPutDuration(d time.Duration)
	AddRangeDuration(d time.Duration)
	AddSearchDuration(d time.Duration)
	AddListObjectsDuration(d time.Duration)
}

type Option

type Option func(*cfg)

Option represents StorageEngine's constructor option.

func WithLogger

func WithLogger(l *logger.Logger) Option

WithLogger returns option to set StorageEngine's logger.

func WithMetrics added in v0.17.0

func WithMetrics(v MetricRegister) Option

type PutPrm

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

PutPrm groups the parameters of Put operation.

func (*PutPrm) WithObject

func (p *PutPrm) WithObject(obj *object.Object) *PutPrm

WithObject is a Put option to set object to save.

Option is required.

type PutRes

type PutRes struct{}

PutRes groups resulting values of Put operation.

type RngPrm

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

RngPrm groups the parameters of GetRange operation.

func (*RngPrm) WithAddress

func (p *RngPrm) WithAddress(addr *objectSDK.Address) *RngPrm

WithAddress is a GetRng option to set the address of the requested object.

Option is required.

func (*RngPrm) WithPayloadRange

func (p *RngPrm) WithPayloadRange(rng *objectSDK.Range) *RngPrm

WithPayloadRange is a GetRange option to set range of requested payload data.

Missing an option or calling with zero length is equivalent to getting the full payload range.

type RngRes

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

RngRes groups resulting values of GetRange operation.

func (*RngRes) Object

func (r *RngRes) Object() *object.Object

Object returns the requested object part.

Instance payload contains the requested range of the original object.

type SelectPrm

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

SelectPrm groups the parameters of Select operation.

func (*SelectPrm) WithContainerID

func (p *SelectPrm) WithContainerID(cid *cid.ID) *SelectPrm

WithContainerID is a Select option to set the container id to search in.

func (*SelectPrm) WithFilters

func (p *SelectPrm) WithFilters(fs object.SearchFilters) *SelectPrm

WithFilters is a Select option to set the object filters.

type SelectRes

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

SelectRes groups resulting values of Select operation.

func (*SelectRes) AddressList

func (r *SelectRes) AddressList() []*object.Address

AddressList returns list of addresses of the selected objects.

type StorageEngine

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

StorageEngine represents NeoFS local storage engine.

func New

func New(opts ...Option) *StorageEngine

New creates, initializes and returns new StorageEngine instance.

func (*StorageEngine) AddShard

func (e *StorageEngine) AddShard(opts ...shard.Option) (*shard.ID, error)

AddShard adds a new shard to the storage engine.

Returns any error encountered that did not allow adding a shard. Otherwise returns the ID of the added shard.

func (*StorageEngine) Close

func (e *StorageEngine) Close() error

Close releases all StorageEngine's components.

func (*StorageEngine) ContainerSize added in v0.15.0

func (e *StorageEngine) ContainerSize(prm *ContainerSizePrm) *ContainerSizeRes

ContainerSize returns sum of estimation container sizes among all shards.

func (*StorageEngine) Delete

func (e *StorageEngine) Delete(prm *DeletePrm) (*DeleteRes, error)

Delete marks the objects to be removed.

func (*StorageEngine) DumpInfo

func (e *StorageEngine) DumpInfo() (i Info)

DumpInfo returns information about the StorageEngine.

func (*StorageEngine) Exists

func (e *StorageEngine) Exists(prm *ExistsPrm) (*ExistsRes, error)

Exists checks if object is presented in storage engine

Returns any error encountered that does not allow to unambiguously determine the presence of an object.

func (*StorageEngine) Get

func (e *StorageEngine) Get(prm *GetPrm) (*GetRes, error)

Get reads an object from local storage.

Returns any error encountered that did not allow to completely read the object part.

Returns ErrNotFound if requested object is missing in local storage.

func (*StorageEngine) GetRange

func (e *StorageEngine) GetRange(prm *RngPrm) (*RngRes, error)

GetRange reads part of an object from local storage.

Returns any error encountered that did not allow to completely read the object part.

Returns ErrNotFound if requested object is missing in local storage. Returns ErrAlreadyRemoved if requested object is inhumed. Returns ErrRangeOutOfBounds if requested object range is out of bounds.

func (*StorageEngine) Head

func (e *StorageEngine) Head(prm *HeadPrm) (*HeadRes, error)

Head reads object header from local storage.

Returns any error encountered that did not allow to completely read the object header.

Returns object.ErrNotFound if requested object is missing in local storage. Returns object.ErrAlreadyRemoved if requested object was inhumed.

func (*StorageEngine) Inhume

func (e *StorageEngine) Inhume(prm *InhumePrm) (*InhumeRes, error)

Inhume calls metabase. Inhume method to mark object as removed. It won't be removed physically from shard until `Delete` operation.

func (*StorageEngine) Init

func (e *StorageEngine) Init() error

Init initializes all StorageEngine's components.

func (*StorageEngine) List

func (e *StorageEngine) List(limit uint64) (*SelectRes, error)

List returns `limit` available physically storage object addresses in engine. If limit is zero, then returns all available object addresses.

func (*StorageEngine) ListContainers added in v0.15.0

func (e *StorageEngine) ListContainers(_ *ListContainersPrm) *ListContainersRes

ListContainers returns unique container IDs presented in the engine objects.

func (*StorageEngine) Open

func (e *StorageEngine) Open() error

Open opens all StorageEngine's components.

func (*StorageEngine) Put

func (e *StorageEngine) Put(prm *PutPrm) (*PutRes, error)

Put saves the object to local storage.

Returns any error encountered that did not allow to completely save the object.

func (*StorageEngine) Select

func (e *StorageEngine) Select(prm *SelectPrm) (*SelectRes, error)

Select selects the objects from local storage that match select parameters.

Returns any error encountered that did not allow to completely select the objects.

func (*StorageEngine) SetShardMode

func (e *StorageEngine) SetShardMode(id *shard.ID, m shard.Mode) error

SetShardMode sets mode of the shard with provided identifier.

Returns an error if shard mode was not set, or shard was not found in storage engine.

Jump to

Keyboard shortcuts

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