shard

package
v0.42.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDegradedMode = logicerr.New("shard is in degraded mode")

ErrDegradedMode is returned when operation requiring metabase is executed in degraded mode.

View Source
var ErrEndOfListing = meta.ErrEndOfListing

ErrEndOfListing is returned from object listing with cursor when storage can't return any more objects after provided cursor. Use nil cursor object to start listing again.

View Source
var ErrLockObjectRemoval = meta.ErrLockObjectRemoval

ErrLockObjectRemoval is returned when inhume operation is being performed on lock object, and it is not a forced object removal.

View Source
var ErrPiloramaDisabled = logicerr.New("pilorama is disabled")

ErrPiloramaDisabled is returned when pilorama was disabled in the configuration.

View Source
var ErrReadOnlyMode = logicerr.New("shard is in read-only mode")

ErrReadOnlyMode is returned when it is impossible to apply operation that changes shard's memory due to the "read-only" shard's mode.

View Source
var ErrShardDisabled = logicerr.New("shard disabled")

Functions

func IsErrObjectExpired

func IsErrObjectExpired(err error) bool

IsErrObjectExpired checks if an error returned by Shard corresponds to expired object.

func IsErrOutOfRange

func IsErrOutOfRange(err error) bool

IsErrOutOfRange checks if an error returned by Shard GetRange method corresponds to exceeding the object bounds.

Types

type ContainerCountPrm added in v0.38.0

type ContainerCountPrm struct {
	ContainerID cid.ID
}

type ContainerCountRes added in v0.38.0

type ContainerCountRes struct {
	Phy   uint64
	Logic uint64
	User  uint64
}

type ContainerSizePrm

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

func (*ContainerSizePrm) SetContainerID

func (p *ContainerSizePrm) SetContainerID(cnr cid.ID)

type ContainerSizeRes

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

func (ContainerSizeRes) Size

func (r ContainerSizeRes) Size() uint64

type Cursor

type Cursor = meta.Cursor

Cursor is a type for continuous object listing.

type DeletePrm

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

DeletePrm groups the parameters of Delete operation.

func (*DeletePrm) SetAddresses

func (p *DeletePrm) SetAddresses(addr ...oid.Address)

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

Option is required.

type DeleteRes

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

DeleteRes groups the resulting values of Delete operation.

type DeletedLockCallback

type DeletedLockCallback func(context.Context, []oid.Address)

DeletedLockCallback is a callback handling list of deleted LOCK objects.

type EmptyContainersCallback added in v0.38.0

type EmptyContainersCallback func(context.Context, []cid.ID)

EmptyContainersCallback is a callback hanfling list of zero-size and zero-count containers.

type Event

type Event interface {
	// contains filtered or unexported methods
}

Event represents class of external events.

func EventNewEpoch

func EventNewEpoch(e uint64) Event

EventNewEpoch returns new epoch event.

type ExistsPrm

type ExistsPrm struct {
	// Exists option to set object checked for existence.
	Address oid.Address
	// Exists option to set parent object checked for existence.
	ParentAddress oid.Address
}

ExistsPrm groups the parameters of Exists operation.

type ExistsRes

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

ExistsRes groups the resulting values of Exists operation.

func (ExistsRes) Exists

func (p ExistsRes) Exists() bool

Exists returns the fact that the object is in the shard.

func (ExistsRes) Locked added in v0.40.0

func (p ExistsRes) Locked() bool

Locked returns the fact that the object is locked.

type ExpiredObjectsCallback

type ExpiredObjectsCallback func(context.Context, uint64, []oid.Address)

ExpiredObjectsCallback is a callback handling list of expired objects.

type ExpiredTombstonesCallback

type ExpiredTombstonesCallback func(context.Context, []meta.TombstonedObject)

ExpiredTombstonesCallback is a callback handling list of expired tombstones.

type FlushWriteCachePrm

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

FlushWriteCachePrm represents parameters of a `FlushWriteCache` operation.

func (*FlushWriteCachePrm) SetIgnoreErrors

func (p *FlushWriteCachePrm) SetIgnoreErrors(ignore bool)

SetIgnoreErrors sets the flag to ignore read-errors during flush.

func (*FlushWriteCachePrm) SetSeal added in v0.38.0

