Add transaction (a list of deltas) as a primitive for applying sets of changes

... and Fix idomaticness
This commit is contained in:
Barak Michener 2015-06-15 13:28:51 -04:00
parent 41f1a2b9a9
commit 7934252fb5
4 changed files with 62 additions and 3 deletions

View file

@ -106,3 +106,12 @@ func (s *Single) Close() error {
// Nothing to clean up locally.
return nil
}
func (s *Single) ApplyTransaction(t *graph.Transaction) error {
ts := time.Now()
for i := 0; i < len(t.Deltas); i++ {
t.Deltas[i].ID = s.currentID.Next()
t.Deltas[i].Timestamp = ts
}
return s.qs.ApplyDeltas(t.Deltas, s.ignoreOpts)
}