meta

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

README

Meta layer

Storage metadata manipulation helper functions for YIG, including a cache layer for database, build on Redis.

Move more methods into this package as more patterns emerge

Documentation

Index

Constants

View Source
const (
	ENCRYPTION_KEY_LENGTH = 32 // 32 bytes for AES-"256"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheType

type CacheType int
const (
	NoCache CacheType = iota
	EnableCache
	SimpleCache
)

type Meta

type Meta struct {
	Client client.Client
	Cache  MetaCache
}

func New

func New(myCacheType CacheType) *Meta

func (*Meta) AddDeleteMarker

func (m *Meta) AddDeleteMarker(marker *Object) (err error)

func (*Meta) AppendObject

func (m *Meta) AppendObject(object *Object, isExist bool) error

func (*Meta) CreateFreezer

func (m *Meta) CreateFreezer(freezer *types.Freezer) error

func (*Meta) DeleteFreezer

func (m *Meta) DeleteFreezer(freezer *types.Freezer) (err error)

func (*Meta) DeleteMultipart

func (m *Meta) DeleteMultipart(multipart Multipart) (err error)

func (*Meta) DeleteObject

func (m *Meta) DeleteObject(object *Object) (err error)

func (*Meta) DeleteOldObject added in v1.3.5

func (m *Meta) DeleteOldObject(object *Object) (err error)

func (*Meta) DeleteSuspendedObject

func (m *Meta) DeleteSuspendedObject(object *Object) (err error)

func (*Meta) GetBucket

func (m *Meta) GetBucket(bucketName string, willNeed bool) (bucket *Bucket, err error)

Note the usage info got from this method is possibly not accurate because we don't invalid cache when updating usage. For accurate usage info, use `GetUsage()`

func (*Meta) GetBucketInfo

func (m *Meta) GetBucketInfo(bucketName string) (*Bucket, error)

func (*Meta) GetBucketLifeCycle

func (m *Meta) GetBucketLifeCycle(bucket Bucket) (lifeCycle *LifeCycle, err error)

func (*Meta) GetBuckets

func (m *Meta) GetBuckets() (buckets []Bucket, err error)

func (*Meta) GetClusters

func (m *Meta) GetClusters() (cluster []Cluster, err error)

func (*Meta) GetFreezer

func (m *Meta) GetFreezer(bucketName string, objectName string, version string) (freezer *types.Freezer, err error)

func (*Meta) GetFreezerStatus

func (m *Meta) GetFreezerStatus(bucketName string, objectName string, version string) (freezer *types.Freezer, err error)

func (*Meta) GetMultipart

func (m *Meta) GetMultipart(bucketName, objectName, uploadId string) (multipart Multipart, err error)

func (*Meta) GetObject

func (m *Meta) GetObject(bucketName, objectName, reqVersion string, willNeed bool) (object *Object, err error)

func (*Meta) GetUsage

func (m *Meta) GetUsage(bucketName string) (int64, error)

func (*Meta) GetUserBuckets

func (m *Meta) GetUserBuckets(userId string, willNeed bool) (buckets []string, err error)

func (*Meta) GetUserInfo

func (m *Meta) GetUserInfo(uid string) ([]string, error)

func (*Meta) MigrateObject

func (m *Meta) MigrateObject(object *Object) error

func (*Meta) PutBucketToLifeCycle

func (m *Meta) PutBucketToLifeCycle(bucket Bucket) error

func (*Meta) PutObject

func (m *Meta) PutObject(reqCtx RequestContext, object *Object, multipart *Multipart, updateUsage bool) error

func (*Meta) PutObjectPart

func (m *Meta) PutObjectPart(multipart Multipart, part Part) (err error)

func (*Meta) PutObjectToGarbageCollection

func (m *Meta) PutObjectToGarbageCollection(object *Object) error

Insert object to `garbageCollection` table

func (*Meta) RemoveBucketForUser added in v0.6.1

func (m *Meta) RemoveBucketForUser(bucketName string, userId string) (err error)

func (*Meta) RemoveBucketFromLifeCycle

func (m *Meta) RemoveBucketFromLifeCycle(bucket Bucket) error

func (*Meta) RemoveGarbageCollection added in v0.6.1

func (m *Meta) RemoveGarbageCollection(garbage GarbageCollection) error

func (*Meta) RemoveHotObject

func (m *Meta) RemoveHotObject(object *Object, tx Tx) error

func (*Meta) RenameObject

func (m *Meta) RenameObject(object *Object, sourceObject string) error

func (*Meta) ReplaceObjectMetas

func (m *Meta) ReplaceObjectMetas(object *Object) error

func (*Meta) ScanGarbageCollection added in v0.6.1

func (m *Meta) ScanGarbageCollection(limit int) ([]GarbageCollection, error)

func (*Meta) ScanLifeCycle

func (m *Meta) ScanLifeCycle(limit int, marker string) (result ScanLifeCycleResult, err error)

func (*Meta) UpdateFreezerDate

func (m *Meta) UpdateFreezerDate(freezer *types.Freezer) error

func (*Meta) UpdateGlacierObject

func (m *Meta) UpdateGlacierObject(reqCtx RequestContext, targetObject, sourceObject *Object, isFreezer bool, onlyTranStorageClass bool) (err error)

func (*Meta) UpdateObjectAcl

func (m *Meta) UpdateObjectAcl(object *Object) error

func (*Meta) UpdateObjectAttrs

func (m *Meta) UpdateObjectAttrs(object *Object) error

func (*Meta) UpdateUsage added in v0.6.1

func (m *Meta) UpdateUsage(bucketName string, size int64)

type MetaCache

type MetaCache interface {
	Get(table redis.RedisDatabase, key string,
		onCacheMiss func() (interface{}, error),
		unmarshaller func([]byte) (interface{}, error), willNeed bool) (value interface{}, err error)
	Remove(table redis.RedisDatabase, key string)
	GetCacheHitRatio() float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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