func (p *FlushWriteCachePrm) SetSeal(v bool)

SetSeal sets the flag to left writecache in read-only mode after flush.

type GCMectrics added in v0.37.0

type GCMectrics interface {
	SetShardID(string)
	AddRunDuration(d time.Duration, success bool)
	AddDeletedCount(deleted, failed uint64)
	AddExpiredObjectCollectionDuration(d time.Duration, success bool, objectType string)
	AddInhumedObjectCount(count uint64, objectType string)
}

type GetPrm

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

GetPrm groups the parameters of Get operation.

func (*GetPrm) SetAddress

func (p *GetPrm) SetAddress(addr oid.Address)

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

Option is required.

func (*GetPrm) SetIgnoreMeta

func (p *GetPrm) SetIgnoreMeta(ignore bool)

SetIgnoreMeta is a Get option try to fetch object from blobstor directly, without accessing metabase.

type GetRes

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

GetRes groups the resulting values of Get operation.

func (GetRes) HasMeta

func (r GetRes) HasMeta() bool

HasMeta returns true if info about the object was found in the metabase.

func (GetRes) Object

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

Object returns the requested object.

type HeadPrm

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

HeadPrm groups the parameters of Head operation.

func (*HeadPrm) SetAddress

func (p *HeadPrm) SetAddress(addr oid.Address)

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

Option is required.

func (*HeadPrm) SetRaw

func (p *HeadPrm) SetRaw(raw bool)

SetRaw 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 the resulting values of Head operation.

func (HeadRes) Object

func (r HeadRes) Object() *objectSDK.Object

Object returns the requested object header.

type ID

type ID []byte

ID represents Shard identifier.

Each shard should have the unique ID within a single instance of local storage.

func NewIDFromBytes

func NewIDFromBytes(v []byte) *ID

NewIDFromBytes constructs ID from byte slice.

func (ID) String

func (id ID) String() string

type Info

type Info struct {
	// Identifier of the shard.
	ID *ID

	// Shard mode.
	Mode mode.Mode

	// Information about the metabase.
	MetaBaseInfo meta.Info

	// Information about the BLOB storage.
	BlobStorInfo blobstor.Info

	// Information about the Write Cache.
	WriteCacheInfo writecache.Info

	// ErrorCount contains amount of errors occurred in shard operations.
	ErrorCount uint32

	// PiloramaInfo contains information about trees stored on this shard.
	PiloramaInfo pilorama.Info
}

Info groups the information about Shard.

type InhumePrm

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

InhumePrm encapsulates parameters for inhume operation.

func (*InhumePrm) ForceRemoval

func (p *InhumePrm) ForceRemoval()

ForceRemoval forces object removing despite any restrictions imposed on deleting that object. Expected to be used only in control service.

func (*InhumePrm) MarkAsGarbage

func (p *InhumePrm) MarkAsGarbage(addr ...oid.Address)

MarkAsGarbage marks object to be physically removed from shard.

Should not be called along with SetTarget.

func (*InhumePrm) SetTarget

func (p *InhumePrm) SetTarget(tombstone oid.Address, addrs ...oid.Address)

SetTarget sets a 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

type ListContainersPrm struct{}

type ListContainersRes

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

func (ListContainersRes) Containers

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

type ListWithCursorPrm

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

ListWithCursorPrm contains parameters for ListWithCursor operation.

func (*ListWithCursorPrm) WithCount

func (p *ListWithCursorPrm) WithCount(count uint32)

WithCount sets maximum amount of addresses that ListWithCursor should return.

func (*ListWithCursorPrm) WithCursor

func (p *ListWithCursorPrm) WithCursor(cursor *Cursor)

WithCursor sets cursor for ListWithCursor operation. For initial request, ignore this param or use nil value. For consecutive requests, use value from ListWithCursorRes.

type ListWithCursorRes

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

ListWithCursorRes contains values returned from ListWithCursor operation.

func (ListWithCursorRes) AddressList

func (r ListWithCursorRes) AddressList() []objectcore.Info

AddressList returns addresses selected by ListWithCursor operation.

func (ListWithCursorRes) Cursor

func (r ListWithCursorRes) Cursor() *Cursor

