multi: add reset closure to kvdb.Update

Similarly as with kvdb.View this commits adds a reset closure to the
kvdb.Update call in order to be able to reset external state if the
underlying db backend needs to retry the transaction.
This commit is contained in:
Andras Banki-Horvath committed 2020-11-05 17:57:12 +01:00
1 parent 2a358327f4
commit d89f51d1d0
44 files changed
+208 -162

No files matched your search

+3 -1
View File
@@ -100,6 +100,8 @@ func (s *persistentSequencer) NextID() (uint64, error) {
nextIDBkt.SetSequence(nextHorizonID)
return nil
}, func() {
nextHorizonID = 0
}); err != nil {
return 0, err
}
@@ -124,5 +126,5 @@ func (s *persistentSequencer) initDB() error {
return kvdb.Update(s.db, func(tx kvdb.RwTx) error {
_, err := tx.CreateTopLevelBucket(nextPaymentIDKey)
return err
})
}, func() {})
}