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

+7 -7
View File
@@ -209,7 +209,7 @@ func TestMigrationWithPanic(t *testing.T) {
}
return bucket.Put(keyPrefix, beforeMigration)
})
}, func() {})
if err != nil {
t.Fatalf("unable to insert: %v", err)
}
@@ -251,7 +251,7 @@ func TestMigrationWithPanic(t *testing.T) {
}
return nil
})
}, func() {})
if err != nil {
t.Fatal(err)
}
@@ -283,7 +283,7 @@ func TestMigrationWithFatal(t *testing.T) {
}
return bucket.Put(keyPrefix, beforeMigration)
})
}, func() {})
if err != nil {
t.Fatalf("unable to insert pre migration key: %v", err)
}
@@ -326,7 +326,7 @@ func TestMigrationWithFatal(t *testing.T) {
}
return nil
})
}, func() {})
if err != nil {
t.Fatal(err)
}
@@ -359,7 +359,7 @@ func TestMigrationWithoutErrors(t *testing.T) {
}
return bucket.Put(keyPrefix, beforeMigration)
})
}, func() {})
if err != nil {
t.Fatalf("unable to update db pre migration: %v", err)
}
@@ -401,7 +401,7 @@ func TestMigrationWithoutErrors(t *testing.T) {
}
return nil
})
}, func() {})
if err != nil {
t.Fatal(err)
}
@@ -448,7 +448,7 @@ func TestMigrationReversion(t *testing.T) {
}
return putMeta(newMeta, tx)
})
}, func() {})
// Close the database. Even if we succeeded, our next step is to reopen.
cdb.Close()