Cursor returns cursor for consecutive listing requests.

type MetricsWriter

type MetricsWriter interface {
	// SetObjectCounter must set object counter taking into account object type.
	SetObjectCounter(objectType string, v uint64)
	// AddToObjectCounter must update object counter taking into account object
	// type.
	// Negative parameter must decrease the counter.
	AddToObjectCounter(objectType string, delta int)
	// AddToContainerSize must add a value to the container size.
	// Value can be negative.
	AddToContainerSize(cnr string, value int64)
	// AddToPayloadSize must add a value to the payload size.
	// Value can be negative.
	AddToPayloadSize(value int64)
	// IncObjectCounter must increment shard's object counter taking into account
	// object type.
	IncObjectCounter(objectType string)
	// SetShardID must set (update) the shard identifier that will be used in
	// metrics.
	SetShardID(id string)
	// SetReadonly must set shard mode.
	SetMode(mode mode.Mode)
	// IncErrorCounter increment error counter.
	IncErrorCounter()
	// ClearErrorCounter clear error counter.
	ClearErrorCounter()
	// DeleteShardMetrics deletes shard metrics from registry.
	DeleteShardMetrics()
	// SetContainerObjectsCount sets container object count.
	SetContainerObjectsCount(cnrID string, objectType string, value uint64)
	// IncContainerObjectsCount increments container object count.
	IncContainerObjectsCount(cnrID string, objectType string)
	// SubContainerObjectsCount subtracts container object count.
	SubContainerObjectsCount(cnrID string, objectType string, value uint64)
	// IncRefillObjectsCount increments refill objects count.
	IncRefillObjectsCount(path string, size int, success bool)
	// SetRefillPercent sets refill percent.
	SetRefillPercent(path string, percent uint32)
	// SetRefillStatus sets refill status.
	SetRefillStatus(path string, status string)
}

MetricsWriter is an interface that must store shard's metrics.

type Option

type Option func(*cfg)

Option represents Shard's constructor option.

func WithBlobStorOptions

func WithBlobStorOptions(opts ...blobstor.Option) Option

WithBlobStorOptions returns option to set internal BlobStor options.

func WithDeletedLockCallback

func WithDeletedLockCallback(v DeletedLockCallback) Option

WithDeletedLockCallback returns option to specify callback of the deleted LOCK objects handler.

func WithDisabledGC added in v0.38.0

func WithDisabledGC() Option

WithDisabledGC disables GC. For testing purposes only.

func WithExpiredCollectorBatchSize

func WithExpiredCollectorBatchSize(size int) Option

WithExpiredCollectorBatchSize returns option to set batch size of expired object collection operation.

func WithExpiredCollectorWorkerCount added in v0.38.0

func WithExpiredCollectorWorkerCount(count int) Option

WithExpiredCollectorWorkerCount returns option to set concurrent workers count of expired object collection operation.

func WithExpiredLocksCallback

func WithExpiredLocksCallback(cb ExpiredObjectsCallback) Option

WithExpiredLocksCallback returns option to specify callback of the expired LOCK objects handler.

func WithExpiredTombstonesCallback

func WithExpiredTombstonesCallback(cb ExpiredTombstonesCallback) Option

WithExpiredTombstonesCallback returns option to specify callback of the expired tombstones handler.

func WithGCMetrics added in v0.37.0

func WithGCMetrics(v GCMectrics) Option

WithGCMetrics returns option to specify storage of the GC metrics.

func WithGCRemoverSleepInterval

func WithGCRemoverSleepInterval(dur time.Duration) Option

WithGCRemoverSleepInterval returns option to specify sleep interval between object remover executions.

func WithGCWorkerPoolInitializer

func WithGCWorkerPoolInitializer(wpInit func(int) util.WorkerPool) Option

WithGCWorkerPoolInitializer returns option to set initializer of worker pool with specified worker number.

func WithID

func WithID(id *ID) Option

WithID returns option to set the default shard identifier.

func WithLogger

func WithLogger(l *logger.Logger) Option

WithLogger returns option to set Shard's logger.

func WithMetaBaseOptions

func WithMetaBaseOptions(opts ...meta.Option) Option

WithMetaBaseOptions returns option to set internal metabase options.

func WithMetricsWriter

func WithMetricsWriter(v MetricsWriter) Option

WithMetricsWriter returns option to specify storage of the shard's metrics.

func WithMode

func WithMode(v mode.Mode) Option

WithMode returns option to set shard's mode. Mode must be one of the predefined:

  • mode.ReadWrite;
  • mode.ReadOnly.

func WithPiloramaOptions

func WithPiloramaOptions(opts ...pilorama.Option) Option

WithPiloramaOptions returns option to set internal write cache options.

func WithRebuildWorkerLimiter added in v0.38.0

func WithRebuildWorkerLimiter(l RebuildWorkerLimiter) Option

WithRebuildWorkerLimiter return option to set concurrent workers count of storage rebuild operation.

func WithRefillMetabase

func WithRefillMetabase(v bool) Option

WithRefillMetabase returns option to set flag to refill the Metabase on Shard's initialization step.

func WithRefillMetabaseWorkersCount added in v0.39.0

func WithRefillMetabaseWorkersCount(v int) Option

WithRefillMetabaseWorkersCount returns option to set count of workers to refill the Metabase on Shard's initialization step.

func WithRemoverBatchSize

func WithRemoverBatchSize(sz int) Option

WithRemoverBatchSize returns option to set batch size of single removal operation.

func WithReportErrorFunc

func WithReportErrorFunc(f func(selfID string, message string, err error)) Option

WithReportErrorFunc returns option to specify callback for handling storage-related errors in the background workers.

func WithTombstoneSource

func WithTombstoneSource(v TombstoneSource) Option

WithTombstoneSource returns option to set TombstoneSource.

func WithWriteCache

func WithWriteCache(use bool) Option

WithWriteCache returns option to toggle write cache usage.

func WithWriteCacheMetrics added in v0.37.0

func WithWriteCacheMetrics(wcMetrics writecache.Metrics) Option

WithWriteCacheMetrics returns an option to set the metrics register used by the write cache.

func WithWriteCacheOptions

func WithWriteCacheOptions(opts []writecache.Option) Option

WithWriteCacheOptions returns option to set internal write cache options.

func WithZeroCountCallback added in v0.38.0

func WithZeroCountCallback(cb EmptyContainersCallback) Option

WithZeroCountCallback returns option to set zero-count containers callback.

func WithZeroSizeCallback added in v0.38.0

func WithZeroSizeCallback(cb EmptyContainersCallback) Option

WithZeroSizeCallback returns option to set zero-size containers callback.

type PutPrm

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

PutPrm groups the parameters of Put operation.

func (*PutPrm) SetObject

func (p *PutPrm) SetObject(obj *objectSDK.Object)

SetObject is a Put option to set object to save.

type PutRes

type PutRes struct{}

PutRes groups the resulting values of Put operation.

type RebuildWorkerLimiter added in v0.38.0

type RebuildWorkerLimiter interface {
	AcquireWorkSlot(ctx context.Context) error
	ReleaseWorkSlot()
}

type RngPrm

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

RngPrm groups the parameters of GetRange operation.

func (*RngPrm) SetAddress

func (p *RngPrm) SetAddress(addr oid.Address)

SetAddress is a Rng option to set the address of the requested object.

Option is required.

func (*RngPrm) SetIgnoreMeta

func (p *RngPrm) SetIgnoreMeta(ignore bool)

SetIgnoreMeta is a Get option try to fetch object from blobstor directly, without accessing metabase.

func (*RngPrm) SetRange

func (p *RngPrm) SetRange(off uint64, ln uint64)

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

type RngRes

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

RngRes groups the resulting values of GetRange operation.

func (RngRes) HasMeta

func (r RngRes) HasMeta() bool

HasMeta returns true if info about the object was found in the metabase.

func (RngRes) Object

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

Object returns the requested object part.

Instance payload contains the requested range of the original object.

type SealWriteCachePrm added in v0.38.0

type SealWriteCachePrm struct {
	IgnoreErrors bool
}

type SelectPrm

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

SelectPrm groups the parameters of Select operation.

func (*SelectPrm) SetContainerID

func (p *SelectPrm) SetContainerID(cnr cid.ID)

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

func (*SelectPrm) SetFilters

func (p *SelectPrm) SetFilters(fs objectSDK.SearchFilters)

SetFilters is a Select option to set the object filters.

type SelectRes

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

SelectRes groups the resulting values of Select operation.

func (SelectRes) AddressList

func (r SelectRes) AddressList() []oid.Address

AddressList returns list of addresses of the selected objects.

type Shard

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

Shard represents single shard of FrostFS Local Storage Engine.

func New

func New(opts ...Option) *Shard

New creates, initializes and returns new Shard instance.

func (*Shard) ClearErrorCounter added in v0.37.0

func (s *Shard) ClearErrorCounter()

func (*Shard) Close

func (s *Shard) Close() error

Close releases all Shard's components.

func (*Shard) ContainerCount added in v0.38.0

func (s *Shard) ContainerCount(ctx context.Context, prm ContainerCountPrm) (ContainerCountRes, error)

func (*Shard) ContainerSize

func (s *Shard) ContainerSize(prm ContainerSizePrm) (ContainerSizeRes, error)

func (*Shard) Delete

func (s *Shard) Delete(ctx context.Context, prm DeletePrm) (DeleteRes, error)

Delete removes data from the shard's metaBase and// blobStor.

func (*Shard) DeleteContainerCount added in v0.38.0

func (s *Shard) DeleteContainerCount(ctx context.Context, id cid.ID) error

func (*Shard) DeleteContainerSize added in v0.38.0

func (s *Shard) DeleteContainerSize(ctx context.Context, id cid.ID) error

func (*Shard) DeleteShardMetrics added in v0.37.0

func (s *Shard) DeleteShardMetrics()

func (*Shard) DumpInfo

func (s *Shard) DumpInfo() Info

DumpInfo returns information about the Shard.

func (*Shard) Exists

func (s *Shard) Exists(ctx context.Context, prm ExistsPrm) (ExistsRes, error)

Exists checks if object is presented in shard.

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

Returns an error of type apistatus.ObjectAlreadyRemoved if object has been marked as removed. Returns the object.ErrObjectIsExpired if the object is presented but already expired. Returns the ErrShardDisabled if the shard is disabled.

func (*Shard) FlushWriteCache

func (s *Shard) FlushWriteCache(ctx context.Context, p FlushWriteCachePrm) error

FlushWriteCache flushes all data from the write-cache.

func (*Shard) Get

func (s *Shard) Get(ctx context.Context, prm GetPrm) (GetRes, error)

Get reads an object from shard.

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

Returns an error of type apistatus.ObjectNotFound if the requested object is missing in shard. Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard. Returns the object.ErrObjectIsExpired if the object is presented but already expired. Returns the ErrShardDisabled if the shard is disabled.

func (*Shard) GetLocked added in v0.40.0

func (s *Shard) GetLocked(ctx context.Context, addr oid.Address) ([]oid.ID, error)

GetLocked return lock id's of the provided object. Not found object is considered as not locked. Requires healthy metabase, returns ErrDegradedMode otherwise.

func (*Shard) GetMode

func (s *Shard) GetMode() mode.Mode

GetMode returns mode of the shard.

func (*Shard) GetRange

func (s *Shard) GetRange(ctx context.Context, prm RngPrm) (RngRes, error)

GetRange reads part of an object from shard.

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

Returns ErrRangeOutOfBounds if the requested object range is out of bounds. Returns an error of type apistatus.ObjectNotFound if the requested object is missing. Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard. Returns the objectSDK.ErrObjectIsExpired if the object is presented but already expired. Returns the ErrShardDisabled if the shard is disabled.

func (*Shard) HandleDeletedLocks

func (s *Shard) HandleDeletedLocks(lockers []oid.Address)

HandleDeletedLocks unlocks all objects which were locked by lockers.

func (*Shard) HandleExpiredLocks

func (s *Shard) HandleExpiredLocks(ctx context.Context, epoch uint64, lockers []oid.Address)

HandleExpiredLocks unlocks all objects which were locked by lockers. If successful, marks lockers themselves as garbage.

func (*Shard) HandleExpiredTombstones

func (s *Shard) HandleExpiredTombstones(ctx context.Context, tss []meta.TombstonedObject)

