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

Method Merge

factstore/temporal.go:377–394  ·  view source on GitHub ↗

Merge merges contents of another temporal store into this one. Returns an error if the interval limit is exceeded for any atom.

(other ReadOnlyTemporalFactStore)

Source from the content-addressed store, hash-verified

375// Merge merges contents of another temporal store into this one.
376// Returns an error if the interval limit is exceeded for any atom.
377func (s *TemporalStore) Merge(other ReadOnlyTemporalFactStore) error {
378 var mergeErr error
379 for _, pred := range other.ListPredicates() {
380 query := ast.NewQuery(pred)
381 other.GetAllFacts(query, func(tf TemporalFact) error {
382 _, err := s.Add(tf.Atom, tf.Interval)
383 if err != nil {
384 mergeErr = err
385 return err // Stop iteration on error
386 }
387 return nil
388 })
389 if mergeErr != nil {
390 return mergeErr
391 }
392 }
393 return nil
394}
395
396// TemporalFactStoreAdapter wraps a TemporalFactStore to provide
397// a standard FactStore interface. Facts are returned without

Callers

nothing calls this directly

Calls 4

AddMethod · 0.95
NewQueryFunction · 0.92
ListPredicatesMethod · 0.65
GetAllFactsMethod · 0.65

Tested by

no test coverage detected