MCPcopy
hub / github.com/google/mangle / Remove

Method Remove

factstore/factstore.go:466–489  ·  view source on GitHub ↗

Remove removes the fact to the backing map.

(a ast.Atom)

Source from the content-addressed store, hash-verified

464
465// Remove removes the fact to the backing map.
466func (s IndexedInMemoryStore) Remove(a ast.Atom) bool {
467 if a.Predicate.Arity == 0 {
468 if _, ok := s.constants[a.Predicate]; ok {
469 delete(s.constants, a.Predicate)
470 return true
471 }
472 return false
473 }
474 h := a.Args[0].Hash()
475 shard, ok := s.shardsByPredicate[a.Predicate]
476 if !ok {
477 return false
478 }
479 key := a.Hash()
480 atoms, ok := shard[h]
481 if !ok {
482 return false
483 }
484 if _, ok := atoms[key]; ok {
485 delete(atoms, key)
486 return true
487 }
488 return false
489}
490
491// Contains returns true if this store contains this atom already.
492func (s IndexedInMemoryStore) Contains(a ast.Atom) bool {

Callers

nothing calls this directly

Calls 1

HashMethod · 0.65

Tested by

no test coverage detected