HandleExpiredTombstones marks tombstones themselves as garbage and clears up corresponding graveyard records.

Does not modify tss.

func (*Shard) Head

func (s *Shard) Head(ctx context.Context, prm HeadPrm) (HeadRes, error)

Head reads header of the object from the shard.

Returns any error encountered.

Returns an error of type apistatus.ObjectNotFound if object is missing in Shard. Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard. Returns the object.ErrObjectIsExpired if the object is presented but already expired.

func (*Shard) ID

func (s *Shard) ID() *ID

ID returns Shard identifier.

func (*Shard) IncErrorCounter added in v0.37.0

func (s *Shard) IncErrorCounter()

func (*Shard) Inhume

func (s *Shard) Inhume(ctx context.Context, prm InhumePrm) (InhumeRes, error)

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

Allows inhuming non-locked objects only. Returns apistatus.ObjectLocked if at least one object is locked.

Returns ErrReadOnlyMode error if shard is in "read-only" mode.

func (*Shard) Init

func (s *Shard) Init(ctx context.Context) error

Init initializes all Shard's components.

func (*Shard) IsLocked

func (s *Shard) IsLocked(ctx context.Context, addr oid.Address) (bool, error)

IsLocked checks object locking relation of the provided object. Not found object is considered as not locked. Requires healthy metabase, returns ErrDegradedMode otherwise.

func (*Shard) List

func (s *Shard) List(ctx context.Context) (res SelectRes, err error)

List returns all objects physically stored in the Shard.

func (*Shard) ListContainers

func (s *Shard) ListContainers(ctx context.Context, _ ListContainersPrm) (ListContainersRes, error)

func (*Shard) ListWithCursor

func (s *Shard) ListWithCursor(ctx context.Context, prm ListWithCursorPrm) (ListWithCursorRes, error)

ListWithCursor lists physical objects available in shard starting from cursor. Includes regular, tombstone and storage group objects. Does not include inhumed objects. Use cursor value from response for consecutive requests.

Returns ErrEndOfListing if there are no more objects to return or count parameter set to zero.

func (*Shard) Lock

func (s *Shard) Lock(ctx context.Context, idCnr cid.ID, locker oid.ID, locked []oid.ID) error

Lock marks objects as locked with another object. All objects from the specified container.

Allows locking regular objects only (otherwise returns apistatus.LockNonRegularObject).

Locked list should be unique. Panics if it is empty.

func (*Shard) LogicalObjectsCount added in v0.37.0

func (s *Shard) LogicalObjectsCount(ctx context.Context) (uint64, error)

LogicalObjectsCount returns logical objects count.

func (*Shard) NeedRefillMetabase added in v0.37.0

func (s *Shard) NeedRefillMetabase() bool

NeedRefillMetabase returns true if metabase is needed to be refilled.

func (*Shard) NotificationChannel

func (s *Shard) NotificationChannel() chan<- Event

NotificationChannel returns channel for shard events.

func (*Shard) Open

func (s *Shard) Open(ctx context.Context) error

Open opens all Shard's components.

func (*Shard) PiloramaEnabled added in v0.38.0

func (s *Shard) PiloramaEnabled() bool

func (*Shard) Put

func (s *Shard) Put(ctx context.Context, prm PutPrm) (PutRes, error)

Put saves the object in shard.

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

Returns ErrReadOnlyMode error if shard is in "read-only" mode.

func (*Shard) Reload

func (s *Shard) Reload(ctx context.Context, opts ...Option) error

Reload reloads configuration portions that are necessary. If a config option is invalid, it logs an error and returns nil. If there was a problem with applying new configuration, an error is returned.

func (*Shard) SealWriteCache added in v0.38.0

func (s *Shard) SealWriteCache(ctx context.Context, p SealWriteCachePrm) error

SealWriteCache flushes all data from the write-cache and moves it to degraded read only mode.

func (*Shard) Select

func (s *Shard) Select(ctx context.Context, prm SelectPrm) (SelectRes, error)

Select selects the objects from shard that match select parameters.

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

func (*Shard) SetMode

func (s *Shard) SetMode(m mode.Mode) error

SetMode sets mode of the shard.

Returns any error encountered that did not allow setting shard mode.

