cache

package
v0.31.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAccessControlCacheLifetime is a default lifetime of entries in access' cache.
	DefaultAccessControlCacheLifetime = 1 * time.Minute
	// DefaultAccessControlCacheSize is a default maximum number of entries in access' cache.
	DefaultAccessControlCacheSize = 1e5
)
View Source
const (
	// DefaultAccessBoxCacheSize is a default maximum number of entries in cache.
	DefaultAccessBoxCacheSize = 100
	// DefaultAccessBoxCacheLifetime is a default lifetime of entries in cache.
	DefaultAccessBoxCacheLifetime = 10 * time.Minute
)
View Source
const (
	// DefaultBucketCacheSize is a default maximum number of entries in cache.
	DefaultBucketCacheSize = 1e3
	// DefaultBucketCacheLifetime is a default lifetime of entries in cache.
	DefaultBucketCacheLifetime = time.Minute
)
View Source
const (
	// DefaultFrostfsIDCacheSize is a default maximum number of entries in cache.
	DefaultFrostfsIDCacheSize = 1e4
	// DefaultFrostfsIDCacheLifetime is a default lifetime of entries in cache.
	DefaultFrostfsIDCacheLifetime = time.Minute
)
View Source
const (
	// DefaultListSessionCacheLifetime is a default lifetime of entries in cache of ListObjects.
	DefaultListSessionCacheLifetime = time.Second * 60
	// DefaultListSessionCacheSize is a default size of cache of ListObjects.
	DefaultListSessionCacheSize = 100
)
View Source
const (
	// DefaultObjectsNameCacheSize is a default maximum number of entries in cache.
	DefaultObjectsNameCacheSize = 1e4
	// DefaultObjectsNameCacheLifetime is a default lifetime of entries in cache.
	DefaultObjectsNameCacheLifetime = time.Minute
)
View Source
const (
	// DefaultObjectsCacheLifetime is a default lifetime of entries in objects' cache.
	DefaultObjectsCacheLifetime = time.Minute * 5
	// DefaultObjectsCacheSize is a default maximum number of entries in objects' cache.
	DefaultObjectsCacheSize = 1e6
)
View Source
const (
	// DefaultObjectsListCacheLifetime is a default lifetime of entries in cache of ListObjects.
	DefaultObjectsListCacheLifetime = time.Second * 60
	// DefaultObjectsListCacheSize is a default size of cache of ListObjects.
	DefaultObjectsListCacheSize = 1e5
)
View Source
const (
	// DefaultMorphPolicyCacheSize is a default maximum number of entries in cache.
	DefaultMorphPolicyCacheSize = 1e4
	// DefaultMorphPolicyCacheLifetime is a default lifetime of entries in cache.
	DefaultMorphPolicyCacheLifetime = time.Minute
)
View Source
const (
	// DefaultSystemCacheSize is a default maximum number of entries in cache.
	DefaultSystemCacheSize = 1e4
	// DefaultSystemCacheLifetime is a default lifetime of entries in cache.
	DefaultSystemCacheLifetime = 5 * time.Minute
)
View Source
const (
	DefaultNetworkInfoCacheLifetime = 1 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessBoxCache

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

AccessBoxCache stores an access box by its address.

func NewAccessBoxCache

func NewAccessBoxCache(config *Config) *AccessBoxCache

NewAccessBoxCache creates an object of AccessBoxCache.

func (*AccessBoxCache) Delete added in v0.29.0

func (o *AccessBoxCache) Delete(address oid.Address)

Delete removes an accessbox from cache.

func (*AccessBoxCache) Get

func (o *AccessBoxCache) Get(address oid.Address) *AccessBoxCacheValue

Get returns a cached accessbox.

func (*AccessBoxCache) Put

func (o *AccessBoxCache) Put(address oid.Address, box *accessbox.Box, attrs []object.Attribute) error

Put stores an accessbox to cache.

type AccessBoxCacheValue added in v0.29.0

type AccessBoxCacheValue struct {
	Box        *accessbox.Box
	Attributes []object.Attribute
	PutTime    time.Time
}

type AccessControlCache

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

AccessControlCache provides lru cache for objects.

func NewAccessControlCache

func NewAccessControlCache(config *Config) *AccessControlCache

NewAccessControlCache creates an object of AccessControlCache.

func (*AccessControlCache) Delete

func (o *AccessControlCache) Delete(owner user.ID, key string) bool

Delete deletes an object from cache.

func (*AccessControlCache) Get

func (o *AccessControlCache) Get(owner user.ID, key string) bool

Get returns true if such key exists.

func (*AccessControlCache) Put

func (o *AccessControlCache) Put(owner user.ID, key string) error

Put puts an item to cache.

type BucketCache

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

BucketCache contains cache with objects and the lifetime of cache entries.

func NewBucketCache

func NewBucketCache(config *Config) *BucketCache

NewBucketCache creates an object of BucketCache.

func (*BucketCache) Delete

func (o *BucketCache) Delete(bkt *data.BucketInfo) bool

Delete deletes an object from cache.

func (*BucketCache) Get

func (o *BucketCache) Get(ns, bktName string) *data.BucketInfo

Get returns a cached object.

func (*BucketCache) Put

func (o *BucketCache) Put(bkt *data.BucketInfo) error

Put puts an object to cache.

type Config

type Config struct {
	Size     int
	Lifetime time.Duration
	Logger   *zap.Logger
}

Config stores expiration params for cache.

func DefaultAccessBoxConfig

func DefaultAccessBoxConfig(logger *zap.Logger) *Config

DefaultAccessBoxConfig returns new default cache expiration values.

func DefaultAccessControlConfig

func DefaultAccessControlConfig(logger *zap.Logger) *Config

DefaultAccessControlConfig returns new default cache expiration values.

func DefaultBucketConfig

func DefaultBucketConfig(logger *zap.Logger) *Config

DefaultBucketConfig returns new default cache expiration values.

func DefaultFrostfsIDConfig added in v0.29.0

func DefaultFrostfsIDConfig(logger *zap.Logger) *Config

DefaultFrostfsIDConfig returns new default cache expiration values.

func DefaultListSessionConfig added in v0.29.0

func DefaultListSessionConfig(logger *zap.Logger) *Config

DefaultListSessionConfig returns new default cache expiration values.

func DefaultMorphPolicyConfig added in v0.29.0

func DefaultMorphPolicyConfig(logger *zap.Logger) *Config

DefaultMorphPolicyConfig returns new default cache expiration values.

func DefaultObjectsConfig

func DefaultObjectsConfig(logger *zap.Logger) *Config

DefaultObjectsConfig returns new default cache expiration values.

func DefaultObjectsListConfig

func DefaultObjectsListConfig(logger *zap.Logger) *Config

DefaultObjectsListConfig returns new default cache expiration values.

func DefaultObjectsNameConfig

func DefaultObjectsNameConfig(logger *zap.Logger) *Config

DefaultObjectsNameConfig returns new default cache expiration values.

func DefaultSystemConfig

func DefaultSystemConfig(logger *zap.Logger) *Config

DefaultSystemConfig returns new default cache expiration values.

type FrostfsIDCache added in v0.29.0

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

FrostfsIDCache provides lru cache for frostfsid contract.

func NewFrostfsIDCache added in v0.29.0

func NewFrostfsIDCache(config *Config) *FrostfsIDCache

NewFrostfsIDCache creates an object of FrostfsIDCache.

func (*FrostfsIDCache) GetSubject added in v0.29.0

func (c *FrostfsIDCache) GetSubject(key util.Uint160) *client.SubjectExtended

GetSubject returns a cached client.SubjectExtended. Returns nil if value is missing.

func (*FrostfsIDCache) GetUserKey added in v0.29.0

func (c *FrostfsIDCache) GetUserKey(ns, name string) *keys.PublicKey

GetUserKey returns a cached *keys.PublicKey. Returns nil if value is missing.

func (*FrostfsIDCache) PutSubject added in v0.29.0

func (c *FrostfsIDCache) PutSubject(key util.Uint160, subject *client.SubjectExtended) error

PutSubject puts a client.SubjectExtended to cache.

func (*FrostfsIDCache) PutUserKey added in v0.29.0

func (c *FrostfsIDCache) PutUserKey(ns, name string, userKey *keys.PublicKey) error

PutUserKey puts a client.SubjectExtended to cache.

type ListSessionCache added in v0.29.0

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

ListSessionCache contains cache for list session (during pagination).

func NewListSessionCache added in v0.29.0

func NewListSessionCache(config *Config) *ListSessionCache

NewListSessionCache is a constructor which creates an object of ListObjectsCache with the given lifetime of entries.

func (*ListSessionCache) DeleteListSession added in v0.29.0

func (l *ListSessionCache) DeleteListSession(key ListSessionKey)

DeleteListSession removes key from cache.

func (*ListSessionCache) GetListSession added in v0.29.0

func (l *ListSessionCache) GetListSession(key ListSessionKey) *data.ListSession

GetListSession returns a list of ObjectInfo.

func (*ListSessionCache) PutListSession added in v0.29.0

func (l *ListSessionCache) PutListSession(key ListSessionKey, session *data.ListSession) error

PutListSession puts a list of object versions to cache.

type ListSessionKey added in v0.29.0

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

ListSessionKey is a key to find a ListSessionCache's entry.

func CreateListSessionCacheKey added in v0.29.0

func CreateListSessionCacheKey(cnr cid.ID, prefix, token string) ListSessionKey

CreateListSessionCacheKey returns ListSessionKey with the given CID, prefix and token.

func (*ListSessionKey) String added in v0.29.0

func (k *ListSessionKey) String() string

type MorphPolicyCache added in v0.29.0

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

MorphPolicyCache provides lru cache for listing policies stored in policy contract.

func NewMorphPolicyCache added in v0.29.0

func NewMorphPolicyCache(config *Config) *MorphPolicyCache

NewMorphPolicyCache creates an object of MorphPolicyCache.

func (*MorphPolicyCache) Delete added in v0.29.0

func (o *MorphPolicyCache) Delete(key MorphPolicyCacheKey) bool

Delete deletes an object from cache.

func (*MorphPolicyCache) Get added in v0.29.0

Get returns a cached object. Returns nil if value is missing.

func (*MorphPolicyCache) Put added in v0.29.0

func (o *MorphPolicyCache) Put(key MorphPolicyCacheKey, list []*chain.Chain) error

Put puts an object to cache.

type MorphPolicyCacheKey added in v0.29.0

type MorphPolicyCacheKey struct {
	Target engine.Target
	Name   chain.Name
}

type NetworkInfoCache added in v0.31.0

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

NetworkInfoCache provides cache for network info.

func NewNetworkInfoCache added in v0.31.0

func NewNetworkInfoCache(config *NetworkInfoCacheConfig) *NetworkInfoCache

NewNetworkInfoCache creates an object of NetworkInfoCache.

func (*NetworkInfoCache) Get added in v0.31.0

func (*NetworkInfoCache) Put added in v0.31.0

type NetworkInfoCacheConfig added in v0.31.0

type NetworkInfoCacheConfig struct {
	Lifetime time.Duration
	Logger   *zap.Logger
}

NetworkInfoCacheConfig stores expiration params for cache.

func DefaultNetworkInfoConfig added in v0.31.0

func DefaultNetworkInfoConfig(logger *zap.Logger) *NetworkInfoCacheConfig

DefaultNetworkInfoConfig returns new default cache expiration values.

type ObjectsCache

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

ObjectsCache provides lru cache for objects.

func New

func New(config *Config) *ObjectsCache

New creates an object of ObjectHeadersCache.

func (*ObjectsCache) Delete

func (o *ObjectsCache) Delete(address oid.Address) bool

Delete deletes an object from cache.

func (*ObjectsCache) GetObject

func (o *ObjectsCache) GetObject(address oid.Address) *data.ExtendedObjectInfo

GetObject returns a cached object info.

func (*ObjectsCache) PutObject

func (o *ObjectsCache) PutObject(obj *data.ExtendedObjectInfo) error

PutObject puts an object info to cache.

type ObjectsListCache

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

ObjectsListCache contains cache for ListObjects and ListObjectVersions.

func NewObjectsListCache

func NewObjectsListCache(config *Config) *ObjectsListCache

NewObjectsListCache is a constructor which creates an object of ListObjectsCache with the given lifetime of entries.

func (*ObjectsListCache) CleanCacheEntriesContainingObject

func (l *ObjectsListCache) CleanCacheEntriesContainingObject(objectName string, cnr cid.ID)

CleanCacheEntriesContainingObject deletes entries containing specified object.

func (*ObjectsListCache) GetVersions

func (l *ObjectsListCache) GetVersions(key ObjectsListKey) []*data.NodeVersion

GetVersions returns a list of ObjectInfo.

func (*ObjectsListCache) PutVersions

func (l *ObjectsListCache) PutVersions(key ObjectsListKey, versions []*data.NodeVersion) error

PutVersions puts a list of object versions to cache.

type ObjectsListKey

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

ObjectsListKey is a key to find a ObjectsListCache's entry.

func CreateObjectsListCacheKey

func CreateObjectsListCacheKey(cnr cid.ID, prefix string, latestOnly bool) ObjectsListKey

CreateObjectsListCacheKey returns ObjectsListKey with the given CID, prefix and latestOnly flag.

func (*ObjectsListKey) String

func (k *ObjectsListKey) String() string

type ObjectsNameCache

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

ObjectsNameCache provides lru cache for objects. This cache contains mapping nice names to object addresses. Key is bucketName+objectName.

func NewObjectsNameCache

func NewObjectsNameCache(config *Config) *ObjectsNameCache

NewObjectsNameCache creates an object of ObjectsNameCache.

func (*ObjectsNameCache) Delete

func (o *ObjectsNameCache) Delete(key string) bool

Delete deletes an object from cache.

func (*ObjectsNameCache) Get

func (o *ObjectsNameCache) Get(key string) *oid.Address

Get returns a cached object. Returns nil if value is missing.

func (*ObjectsNameCache) Put

func (o *ObjectsNameCache) Put(key string, address oid.Address) error

Put puts an object to cache.

type SystemCache

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

SystemCache provides lru cache for objects. This cache contains "system" objects (bucket versioning settings, tagging object etc.). Key is bucketName+systemFilePath.

func NewSystemCache

func NewSystemCache(config *Config) *SystemCache

NewSystemCache creates an object of SystemCache.

func (*SystemCache) Delete

func (o *SystemCache) Delete(key string) bool

Delete deletes an object from cache.

func (*SystemCache) GetCORS

func (o *SystemCache) GetCORS(key string) *data.CORSConfiguration

func (*SystemCache) GetLifecycleConfiguration added in v0.31.0

func (o *SystemCache) GetLifecycleConfiguration(key string) *data.LifecycleConfiguration

func (*SystemCache) GetLockInfo

func (o *SystemCache) GetLockInfo(key string) *data.LockInfo

GetLockInfo returns a cached object.

func (*SystemCache) GetObject

func (o *SystemCache) GetObject(key string) *data.ObjectInfo

GetObject returns a cached object.

func (*SystemCache) GetSettings

func (o *SystemCache) GetSettings(key string) *data.BucketSettings

func (*SystemCache) GetTagging

func (o *SystemCache) GetTagging(key string) map[string]string

GetTagging returns tags of a bucket or an object.

func (*SystemCache) PutCORS

func (o *SystemCache) PutCORS(key string, obj *data.CORSConfiguration) error

func (*SystemCache) PutLifecycleConfiguration added in v0.31.0

func (o *SystemCache) PutLifecycleConfiguration(key string, obj *data.LifecycleConfiguration) error

func (*SystemCache) PutLockInfo

func (o *SystemCache) PutLockInfo(key string, lockInfo *data.LockInfo) error

PutLockInfo puts an object to cache.

func (*SystemCache) PutObject

func (o *SystemCache) PutObject(key string, obj *data.ObjectInfo) error

PutObject puts an object to cache.

func (*SystemCache) PutSettings

func (o *SystemCache) PutSettings(key string, settings *data.BucketSettings) error

func (*SystemCache) PutTagging

func (o *SystemCache) PutTagging(key string, tagSet map[string]string) error

PutTagging puts tags of a bucket or an object.

Jump to

Keyboard shortcuts

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