Documentation
¶
Index ¶
- Variables
- func FindSessions(sessionsDir string, roots []string) ([]model.Session, model.ScanReport, error)
- func FindSessionsCached(sessionsDir string, roots []string, cache *Cache) ([]model.Session, model.ScanReport, error)
- func ScanStore(codexHome string) ([]Entry, ScanReport, error)
- func SessionWorkingDir(path string) (string, bool, error)
- type Cache
- type Entry
- type Files
- type ScanReport
- type Tree
Constants ¶
This section is empty.
Variables ¶
Shared is the process-wide cache the collector uses when a caller passes none, so every discovery in the daemon reuses what the others read.
Functions ¶
func FindSessions ¶
FindSessions scans the dated rollout store and returns repository-scoped root sessions with every child and fork source needed to decode each tree.
func FindSessionsCached ¶ added in v0.2.0
func FindSessionsCached(sessionsDir string, roots []string, cache *Cache) ([]model.Session, model.ScanReport, error)
FindSessionsCached is FindSessions reading rollout first records through cache, which may be nil to read every one. The sessions found are the same either way.
Types ¶
type Cache ¶ added in v0.2.0
type Cache struct {
// contains filtered or unexported fields
}
Cache remembers what the first record of each rollout said, keyed on its path, size and modification time, so a scan of an unchanged store does not open the files again. Each scan drops the entries of its store that it did not meet (deleted rollouts). Only what discovery uses is kept: the first line of a rollout is often 20 KB, most of it instructions discovery never reads.
Between BeginPass and EndPass the scan of a store is also done once: later lookups of the same store reuse its index. Use a pass for work that is content with the store as it was when the pass began, such as one analytics refresh over many clones.
A nil *Cache caches nothing. It is safe for concurrent use.
func (*Cache) BeginPass ¶ added in v0.2.0
func (c *Cache) BeginPass()
BeginPass starts a pass: until EndPass, the store of a sessions directory is scanned once however many times it is looked up. Passes may nest or overlap.
func (*Cache) EndPass ¶ added in v0.2.0
func (c *Cache) EndPass()
EndPass ends a pass begun by BeginPass. When the last one ends the scans it kept are forgotten.
type Entry ¶
type Entry struct {
Path string
Meta *codextranscript.SessionMeta
Class codextranscript.ThreadClass
}
type Files ¶
type ScanReport ¶
type ScanReport struct {
SkippedFiles int `json:"skipped_files"`
SkippedPaths []string `json:"skipped_paths,omitempty"`
// UnreadablePaths are the compressed rollouts (.jsonl.zst) whose zstd data
// is corrupt or truncated. They are skipped too, and listed here as well.
UnreadablePaths []string `json:"unreadable_paths,omitempty"`
}
type Tree ¶ added in v0.2.0
type Tree struct {
// contains filtered or unexported fields
}
Tree is the lookups Find needs over one scan of the store, built once so that finding each root session does not walk the whole index again.