MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / loadIndex

Method loadIndex

internal/memory/sessionfiles.go:57–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55}
56
57func (s *SessionFiles) loadIndex() error {
58 data, err := os.ReadFile(filepath.Join(s.root, "index.json"))
59 if os.IsNotExist(err) {
60 s.index = nil
61 return nil
62 }
63 if err != nil {
64 return fmt.Errorf("memory: read index.json: %w", err)
65 }
66 var doc struct {
67 Sessions []SessionRecord `json:"sessions"`
68 }
69 if err := json.Unmarshal(data, &doc); err != nil {
70 return fmt.Errorf("memory: parse index.json: %w", err)
71 }
72 s.index = doc.Sessions
73 return nil
74}
75
76func (s *SessionFiles) pruneMissing() {
77 kept := s.index[:0]

Callers 1

NewSessionFilesFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected