Home Download Docs Code Community
import "perkeep/pkg/blobserver/proxycache"
Overview
Index

Overview ▾

Package proxycache registers the "proxycache" blobserver storage type, which uses a provided blobserver as a cache for a second origin blobserver.

If the provided maxCacheBytes is unspecified, the default is 512MB.

Example config:

      "/cache/": {
          "handler": "storage-proxycache",
          "handlerArgs": {
		  "origin": "/cloud-blobs/",
		  "cache": "/local-ssd/",
		  "maxCacheBytes": 536870912
          }
      },

Index

type Storage
    func New(maxBytes int64, cache, origin blobserver.Storage) *Storage
    func (sto *Storage) EnumerateBlobs(ctx context.Context, dest chan<- blob.SizedRef, after string, limit int) error
    func (sto *Storage) Fetch(ctx context.Context, b blob.Ref) (rc io.ReadCloser, size uint32, err error)
    func (sto *Storage) ReceiveBlob(ctx context.Context, br blob.Ref, src io.Reader) (blob.SizedRef, error)
    func (sto *Storage) RemoveBlobs(ctx context.Context, blobs []blob.Ref) error
    func (sto *Storage) StatBlobs(ctx context.Context, blobs []blob.Ref, fn func(blob.SizedRef) error) error
    func (sto *Storage) SubFetch(ctx context.Context, ref blob.Ref, offset, length int64) (io.ReadCloser, error)

Package files

proxycache.go

type Storage

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

Storage implements the "proxycache" blob storage.

func New

func New(maxBytes int64, cache, origin blobserver.Storage) *Storage

New returns a proxycache blob storage that reads from cache, then origin, populating cache as needed, up to a total of maxBytes.

func (*Storage) EnumerateBlobs

func (sto *Storage) EnumerateBlobs(ctx context.Context, dest chan<- blob.SizedRef, after string, limit int) error

func (*Storage) Fetch

func (sto *Storage) Fetch(ctx context.Context, b blob.Ref) (rc io.ReadCloser, size uint32, err error)

func (*Storage) ReceiveBlob

func (sto *Storage) ReceiveBlob(ctx context.Context, br blob.Ref, src io.Reader) (blob.SizedRef, error)

func (*Storage) RemoveBlobs

func (sto *Storage) RemoveBlobs(ctx context.Context, blobs []blob.Ref) error

func (*Storage) StatBlobs

func (sto *Storage) StatBlobs(ctx context.Context, blobs []blob.Ref, fn func(blob.SizedRef) error) error

func (*Storage) SubFetch

func (sto *Storage) SubFetch(ctx context.Context, ref blob.Ref, offset, length int64) (io.ReadCloser, error)
Website layout inspired by memcached.
Content by the authors.