MCPcopy Create free account
hub / github.com/Azure/peerd / Cache

Interface Cache

pkg/cache/interface.go:6–18  ·  view source on GitHub ↗

Cache describes a cache of files.

Source from the content-addressed store, hash-verified

4
5// Cache describes a cache of files.
6type Cache interface {
7 // Size gets the size of the file.
8 Size(path string) (int64, bool)
9
10 // PutSize sets size of the file.
11 PutSize(path string, length int64) bool
12
13 // Exists checks if the given chunk of the file is already cached.
14 Exists(name string, offset int64) bool
15
16 // GetOrCreate gets the cached value if available, otherwise downloads the file.
17 GetOrCreate(name string, offset int64, count int, fetch func() ([]byte, error)) ([]byte, error)
18}
19
20var (
21 // FilesCacheMaxCost is the capacity of the files cache.

Callers 17

TestPutAndGetSizeFunction · 0.95
readFromStartFunction · 0.65
ExistsMethod · 0.65
GetOrCreateMethod · 0.65
FstatMethod · 0.65
ScannerFunction · 0.65
TestPutAndGetSizeFunction · 0.95
FstatMethod · 0.65
TestOpenNonP2pFunction · 0.65
TestExistsFunction · 0.95
OpenMethod · 0.65

Implementers 1

fileCachepkg/cache/filecache.go

Calls

no outgoing calls

Tested by

no test coverage detected