writecache

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrReadOnly is returned when Put/Write is performed in a read-only mode.
	ErrReadOnly = logicerr.New("write-cache is in read-only mode")
	// ErrNotInitialized is returned when write-cache is initializing.
	ErrNotInitialized = logicerr.New("write-cache is not initialized yet")
	// ErrBigObject is returned when object is too big to be placed in cache.
	ErrBigObject = errors.New("too big object")
	// ErrOutOfSpace is returned when there is no space left to put a new object.
	ErrOutOfSpace = errors.New("no space left in the write cache")
)

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(ctx context.Context, address oid.Address) (*objectSDK.Object, error)
	Head(context.Context, oid.Address) (*objectSDK.Object, error)
	// Delete removes object referenced by the given oid.Address from the
	// Cache. Returns any error encountered that prevented the object to be
	// removed.
	//
	// Returns apistatus.ObjectNotFound if object is missing in the Cache.
	// Returns ErrReadOnly if the Cache is currently in the read-only mode.
	Delete(context.Context, oid.Address) error
	Put(context.Context, common.PutPrm) (common.PutRes, error)
	SetMode(mode.Mode) error
	SetLogger(*logger.Logger)
	DumpInfo() Info
	Flush(context.Context, bool) error

	Init() error
	Open(ctx context.Context, readOnly bool) error
	Close() error
}

Cache represents write-cache for objects.

type Info

type Info struct {
	// Full path to the write-cache.
	Path string
}

Info groups the information about write-cache.

type MainStorage added in v0.37.0

type MainStorage interface {
	Compressor() *compression.Config
	Exists(context.Context, common.ExistsPrm) (common.ExistsRes, error)
	Put(context.Context, common.PutPrm) (common.PutRes, error)
}

MainStorage is the interface of the underlying storage of Cache implementations.

type Metabase added in v0.37.0

type Metabase interface {
	UpdateStorageID(meta.UpdateStorageIDPrm) (meta.UpdateStorageIDRes, error)
}

Metabase is the interface of the metabase used by Cache implementations.

type Metrics added in v0.37.0

type Metrics interface {
	Get(d time.Duration, success bool, st StorageType)
	Delete(d time.Duration, success bool, st StorageType)
	Put(d time.Duration, success bool, st StorageType)
	Flush(success bool, st StorageType)
	Evict(st StorageType)

	SetEstimateSize(db, fstree uint64)
	SetMode(m mode.Mode)
	SetActualCounters(db, fstree uint64)
	Close()
}

func DefaultMetrics added in v0.37.0

func DefaultMetrics() Metrics

type StorageType added in v0.37.0

type StorageType string
const (
	StorageTypeUndefined StorageType = "null"
	StorageTypeDB        StorageType = "db"
	StorageTypeFSTree    StorageType = "fstree"
)

func (StorageType) String added in v0.37.0

func (t StorageType) String() string

Directories

Path Synopsis
Package config provides the common configuration options for write cache implementations.
Package config provides the common configuration options for write cache implementations.

Jump to

Keyboard shortcuts

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