meta

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

README

Meta layer

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

Move more methods into this package as more patterns emerge

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func LifeCycleFromBucket added in v0.6.1

func LifeCycleFromBucket(b Bucket) (lc LifeCycle)

Types

type CacheType

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

type Meta

type Meta struct {
	Client client.Client
	Logger *log.Logger
	Cache  MetaCache
}

func New

func New(logger *log.Logger, myCacheType CacheType) *Meta

func (*Meta) AddBucketForUser added in v0.6.1

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

func (*Meta) DeleteObjMapEntry added in v1.1.0

func (m *Meta) DeleteObjMapEntry(objMap *ObjMap) error

func (*Meta) DeleteObjectEntry added in v1.1.0

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

func (*Meta) GetAllObject added in v0.6.1

func (m *Meta) GetAllObject(bucketName string, objectName string) (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) GetCluster added in v1.1.0

func (m *Meta) GetCluster(fsid string, pool string) (cluster Cluster, 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 string, objectName string, willNeed bool) (object *Object, err error)

func (*Meta) GetObjectMap added in v0.6.1

func (m *Meta) GetObjectMap(bucketName, objectName string) (objMap *ObjMap, err error)

func (*Meta) GetObjectVersion added in v0.6.1

func (m *Meta) GetObjectVersion(bucketName, objectName, version 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) PutBucketToLifeCycle

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

func (*Meta) PutObjMapEntry added in v0.6.1

func (m *Meta) PutObjMapEntry(objMap *ObjMap) error

func (*Meta) PutObjectEntry added in v0.6.1

func (m *Meta) PutObjectEntry(object *Object) 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) ScanGarbageCollection added in v0.6.1

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

func (*Meta) ScanLifeCycle

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

func (*Meta) UpdateObjectAcl

func (m *Meta) UpdateObjectAcl(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