multi: add reset closure to kvdb.View

This commit adds a reset() closure to the kvdb.View function which will
be called before each retry (including the first) of the view
transaction. The reset() closure can be used to reset external state
(eg slices or maps) where the view closure puts intermediate results.
This commit is contained in:
Andras Banki-Horvath
2020-10-20 16:18:40 +02:00
parent ffb27284df
commit 2a358327f4
47 changed files with 340 additions and 82 deletions

View File

@ -786,6 +786,8 @@ func loadFwdPkgs(t *testing.T, db kvdb.Backend,
var err error
fwdPkgs, err = packager.LoadFwdPkgs(tx)
return err
}, func() {
fwdPkgs = nil
}); err != nil {
t.Fatalf("unable to load fwd pkgs: %v", err)
}