Versions in this module Expand all Collapse all v0 v0.1.0 Sep 17, 2025 Changes in this version + const OperationBlob + const OperationManifest + var ErrCacheCorrupted = errors.New("cache entry is corrupted") + var ErrCacheExpired = errors.New("cache entry has expired") + var ErrCacheFull = errors.New("cache is full") + var ErrCacheInvalidated = errors.New("cache entry has been invalidated") + func LogCacheHit(ctx context.Context, logger *Logger, operation Operation, size int64) + func LogCacheMiss(ctx context.Context, logger *Logger, operation Operation, reason string) + func LogCacheOperation(ctx context.Context, logger *Logger, operation Operation, ...) + func LogCleanup(ctx context.Context, logger *Logger, operation string, entriesRemoved int, ...) + func LogEviction(ctx context.Context, logger *Logger, key string, size int64, reason string) + func LogPerformanceMetrics(ctx context.Context, logger *Logger, metrics *MetricsSnapshot) + func NewManifestCache(storage *Storage, manager ConfigProvider) *manifestCache + func NewTagCache(storage *Storage, config TagResolverConfig) *tagCache + type BlobCache interface + DeleteBlob func(ctx context.Context, digest string) error + GetBlob func(ctx context.Context, digest string) (io.ReadCloser, error) + HasBlob func(ctx context.Context, digest string) (bool, error) + PutBlob func(ctx context.Context, digest string, reader io.Reader) error + func NewBlobCache(storage *Storage, defaultTTL time.Duration) (BlobCache, error) + type Cache interface + Clear func(ctx context.Context) error + Delete func(ctx context.Context, key string) error + Get func(ctx context.Context, key string) (*Entry, error) + Put func(ctx context.Context, key string, entry *Entry) error + Size func(ctx context.Context) (int64, error) + type CompositeEviction struct + func NewCompositeEviction(strategies []EvictionStrategy, priorities []int) *CompositeEviction + func (c *CompositeEviction) OnAccess(entry *Entry) + func (c *CompositeEviction) OnAdd(entry *Entry) + func (c *CompositeEviction) OnRemove(entry *Entry) + func (c *CompositeEviction) SelectForEviction(entries map[string]*Entry) []string + type Config struct + DefaultTTL time.Duration + MaxSizeBytes int64 + func (c *Config) SetDefaults() + func (c *Config) Validate() error + type ConfigProvider interface + Config func() Config + type Coordinator struct + func NewCoordinator(ctx context.Context, config Config, fs *billyfs.FS, cachePath string, ...) (*Coordinator, error) + func (cm *Coordinator) Clear(ctx context.Context) error + func (cm *Coordinator) Close() error + func (cm *Coordinator) Config() Config + func (cm *Coordinator) GetBlob(ctx context.Context, digest string) (io.ReadCloser, error) + func (cm *Coordinator) GetManifest(ctx context.Context, digest string) (*ocispec.Manifest, error) + func (cm *Coordinator) GetMetrics() *DetailedMetrics + func (cm *Coordinator) GetStats() Stats + func (cm *Coordinator) PutBlob(ctx context.Context, digest string, reader io.Reader) error + func (cm *Coordinator) PutManifest(ctx context.Context, digest string, manifest *ocispec.Manifest) error + func (cm *Coordinator) Size(ctx context.Context) (int64, error) + type DebugInfo struct + CacheStats Stats + Config Config + IndexStats IndexStats + Integrity IntegrityReport + Metrics MetricsSnapshot + StorageInfo StorageDebugInfo + Timestamp time.Time + TopEntries []EntryInfo + type DebugTools struct + func NewDebugTools(coordinator *Coordinator) *DebugTools + func (dt *DebugTools) ClearExpiredEntries(ctx context.Context) (int, error) + func (dt *DebugTools) CollectDebugInfo(ctx context.Context) (*DebugInfo, error) + func (dt *DebugTools) ExportDebugInfo(ctx context.Context, outputPath string) error + func (dt *DebugTools) GetCacheContents(ctx context.Context) ([]EntryInfo, error) + func (dt *DebugTools) RepairIntegrity(ctx context.Context) (*IntegrityReport, error) + func (dt *DebugTools) TriggerCleanup(ctx context.Context) error + func (dt *DebugTools) ValidateAllDigests(ctx context.Context) (int, []string, error) + type DetailedMetrics struct + func NewDetailedMetrics() *DetailedMetrics + func (m *DetailedMetrics) GetSnapshot() MetricsSnapshot + func (m *DetailedMetrics) RecordDelete(bytesRemoved int64) + func (m *DetailedMetrics) RecordError() + func (m *DetailedMetrics) RecordEviction(bytesEvicted int64) + func (m *DetailedMetrics) RecordHit(operationType string, bytesServed int64) + func (m *DetailedMetrics) RecordLatency(operation string, duration time.Duration) + func (m *DetailedMetrics) RecordMiss(operationType string, bytesDownloaded int64) + func (m *DetailedMetrics) RecordPut(operationType string, bytesStored int64) + func (m *DetailedMetrics) RecordTagResolution() + func (m *DetailedMetrics) Reset() + type DirInfo struct + FileCount int + Path string + TotalSize int64 + type Entry struct + AccessCount int64 + AccessedAt time.Time + CreatedAt time.Time + Data []byte + Key string + Metadata map[string]string + TTL time.Duration + func (e *Entry) IsExpired() bool + func (e *Entry) Size() int64 + type EntryInfo struct + AccessCount int64 + AccessedAt time.Time + CreatedAt time.Time + FilePath string + IsExpired bool + Key string + Size int64 + TTL time.Duration + Type string + type EvictionStrategy interface + OnAccess func(entry *Entry) + OnAdd func(entry *Entry) + OnRemove func(entry *Entry) + SelectForEviction func(entries map[string]*Entry) []string + type Index struct + func NewIndex(indexPath string, maxEntries int) *Index + func (idx *Index) Cleanup(ctx context.Context, forceCompact bool) error + func (idx *Index) Compact() error + func (idx *Index) Delete(key string) error + func (idx *Index) ExpiredKeys() []string + func (idx *Index) Get(key string) (*IndexEntry, bool) + func (idx *Index) Keys(filter func(*IndexEntry) bool) []string + func (idx *Index) Load(ctx context.Context) error + func (idx *Index) NewIterator(filter func(*IndexEntry) bool) *Iterator + func (idx *Index) Persist() error + func (idx *Index) Put(key string, entry *IndexEntry) error + func (idx *Index) Size() int + func (idx *Index) Stats() IndexStats + type IndexEntry struct + AccessCount int64 + AccessedAt time.Time + CreatedAt time.Time + FilePath string + Key string + Metadata map[string]string + Size int64 + TTL time.Duration + func (ie *IndexEntry) IsExpired() bool + type IndexStats struct + AverageAccessCount float64 + ExpiredEntries int + LastCompaction time.Time + TotalEntries int + TotalSize int64 + type IntegrityReport struct + CheckDuration time.Duration + CorruptedEntries []string + InvalidDigests []string + IsHealthy bool + MissingFiles []string + TotalEntries int + type Iterator struct + func (it *Iterator) Close() + func (it *Iterator) Entry() *IndexEntry + func (it *Iterator) Key() string + func (it *Iterator) Next() bool + type LRUEviction struct + func NewLRUEviction() *LRUEviction + func (l *LRUEviction) OnAccess(entry *Entry) + func (l *LRUEviction) OnAdd(entry *Entry) + func (l *LRUEviction) OnRemove(entry *Entry) + func (l *LRUEviction) SelectForEviction(entries map[string]*Entry) []string + type LogConfig struct + EnableCacheOperations bool + EnableCallerInfo bool + EnablePerformanceLogging bool + Level LogLevel + func DefaultLogConfig() LogConfig + type LogLevel int + const LogLevelDebug + const LogLevelError + const LogLevelInfo + const LogLevelWarn + func ParseLogLevel(level string) (LogLevel, error) + type Logger struct + func NewLogger(config LogConfig) *Logger + func NewNopLogger() *Logger + func (l *Logger) Debug(ctx context.Context, msg string, args ...any) + func (l *Logger) Error(ctx context.Context, msg string, args ...any) + func (l *Logger) Info(ctx context.Context, msg string, args ...any) + func (l *Logger) Warn(ctx context.Context, msg string, args ...any) + func (l *Logger) With(args ...any) *Logger + func (l *Logger) WithDigest(digest string) *Logger + func (l *Logger) WithDuration(duration time.Duration) *Logger + func (l *Logger) WithOperation(operation string) *Logger + func (l *Logger) WithSize(size int64) *Logger + type ManifestCache interface + GetManifest func(ctx context.Context, digest string) (*ocispec.Manifest, error) + HasManifest func(ctx context.Context, digest string) (bool, error) + PutManifest func(ctx context.Context, digest string, manifest *ocispec.Manifest) error + ValidateManifest func(ctx context.Context, reference, digest string) (bool, error) + type MetricsSnapshot struct + AverageDeleteLatency time.Duration + AverageGetLatency time.Duration + AveragePutLatency time.Duration + BandwidthSaved int64 + BlobGets int64 + BlobPuts int64 + BytesDownloaded int64 + BytesRetrieved int64 + BytesServed int64 + BytesStored int64 + DeleteLatencySamples int + EntriesStored int64 + Errors int64 + Evictions int64 + GetLatencySamples int + HitRate float64 + Hits int64 + ManifestGets int64 + ManifestPuts int64 + Misses int64 + NetworkRequests int64 + PeakBytesStored int64 + PeakEntriesStored int64 + PeakHitRate float64 + PutLatencySamples int + TagResolutions int64 + TimeSinceLastError time.Duration + TimeSinceLastEviction time.Duration + TimeSinceLastHit time.Duration + TimeSinceLastMiss time.Duration + Uptime time.Duration + type Operation string + const OpCleanupExpired + const OpDeleteEntry + const OpEvictEntry + const OpGetBlob + const OpGetManifest + const OpPutBlob + const OpPutManifest + const OpValidateDigest + type SizeEviction struct + func NewSizeEviction(maxSizeBytes int64) *SizeEviction + func (s *SizeEviction) OnAccess(entry *Entry) + func (s *SizeEviction) OnAdd(entry *Entry) + func (s *SizeEviction) OnRemove(entry *Entry) + func (s *SizeEviction) SelectForEviction(entries map[string]*Entry) []string + type Stats struct + AverageAccessCount float64 + Errors int64 + Evictions int64 + ExpiredEntries int + HitRate float64 + LastCompaction time.Time + MaxSize int64 + TotalEntries int + TotalSize int64 + type Storage struct + func NewStorage(fs *billyfs.FS, rootPath string) (*Storage, error) + func (s *Storage) CleanupTempFiles(ctx context.Context) error + func (s *Storage) Exists(ctx context.Context, path string) (bool, error) + func (s *Storage) ListFiles(ctx context.Context, dirPath string) ([]string, error) + func (s *Storage) NewStreamWriter(ctx context.Context, path string) (*StreamWriter, error) + func (s *Storage) ReadWithIntegrity(ctx context.Context, path string) ([]byte, error) + func (s *Storage) Remove(ctx context.Context, path string) error + func (s *Storage) Size(ctx context.Context) (int64, error) + func (s *Storage) WriteAtomically(ctx context.Context, path string, data []byte) error + type StorageDebugInfo struct + CachePath string + Subdirectories []DirInfo + TotalFiles int + TotalSize int64 + type StreamWriter struct + func (sw *StreamWriter) Close() error + func (sw *StreamWriter) Size() int64 + func (sw *StreamWriter) Write(data []byte) (int, error) + type TTLEviction struct + func NewTTLEviction() *TTLEviction + func (t *TTLEviction) OnAccess(entry *Entry) + func (t *TTLEviction) OnAdd(entry *Entry) + func (t *TTLEviction) OnRemove(entry *Entry) + func (t *TTLEviction) SelectForEviction(entries map[string]*Entry) []string + type TagCache interface + DeleteTagMapping func(ctx context.Context, reference string) error + GetTagHistory func(ctx context.Context, reference string) ([]TagHistoryEntry, error) + GetTagMapping func(ctx context.Context, reference string) (*TagMapping, error) + HasTagMapping func(ctx context.Context, reference string) (bool, error) + PutTagMapping func(ctx context.Context, reference, digest string) error + type TagHistoryEntry struct + ChangedAt time.Time + Digest string + type TagMapping struct + AccessCount int64 + CreatedAt time.Time + Digest string + History []TagHistoryEntry + Reference string + UpdatedAt time.Time + type TagResolver struct + func NewTagResolver(tagCache TagCache, manifestCache ManifestCache, config TagResolverConfig) *TagResolver + func (tr *TagResolver) BatchResolveTags(ctx context.Context, references []string) (map[string]string, error) + func (tr *TagResolver) DetectTagMovement(ctx context.Context, reference, expectedDigest string) (bool, error) + func (tr *TagResolver) GetTagHistory(ctx context.Context, reference string) ([]TagHistoryEntry, error) + func (tr *TagResolver) HealthCheck(ctx context.Context) error + func (tr *TagResolver) InvalidateTag(ctx context.Context, reference string) error + func (tr *TagResolver) ResolveTag(ctx context.Context, reference string) (string, error) + func (tr *TagResolver) ValidateTag(ctx context.Context, reference string) (bool, error) + type TagResolverConfig struct + DefaultTTL time.Duration + EnableHistory bool + MaxHistorySize int + func (c *TagResolverConfig) SetDefaults() + func (c *TagResolverConfig) Validate() error