blobcache

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package blobcache keeps copies of stored objects on local disk, keyed by ref and verified on every read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is one store's blob directory. It is safe for concurrent use by several processes: entries are written next to their final name and renamed into place.

func Open

func Open(dir, storeID string, limit int64) (*Cache, error)

Open returns the cache of one store under dir. limit caps the cache in bytes when Sweep runs; 0 leaves it unbounded.

func (*Cache) Dir

func (c *Cache) Dir() string

Dir is the cache directory.

func (*Cache) Drop

func (c *Cache) Drop(ref *proto.Ref)

Drop removes the entry for ref.

func (*Cache) Get

func (c *Cache) Get(ref *proto.Ref) (*proto.Object, bool)

Get returns the cached object for ref after checking that it still hashes to it. A corrupt entry is removed.

func (*Cache) Put

func (c *Cache) Put(ref *proto.Ref, obj *proto.Object) error

Put stores the object under ref unless it is already there.

func (*Cache) Sweep

func (c *Cache) Sweep() (int, error)

Sweep removes the least recently used entries until the cache fits its limit and returns how many it removed.

Jump to

Keyboard shortcuts

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