Documentation
¶
Index ¶
- Constants
- func BuildLines(path string, width, lines int, palette ThemePalette) []string
- func CacheKeyForSession(path string, width int, sizeBytes int64, updatedAtUnix int64) string
- func LinesBytes(lines []string) int64
- func LoadCmd(req Request) tea.Cmd
- func LoadIndexEntry(path, key string) ([]string, bool, error)
- func PersistIndexCmd(indexPath string, cap int, record IndexRecord) tea.Cmd
- func ReadIndex(path string) (map[string]IndexRecord, bool, error)
- func RecordBytes(rec IndexRecord) int64
- func RewriteIndex(path string, entries map[string]IndexRecord, cap int, maxBytes int64) error
- func TrimIndexBytes(entries map[string]IndexRecord, totalBytes, maxBytes int64) int64
- func UpsertIndex(path string, cap int, record IndexRecord) error
- func WithIndexLock(lockPath string, timeout time.Duration, fn func() error) error
- type AngleTagTone
- type HandleLoadedOutput
- type IndexPersistedMsg
- type IndexRecord
- type LoadedMsg
- type Request
- type ThemePalette
Constants ¶
const MaxIndexBytes = 8 << 20
MaxIndexBytes is the byte budget for preview index storage.
Variables ¶
This section is empty.
Functions ¶
func BuildLines ¶
func BuildLines(path string, width, lines int, palette ThemePalette) []string
BuildLines renders preview entries from one session file.
func CacheKeyForSession ¶
CacheKeyForSession derives a stable preview cache key from session metadata.
func LinesBytes ¶
LinesBytes returns raw string bytes occupied by preview lines.
func LoadIndexEntry ¶
LoadIndexEntry loads one cached preview by key.
func PersistIndexCmd ¶ added in v0.3.2
func PersistIndexCmd(indexPath string, cap int, record IndexRecord) tea.Cmd
func ReadIndex ¶
func ReadIndex(path string) (map[string]IndexRecord, bool, error)
ReadIndex reads all records. Corrupted lines are skipped and flagged.
func RecordBytes ¶
func RecordBytes(rec IndexRecord) int64
RecordBytes estimates one index record byte footprint.
func RewriteIndex ¶
RewriteIndex rewrites index with cap and byte-limit trimming.
func TrimIndexBytes ¶
func TrimIndexBytes(entries map[string]IndexRecord, totalBytes, maxBytes int64) int64
TrimIndexBytes evicts oldest records until byte budget is satisfied.
func UpsertIndex ¶
func UpsertIndex(path string, cap int, record IndexRecord) error
UpsertIndex inserts or updates one preview index record.
Types ¶
type AngleTagTone ¶ added in v0.3.2
type AngleTagTone int
AngleTagTone classifies angle-bracket tag semantics for highlight styling.
const ( AngleTagToneDefault AngleTagTone = iota AngleTagToneSystem AngleTagToneLifecycle AngleTagToneDanger AngleTagToneSuccess )
func ClassifyAngleTag ¶ added in v0.3.2
func ClassifyAngleTag(tag string) AngleTagTone
ClassifyAngleTag applies semantic tag classification for preview coloring.
type HandleLoadedOutput ¶ added in v0.3.2
type HandleLoadedOutput struct {
Accepted bool
NextWait string
CacheKey string
CacheLines []string
PersistCmd tea.Cmd
}
func HandleLoaded ¶ added in v0.3.2
func HandleLoaded(currentReqID uint64, waitKey string, msg LoadedMsg, indexPath string, cap int) HandleLoadedOutput
HandleLoaded validates stale async messages and returns cache/persist actions.
type IndexPersistedMsg ¶ added in v0.3.2
type IndexPersistedMsg struct {
Err string
}
IndexPersistedMsg is emitted after index persistence.
type IndexRecord ¶
type IndexRecord struct {
Key string `json:"key"`
Path string `json:"path"`
Width int `json:"width"`
SizeBytes int64 `json:"size_bytes"`
UpdatedAtUnix int64 `json:"updated_at_unix"`
TouchedAtUnix int64 `json:"touched_at_unix"`
Lines []string `json:"lines"`
}
IndexRecord is one preview index row.
type LoadedMsg ¶ added in v0.3.2
type LoadedMsg struct {
RequestID uint64
Key string
Lines []string
Err string
Record IndexRecord
}
LoadedMsg is emitted after a preview load.