Documentation ¶
Overview ¶
Package limited implements the blobserver interface which limits the size of the underlying blobserver.Storage
Index ¶
- func LRUEvictPolicy(size int) lruPolicy
- type EvictPolicy
- type Storage
- func (sto Storage) Close() error
- func (sto Storage) EnumerateBlobs(ctx context.Context, dest chan<- blob.SizedRef, after string, limit int) error
- func (sto Storage) Fetch(ctx context.Context, br blob.Ref) (io.ReadCloser, uint32, error)
- func (sto Storage) ReceiveBlob(ctx context.Context, br blob.Ref, source io.Reader) (blob.SizedRef, error)
- func (sto Storage) RemoveBlobs(ctx context.Context, blobs []blob.Ref) error
- func (sto Storage) ResetStorageGeneration() error
- func (sto Storage) StatBlobs(ctx context.Context, blobs []blob.Ref, fn func(blob.SizedRef) error) error
- func (sto Storage) StorageGeneration() (initTime time.Time, random string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LRUEvictPolicy ¶
func LRUEvictPolicy(size int) lruPolicy
LRUEvictPolicy returns a simple LRU based eviction policy.
Types ¶
type EvictPolicy ¶
type EvictPolicy interface { // Add returns what has been evicted. Get(key string) Put(key string) (evicted string) Remove(key string) }
EvictPolicy represents a cache eviction policy
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a size limited storage.
func NewStorage ¶
func NewStorage(storage blobserver.Storage, size int) Storage
NewStorage wraps the given storage, evicting using LRU.
func NewStorageEvict ¶
func NewStorageEvict(storage blobserver.Storage, evictPolicy EvictPolicy) Storage
NewStorageEvict wraps the given storage, evicting using the given eviction policy.
Only the new elements added to the underlying storage is limited!
func (Storage) EnumerateBlobs ¶
func (Storage) ReceiveBlob ¶
func (Storage) RemoveBlobs ¶
func (Storage) ResetStorageGeneration ¶
Click to show internal directories.
Click to hide internal directories.