Documentation
¶
Index ¶
Constants ¶
const ( // SchemaVersion is incremented when the cache format changes. // Bumped to 3: added staleness detection fields (BaseDirModTimes, FileSample, TotalFileCount). SchemaVersion = 3 )
Variables ¶
This section is empty.
Functions ¶
func ExpandBaseDirs ¶
ExpandBaseDirs normalizes base directory paths by expanding ~, $HOME, %USERPROFILE%
func GetCacheDir ¶
GetCacheDir returns the platform-specific cache directory for bagel
Types ¶
type CachedFileIndex ¶
type CachedFileIndex struct {
Metadata Metadata `json:"metadata"`
Entries map[string][]string `json:"entries"` // pattern name -> file paths
}
CachedFileIndex represents the serializable form of a file index
type FileSampleEntry ¶
type FileSampleEntry struct {
Path string `json:"path"`
ModTime int64 `json:"mod_time"` // Unix nanoseconds
Size int64 `json:"size"`
}
FileSampleEntry represents a sampled file for staleness validation
type LoadInput ¶
type LoadInput struct {
BaseDirs []string
Patterns []fileindex.Pattern
MaxDepth int
FollowSymlinks bool
TTL time.Duration // Cache expiration duration (0 = no TTL check)
ValidateFiles bool // Enable file sample validation
}
LoadInput holds the parameters for loading a cached file index
type Metadata ¶
type Metadata struct {
SchemaVersion int `json:"schema_version"`
CreatedAt time.Time `json:"created_at"`
BaseDirs []string `json:"base_dirs"` // Stored as expanded paths
PatternsHash string `json:"patterns_hash"`
MaxDepth int `json:"max_depth"`
FollowSymlinks bool `json:"follow_symlinks"`
// Staleness detection fields
BaseDirModTimes map[string]int64 `json:"base_dir_mod_times"` // dir -> mtime (Unix nanoseconds)
FileSample []FileSampleEntry `json:"file_sample"` // Sampled files for validation
TotalFileCount int `json:"total_file_count"`
}
Metadata holds information about the cached file index
type SaveInput ¶
type SaveInput struct {
BaseDirs []string
Patterns []fileindex.Pattern
MaxDepth int
FollowSymlinks bool
Index *fileindex.FileIndex
SampleSize int // Number of files to sample for staleness detection
}
SaveInput holds the parameters for saving a file index to cache
type StalenessCheckInput ¶
StalenessCheckInput holds parameters for checking cache staleness
type StalenessResult ¶
type StalenessResult struct {
IsStale bool
Reason string // "ttl_expired", "base_dir_changed", "file_missing", "file_modified"
Details string
}
StalenessResult represents the result of a staleness check
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages file index caching
func (*Store) Clear ¶
Clear removes all cache files in the cache directory. Subdirectories are skipped intentionally - this function only cleans files created by this cache package (fileindex-*.json).