Add thresholdNLeafs configurable

ThresholdNLeafs defines the threshold number of leafs in the tree that
determines if AddBatch will work in memory or in disk. It is defined
when calling NewTree, and if set to 0 it will work always in disk.
This commit is contained in:
2021-11-22 21:09:16 +01:00
parent 6cf1e58d9f
commit 4b6d6efdca
8 changed files with 172 additions and 86 deletions

View File

@@ -16,7 +16,8 @@ func TestGenerator(t *testing.T) {
c := qt.New(t)
database, err := badgerdb.New(db.Options{Path: c.TempDir()})
c.Assert(err, qt.IsNil)
tree, err := arbo.NewTree(database, 4, arbo.HashFunctionPoseidon)
tree, err := arbo.NewTree(arbo.Config{Database: database, MaxLevels: 4,
HashFunction: arbo.HashFunctionPoseidon})
c.Assert(err, qt.IsNil)
testVector := [][]int64{