func (*Shard) TreeAddByPath

func (s *Shard) TreeAddByPath(ctx context.Context, d pilorama.CIDDescriptor, treeID string, attr string, path []string, meta []pilorama.KeyValue) ([]pilorama.Move, error)

TreeAddByPath implements the pilorama.Forest interface.

func (*Shard) TreeApply

func (s *Shard) TreeApply(ctx context.Context, cnr cidSDK.ID, treeID string, m *pilorama.Move, backgroundSync bool) error

TreeApply implements the pilorama.Forest interface.

func (*Shard) TreeApplyStream added in v0.38.0

func (s *Shard) TreeApplyStream(ctx context.Context, cnr cidSDK.ID, treeID string, source <-chan *pilorama.Move) error

func (*Shard) TreeDrop

func (s *Shard) TreeDrop(ctx context.Context, cid cidSDK.ID, treeID string) error

TreeDrop implements the pilorama.Forest interface.

func (*Shard) TreeExists

func (s *Shard) TreeExists(ctx context.Context, cid cidSDK.ID, treeID string) (bool, error)

TreeExists implements the pilorama.Forest interface.

func (*Shard) TreeGetByPath

func (s *Shard) TreeGetByPath(ctx context.Context, cid cidSDK.ID, treeID string, attr string, path []string, latest bool) ([]pilorama.Node, error)

TreeGetByPath implements the pilorama.Forest interface.

func (*Shard) TreeGetChildren

func (s *Shard) TreeGetChildren(ctx context.Context, cid cidSDK.ID, treeID string, nodeID pilorama.Node) ([]pilorama.NodeInfo, error)

TreeGetChildren implements the pilorama.Forest interface.

func (*Shard) TreeGetMeta

func (s *Shard) TreeGetMeta(ctx context.Context, cid cidSDK.ID, treeID string, nodeID pilorama.Node) (pilorama.Meta, uint64, error)

TreeGetMeta implements the pilorama.Forest interface.

func (*Shard) TreeGetOpLog

func (s *Shard) TreeGetOpLog(ctx context.Context, cid cidSDK.ID, treeID string, height uint64) (pilorama.Move, error)

TreeGetOpLog implements the pilorama.Forest interface.

func (*Shard) TreeHeight

func (s *Shard) TreeHeight(ctx context.Context, cid cidSDK.ID, treeID string) (uint64, error)

func (*Shard) TreeLastSyncHeight

func (s *Shard) TreeLastSyncHeight(ctx context.Context, cid cidSDK.ID, treeID string) (uint64, error)

TreeLastSyncHeight implements the pilorama.Forest interface.

func (*Shard) TreeList

func (s *Shard) TreeList(ctx context.Context, cid cidSDK.ID) ([]string, error)

TreeList implements the pilorama.Forest interface.

func (*Shard) TreeListTrees added in v0.38.0

func (*Shard) TreeMove

func (s *Shard) TreeMove(ctx context.Context, d pilorama.CIDDescriptor, treeID string, m *pilorama.Move) (*pilorama.Move, error)

TreeMove implements the pilorama.Forest interface.

func (*Shard) TreeSortedByFilename added in v0.38.2

func (s *Shard) TreeSortedByFilename(ctx context.Context, cid cidSDK.ID, treeID string, nodeID pilorama.Node, last string, count int) ([]pilorama.NodeInfo, string, error)

TreeSortedByFilename implements the pilorama.Forest interface.

func (*Shard) TreeUpdateLastSyncHeight

func (s *Shard) TreeUpdateLastSyncHeight(ctx context.Context, cid cidSDK.ID, treeID string, height uint64) error

TreeUpdateLastSyncHeight implements the pilorama.Forest interface.

func (*Shard) UpdateID

func (s *Shard) UpdateID() (err error)

UpdateID reads shard ID saved in the metabase and updates it if it is missing.

type TombstoneSource

type TombstoneSource interface {
	// IsTombstoneAvailable must return boolean value that means
	// provided tombstone's presence in the FrostFS network at the
	// time of the passed epoch.
	IsTombstoneAvailable(ctx context.Context, addr oid.Address, epoch uint64) bool
}

TombstoneSource is an interface that checks tombstone status in the FrostFS network.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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