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

Method Contains

factstore/factstore.go:671–691  ·  view source on GitHub ↗

Contains returns true if this store contains this atom already.

(a ast.Atom)

Source from the content-addressed store, hash-verified

669
670// Contains returns true if this store contains this atom already.
671func (s MultiIndexedInMemoryStore) Contains(a ast.Atom) bool {
672 if a.Predicate.Arity == 0 {
673 _, ok := s.constants[a.Predicate]
674 return ok
675 }
676 shard, ok := s.shardsByPredicate[a.Predicate]
677 if !ok {
678 return false
679 }
680 params, ok := shard[0]
681 if !ok {
682 return false
683 }
684 h := a.Args[0].Hash()
685 atoms, ok := params[h]
686 if !ok {
687 return false
688 }
689 _, exists := atoms[a.Hash()]
690 return exists
691}
692
693// EstimateFactCount returns the number of facts.
694func (s MultiIndexedInMemoryStore) EstimateFactCount() int {

Callers

nothing calls this directly

Calls 1

HashMethod · 0.65

Tested by

no test coverage detected