objectstorage

package
v2.32.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound means that given key is not present in the object storage.
	ErrKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type ObjectStorage

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

ObjectStorage is an ObjectStorageIface implementation using GCP storage.

func (*ObjectStorage) Delete

func (o *ObjectStorage) Delete(ctx context.Context, key string) error

Delete queues delete operation from object storage.

func (*ObjectStorage) Get

Get gets object from object storage.

func (*ObjectStorage) KeyPrefix

func (o *ObjectStorage) KeyPrefix() string

KeyPrefix getter.

func (*ObjectStorage) List

func (o *ObjectStorage) List(ctx context.Context, prefix string) (string, error)

List lists object storage.

func (*ObjectStorage) Put

func (o *ObjectStorage) Put(
	_ context.Context,
	key string,
	data []byte,
	timestamp int64,
	ttl int64,
) error

Put queues put operation to object storage.

func (*ObjectStorage) SetContextWithCancel

func (o *ObjectStorage) SetContextWithCancel(ctx context.Context, cancel context.CancelFunc)

SetContextWithCancel sets long-running context and cancel function.

func (*ObjectStorage) Start

func (o *ObjectStorage) Start(ctx context.Context) error

Start starts a goroutine which performs operations on object storage.

func (*ObjectStorage) Stop

func (o *ObjectStorage) Stop(_ context.Context) error

Stop kills the goroutine started in Start().

type ObjectStorageBackedDMap

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

ObjectStorageBackedDMap is a wrapper around olric.DMap with a second layer persistent storage.

func NewPersistentDMap

func NewPersistentDMap(
	dmap olric.DMap,
	defaultTTL time.Duration,
	backingStorage ObjectStorageIface,
	prometheusRegistry *prometheus.Registry,
	getDistCacheLabels func() (prometheus.Labels, bool),
) (*ObjectStorageBackedDMap, error)

NewPersistentDMap returns new persistent dmap.

func (*ObjectStorageBackedDMap) Delete

func (o *ObjectStorageBackedDMap) Delete(ctx context.Context, keys ...string) (int, error)

Delete deletes keys from in-memory and backed storage.

func (*ObjectStorageBackedDMap) Destroy

func (o *ObjectStorageBackedDMap) Destroy(ctx context.Context) error

Destroy destroys persistent dmap.

func (*ObjectStorageBackedDMap) Expire

func (o *ObjectStorageBackedDMap) Expire(ctx context.Context, key string, timeout time.Duration) error

Expire deletes key from backing storage and expires it in in-memory storage.

func (*ObjectStorageBackedDMap) Function

func (o *ObjectStorageBackedDMap) Function(ctx context.Context, label string, function string, arg []byte) ([]byte, error)

Function executes function on dmap.

func (*ObjectStorageBackedDMap) Get

Get tries to get key from in-memory storage and then from backing storage if that fails.

func (*ObjectStorageBackedDMap) Lock

Lock locks dmap.

func (*ObjectStorageBackedDMap) LockWithTimeout

func (o *ObjectStorageBackedDMap) LockWithTimeout(ctx context.Context, key string, timeout time.Duration, deadline time.Duration) (olric.LockContext, error)

LockWithTimeout locks dmap with timeout.

func (*ObjectStorageBackedDMap) Name

func (o *ObjectStorageBackedDMap) Name() string

Name of the dmap.

func (*ObjectStorageBackedDMap) Put

func (o *ObjectStorageBackedDMap) Put(
	ctx context.Context,
	key string,
	value interface{},
	options ...olric.PutOption,
) (*olric.PutConfig, error)

Put puts k/v pair to in-memory and backing storage.

type ObjectStorageIface

type ObjectStorageIface interface {
	KeyPrefix() string
	SetContextWithCancel(ctx context.Context, cancel context.CancelFunc)
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Put(ctx context.Context, key string, data []byte, timestamp, ttl int64) error
	Get(ctx context.Context, key string) (olricstorage.Entry, error)
	Delete(ctx context.Context, key string) error
	List(ctx context.Context, prefix string) (string, error)
}

ObjectStorageIface is an abstract over persistent storage for Olric DMap.

func Provide

func Provide(in ProvideParams) (ObjectStorageIface, error)

Provide ObjectStorage.

type Operation

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

Operation executed on object storage.

type PersistentEntry

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

PersistentEntry is an implementation of Olric entry used for persistent storage.

func (*PersistentEntry) Decode

func (p *PersistentEntry) Decode(buf []byte)

Decode decodes entry.

func (*PersistentEntry) Encode

func (p *PersistentEntry) Encode() []byte

Encode encodes entry.

func (*PersistentEntry) Key

func (p *PersistentEntry) Key() string

Key is a key getter.

func (*PersistentEntry) LastAccess

func (p *PersistentEntry) LastAccess() int64

LastAccess is a last access getter.

func (*PersistentEntry) SetKey

func (p *PersistentEntry) SetKey(s string)

SetKey is a key setter.

func (*PersistentEntry) SetLastAccess

func (p *PersistentEntry) SetLastAccess(i int64)

SetLastAccess is a last access setter.

func (*PersistentEntry) SetTTL

func (p *PersistentEntry) SetTTL(i int64)

SetTTL is a ttl setter.

func (*PersistentEntry) SetTimestamp

func (p *PersistentEntry) SetTimestamp(i int64)

SetTimestamp is a timestamp setter.

func (*PersistentEntry) SetValue

func (p *PersistentEntry) SetValue(bytes []byte)

SetValue is a value setter.

func (*PersistentEntry) TTL

func (p *PersistentEntry) TTL() int64

TTL is a ttl getter.

func (*PersistentEntry) Timestamp

func (p *PersistentEntry) Timestamp() int64

Timestamp is a timestamp getter.

func (*PersistentEntry) Value

func (p *PersistentEntry) Value() []byte

Value is a value getter.

type ProvideParams

type ProvideParams struct {
	fx.In

	AgentInfo    *agentinfo.AgentInfo
	Lifecycle    fx.Lifecycle
	Unmarshaller config.Unmarshaller
}

ProvideParams for object storage.

Directories

Path Synopsis
+kubebuilder:validation:Optional
+kubebuilder:validation:Optional

Jump to

Keyboard shortcuts

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