MCPcopy Create free account
hub / github.com/compozy/agh / Exists

Method Exists

internal/memory/store.go:261–275  ·  view source on GitHub ↗

Exists reports whether a memory file exists in the requested scope.

(scope memcontract.Scope, filename string)

Source from the content-addressed store, hash-verified

259
260// Exists reports whether a memory file exists in the requested scope.
261func (s *Store) Exists(scope memcontract.Scope, filename string) (bool, error) {
262 path, err := s.pathFor(scope, filename)
263 if err != nil {
264 return false, err
265 }
266
267 if _, err := os.Stat(path); err != nil {
268 if errors.Is(err, os.ErrNotExist) {
269 return false, nil
270 }
271 return false, fmt.Errorf("memory: stat %q: %w", path, err)
272 }
273
274 return true, nil
275}
276
277// Write validates the memory frontmatter and persists the raw file contents atomically.
278func (s *Store) Write(scope memcontract.Scope, filename string, content []byte) error {

Callers 5

TestStoreExistsFunction · 0.45
resolveMemoryLocationMethod · 0.45
resolveMemoryLocationMethod · 0.45

Calls 2

pathForMethod · 0.95
IsMethod · 0.45

Tested by 2

TestStoreExistsFunction · 0.36