mirror of
https://github.com/arnaucube/arbo.git
synced 2026-02-11 18:56:38 +01:00
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:
@@ -19,7 +19,8 @@ func testVirtualTree(c *qt.C, maxLevels int, keys, values [][]byte) {
|
||||
// normal tree, to have an expected root value
|
||||
database, err := badgerdb.New(db.Options{Path: c.TempDir()})
|
||||
c.Assert(err, qt.IsNil)
|
||||
tree, err := NewTree(database, maxLevels, HashFunctionSha256)
|
||||
tree, err := NewTree(Config{Database: database, MaxLevels: maxLevels,
|
||||
HashFunction: HashFunctionSha256})
|
||||
c.Assert(err, qt.IsNil)
|
||||
for i := 0; i < len(keys); i++ {
|
||||
err := tree.Add(keys[i], values[i])
|
||||
@@ -124,7 +125,8 @@ func TestVirtualTreeAddBatch(t *testing.T) {
|
||||
// normal tree, to have an expected root value
|
||||
database, err := badgerdb.New(db.Options{Path: c.TempDir()})
|
||||
c.Assert(err, qt.IsNil)
|
||||
tree, err := NewTree(database, maxLevels, HashFunctionBlake2b)
|
||||
tree, err := NewTree(Config{Database: database, MaxLevels: maxLevels,
|
||||
HashFunction: HashFunctionBlake2b})
|
||||
c.Assert(err, qt.IsNil)
|
||||
for i := 0; i < len(keys); i++ {
|
||||
err := tree.Add(keys[i], values[i])
|
||||
|
||||
Reference in New Issue
Block a user