Documentation
¶
Index ¶
- func DataDir() string
- func EnsureWritable(path string) error
- func FormatDatabaseName(dbName string) string
- func GetAvailableDatabases() []string
- func GetDatabaseDescription(dbName string) string
- func MetricsDir() string
- func OutputDir() string
- func ReadDatabaseCSV(name string) ([]string, error)
- func SeriesDir() string
- func TestOnlyResetCacheManager()
- func TestOnlyResetDataDir(flagVal string)
- type CacheManager
- type DatabaseCache
- type DatabaseIndex
- type DatabaseRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureWritable ¶
EnsureWritable makes sure directory exists and is writable.
func FormatDatabaseName ¶ added in v6.6.6
FormatDatabaseName converts internal database name to display name.
func GetAvailableDatabases ¶ added in v6.6.6
func GetAvailableDatabases() []string
GetAvailableDatabases returns the list of all available database names. This is the canonical source for database names used throughout the system.
func GetDatabaseDescription ¶ added in v6.6.6
GetDatabaseDescription returns a human-readable description for a database.
func MetricsDir ¶
func MetricsDir() string
func OutputDir ¶
func OutputDir() string
Dir helpers (pure functions) derived from a base data directory.
func ReadDatabaseCSV ¶
ReadDatabaseCSV extracts the named CSV file from the embedded .tar.gz and returns its lines.
func TestOnlyResetCacheManager ¶
func TestOnlyResetCacheManager()
TestOnlyResetCacheManager resets cache manager singleton for testing isolation
func TestOnlyResetDataDir ¶
func TestOnlyResetDataDir(flagVal string)
TestOnlyResetDataDir resets internal directory state (intended for tests).
Types ¶
type CacheManager ¶
type CacheManager struct {
// contains filtered or unexported fields
}
CacheManager handles loading and building binary caches
func GetCacheManager ¶
func GetCacheManager() *CacheManager
GetCacheManager returns the singleton cache manager
func (*CacheManager) GetDatabase ¶
func (cm *CacheManager) GetDatabase(name string) (DatabaseIndex, error)
GetDatabase returns a database index, loading from cache or embedded resources
func (*CacheManager) InvalidateCache ¶
func (cm *CacheManager) InvalidateCache() error
InvalidateCache removes cached files to force rebuild
func (*CacheManager) LoadOrBuild ¶
func (cm *CacheManager) LoadOrBuild() error
LoadOrBuild ensures caches are loaded, building them if necessary
type DatabaseCache ¶
type DatabaseCache struct {
Version string `json:"version"` // Overall version
Timestamp int64 `json:"timestamp"` // Cache creation time
Databases map[string]DatabaseIndex `json:"databases"` // Database name -> index
Checksum string `json:"checksum"` // SHA256 of embedded tar.gz
SourceHash string `json:"sourceHash"` // Hash of source data for validation
}
DatabaseCache holds all processed database indexes
type DatabaseIndex ¶
type DatabaseIndex struct {
Name string `json:"name"` // Database name (e.g., "nouns")
Version string `json:"version"` // Version from CSV
Records []DatabaseRecord `json:"records"` // All records
Lookup map[string]int `json:"lookup"` // Key -> record index mapping
}
DatabaseIndex provides fast access to database records
type DatabaseRecord ¶
type DatabaseRecord struct {
Key string `json:"key"` // Primary identifier (e.g., "aardvark")
Values []string `json:"values"` // All column values including version
}
DatabaseRecord represents a single row from a CSV database