Documentation
¶
Index ¶
- Variables
- func AsyncRefreshCache(dirs []string, author string, cacheFilePath string, excludedPatterns []string, ...)
- func CleanCache(cacheFilePath string) error
- func InitCache()
- func LoadCache(filePath string) error
- func QuickNeedsRefresh(refreshInterval time.Duration) bool
- func RefreshCache(dirs []string, author string, cacheFilePath string, excludedPatterns []string, ...) error
- func SaveCache(filePath string) error
- type AuthorStats
- type CacheManager
- func (cm *CacheManager) GetCommits(options QueryOptions) []scan.CommitHistory
- func (cm *CacheManager) Load() error
- func (cm *CacheManager) Refresh() error
- func (cm *CacheManager) RefreshInBackground()
- func (cm *CacheManager) Save() error
- func (cm *CacheManager) StartBackgroundRefresh(interval time.Duration)
- type CacheUpdate
- type CommitCache
- type DisplayStats
- type QueryOptions
- type RepoDisplayStats
- type RepoState
Constants ¶
This section is empty.
Variables ¶
var Cache = &cacheProxy{}
Cache is now a proxy to the manager's cache
Functions ¶
func AsyncRefreshCache ¶ added in v1.5.3
func AsyncRefreshCache(dirs []string, author string, cacheFilePath string, excludedPatterns []string, excludedPaths []string)
AsyncRefreshCache performs a non-blocking cache refresh
func CleanCache ¶ added in v1.5.2
CleanCache removes the cache file and resets the in-memory cache
func QuickNeedsRefresh ¶ added in v1.5.3
QuickNeedsRefresh performs a fast check if refresh is needed
Types ¶
type AuthorStats ¶ added in v1.6.3
type AuthorStats struct {
TotalCommits int
ActiveDays map[string]bool
CurrentStreak int
LongestStreak int
Languages map[string]int
PeakHours map[int]int
LastActivity time.Time
}
AuthorStats holds aggregated statistics for an author
type CacheManager ¶ added in v1.6.3
type CacheManager struct {
// contains filtered or unexported fields
}
CacheManager handles all cache operations
func NewCacheManager ¶ added in v1.6.3
func NewCacheManager(cachePath string) *CacheManager
NewCacheManager creates a new cache manager instance
func (*CacheManager) GetCommits ¶ added in v1.6.3
func (cm *CacheManager) GetCommits(options QueryOptions) []scan.CommitHistory
GetCommits retrieves commits based on query options
func (*CacheManager) Load ¶ added in v1.6.3
func (cm *CacheManager) Load() error
Load reads the cache from disk
func (*CacheManager) Refresh ¶ added in v1.6.3
func (cm *CacheManager) Refresh() error
Refresh updates the cache with fresh data
func (*CacheManager) RefreshInBackground ¶ added in v1.6.3
func (cm *CacheManager) RefreshInBackground()
RefreshInBackground performs a non-blocking cache refresh
func (*CacheManager) Save ¶ added in v1.6.3
func (cm *CacheManager) Save() error
Save persists the cache to disk
func (*CacheManager) StartBackgroundRefresh ¶ added in v1.6.3
func (cm *CacheManager) StartBackgroundRefresh(interval time.Duration)
StartBackgroundRefresh initiates background refresh with specified interval
type CacheUpdate ¶ added in v1.6.3
CacheUpdate represents a cache update notification
type CommitCache ¶ added in v1.6.3
type CommitCache struct {
// Core data
Commits map[string][]scan.CommitHistory // repo -> commits
Authors map[string]AuthorStats // author -> stats
LastSync time.Time
Version string
// Performance optimizations
CommitIndex map[string]map[string]bool // hash -> repo -> exists
DateIndex map[string][]string // YYYY-MM-DD -> commit hashes
AuthorIndex map[string][]string // author -> commit hashes
// Pre-calculated display data
DisplayStats DisplayStats
// Metadata
Repositories map[string]scan.RepoMetadata
// Track repo states for incremental updates
RepoStates map[string]RepoState
}
CommitCache represents the optimized cache structure
type DisplayStats ¶ added in v1.6.3
type DisplayStats struct {
WeeklyTotal int
WeeklyDiff int
DailyAverage float64
TotalAdditions int
TotalDeletions int
PeakHour int
PeakCommits int
LanguageStats map[string]int
RepoStats []RepoDisplayStats
LastUpdate time.Time
}
DisplayStats holds pre-calculated statistics for display
type QueryOptions ¶ added in v1.6.3
QueryOptions defines parameters for commit queries
type RepoDisplayStats ¶ added in v1.6.3
type RepoDisplayStats struct {
Name string
WeeklyCommits int
CurrentStreak int
LongestStreak int
Additions int
Deletions int
LastCommitTime time.Time
}
RepoDisplayStats holds pre-calculated statistics for a repository
type RepoState ¶ added in v1.7.1
type RepoState struct {
LastHash string // Last known commit hash
LastScan time.Time // Last scan timestamp
IsStale bool // Whether repo needs rescanning
ScanInterval time.Duration // Custom scan interval for this repo
}
RepoState tracks the state of a repository for incremental updates