Documentation ¶
Overview ¶
Package stats defines a stats provider service, wrapping a cache & stats component calculation
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCacheMiss indicates a requested path isn't in the cache ErrCacheMiss = fmt.Errorf("stats: cache miss") // ErrNoCache indicates there is no cache ErrNoCache = fmt.Errorf("stats: no cache") // ErrCacheCorrupt indicates a faulty stats cache ErrCacheCorrupt = fmt.Errorf("stats: cache is corrupt") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // placing a stats object in the Cache will expire all caches with a lower // modTime, use a modTime of zero when no modTime is known PutStats(ctx context.Context, key string, sa *dataset.Stats) error // GetStats the stats component for a given key GetStats(ctx context.Context, key string) (sa *dataset.Stats, err error) }
Cache is a store of stats components Consumers of a cache must not rely on the cache for persistence Implementations are expected to maintain their own size bounding semantics internally Cache implementations must be safe for concurrent use, and must be nil-callable
func NewLocalCache ¶ added in v0.10.0
NewLocalCache creates a cache in a local directory. LocalCache is sensitive to added keys that match the qfs.PathKind of "local". When a stats component is added with a local filepath as it's key, LocalCache will record the status of that file, and return ErrCacheMiss if that filepath is altered on retrieval