add configuration for splitstore and default to a simple compaction algorithm

This commit is contained in:
vyzo
2021-03-05 14:46:17 +02:00
parent 2e4d45ef07
commit 73259aa350
4 changed files with 157 additions and 26 deletions
+4 -4
View File
@@ -610,10 +610,10 @@ func Repo(r repo.Repo) Option {
Override(new(dtypes.MetadataDS), modules.Datastore),
Override(new(dtypes.UniversalBlockstore), modules.UniversalBlockstore),
If(cfg.Splitstore,
If(cfg.UseLMDBHotstore,
If(cfg.EnableSplitstore,
If(cfg.Splitstore.UseLMDBHotstore,
Override(new(dtypes.HotBlockstore), modules.LMDBHotBlockstore)),
If(!cfg.UseLMDBHotstore,
If(!cfg.Splitstore.UseLMDBHotstore,
Override(new(dtypes.HotBlockstore), modules.BadgerHotBlockstore)),
Override(new(dtypes.SplitBlockstore), modules.SplitBlockstore(cfg)),
Override(new(dtypes.ChainBlockstore), modules.ChainSplitBlockstore),
@@ -621,7 +621,7 @@ func Repo(r repo.Repo) Option {
Override(new(dtypes.BaseBlockstore), From(new(dtypes.SplitBlockstore))),
Override(new(dtypes.ExposedBlockstore), From(new(dtypes.SplitBlockstore))),
),
If(!cfg.Splitstore,
If(!cfg.EnableSplitstore,
Override(new(dtypes.ChainBlockstore), modules.ChainFlatBlockstore),
Override(new(dtypes.StateBlockstore), modules.StateFlatBlockstore),
Override(new(dtypes.BaseBlockstore), From(new(dtypes.UniversalBlockstore))),
+10 -3
View File
@@ -121,9 +121,16 @@ type Pubsub struct {
}
type Blockstore struct {
Splitstore bool
UseLMDBHotstore bool
UseLMDBTracking bool
EnableSplitstore bool
Splitstore Splitstore
}
type Splitstore struct {
UseLMDBHotstore bool
UseLMDBTracking bool
EnableFullCompaction bool
EnableGC bool // EXPERIMENTAL
Archival bool
}
// // Full Node
+7 -1
View File
@@ -103,7 +103,13 @@ func SplitBlockstore(cfg *config.Blockstore) func(lc fx.Lifecycle, r repo.Locked
return nil, err
}
ss, err := splitstore.NewSplitStore(path, ds, cold, hot, cfg.UseLMDBTracking)
ss, err := splitstore.NewSplitStore(path, ds, cold, hot,
&splitstore.Config{
UseLMDB: cfg.Splitstore.UseLMDBTracking,
EnableFullCompaction: cfg.Splitstore.EnableFullCompaction,
EnableGC: cfg.Splitstore.EnableGC,
Archival: cfg.Splitstore.Archival,
})
if err != nil {
return nil, err
}