tombstone

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpirationChecker

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

ExpirationChecker is a tombstone source wrapper. It checks tombstones presence via tombstone source, caches it checks its expiration.

Must be created via NewChecker function. `var` and `ExpirationChecker{}` declarations leads to undefined behaviour and may lead to panics.

func NewChecker

func NewChecker(oo ...Option) *ExpirationChecker

NewChecker creates, initializes and returns tombstone ExpirationChecker. The returned structure is ready to use.

Panics if any of the provided options does not allow constructing a valid tombstone ExpirationChecker.

func (*ExpirationChecker) IsTombstoneAvailable

func (g *ExpirationChecker) IsTombstoneAvailable(ctx context.Context, a oid.Address, epoch uint64) bool

IsTombstoneAvailable checks the tombstone presence in the system in the following order:

  • 1. Local LRU cache;
  • 2. Tombstone source.

If a tombstone was successfully fetched (regardless of its expiration) it is cached in the LRU cache.

type Option

type Option func(*cfg)

Option is an option of ExpirationChecker's constructor.

func WithCacheSize

func WithCacheSize(v int) Option

WithCacheSize returns an option to specify LRU cache size.

func WithLogger

func WithLogger(v *logger.Logger) Option

WithLogger returns an option to specify logger.

func WithTombstoneSource

func WithTombstoneSource(v Source) Option

WithTombstoneSource returns an option to specify tombstone source.

type Source

type Source interface {
	// Tombstone must return tombstone from the source it was
	// configured to fetch from and any error that appeared during
	// fetching process.
	//
	// Tombstone MUST return (nil, nil) if requested tombstone is
	// missing in the storage for the provided epoch.
	Tombstone(ctx context.Context, a oid.Address, epoch uint64) (*object.Object, error)
}

Source is a tombstone source interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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