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

Method Add

factstore/temporal.go:552–569  ·  view source on GitHub ↗

Add adds a temporal fact to the output store.

(atom ast.Atom, interval ast.Interval)

Source from the content-addressed store, hash-verified

550
551// Add adds a temporal fact to the output store.
552func (s *TeeingTemporalStore) Add(atom ast.Atom, interval ast.Interval) (bool, error) {
553 // Guard: Ensure interval is valid
554 if interval.Start.Type == ast.TimestampBound && interval.End.Type == ast.TimestampBound {
555 if interval.Start.Timestamp > interval.End.Timestamp {
556 return false, fmt.Errorf("invalid temporal interval: start %v > end %v", interval.Start, interval.End)
557 }
558 }
559
560 // Note: We don't check base for existence because semantics of Add
561 // usually imply adding *another* interval.
562 // But if we want deduplication...
563 // If base has exact same fact (same interval), we might want to skip.
564 // TemporalStore.Add returns false if duplicate.
565 // We can check Contains? No, ContainsAt checks point.
566 // Ideally we check if exact fact exists.
567 // For now, let's just write to Out. Duplicate facts are usually harmless or handled by upper layers.
568 return s.Out.Add(atom, interval)
569}
570
571// AddEternal adds an eternal fact to the output store.
572func (s *TeeingTemporalStore) AddEternal(atom ast.Atom) (bool, error) {

Callers

nothing calls this directly

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected