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

Method Contains

factstore/factstore.go:492–508  ·  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

490
491// Contains returns true if this store contains this atom already.
492func (s IndexedInMemoryStore) Contains(a ast.Atom) bool {
493 if a.Predicate.Arity == 0 {
494 _, ok := s.constants[a.Predicate]
495 return ok
496 }
497 shard, ok := s.shardsByPredicate[a.Predicate]
498 if !ok {
499 return false
500 }
501 h := a.Args[0].Hash()
502 atoms, ok := shard[h]
503 if !ok {
504 return false
505 }
506 _, exists := atoms[a.Hash()]
507 return exists
508}
509
510// EstimateFactCount returns the number of facts.
511func (s IndexedInMemoryStore) EstimateFactCount() int {

Callers

nothing calls this directly

Calls 1

HashMethod · 0.65

Tested by

no test coverage detected