Skip to content

Commit

Permalink
feat: top level index local persistence (#140)
Browse files Browse the repository at this point in the history
* top level index local persistence

* fix typo
  • Loading branch information
zl03jsj authored Jun 7, 2022
1 parent 965db06 commit 25483cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ type DAGStoreConfig struct {
// Default value: 1 minute.
GCInterval Duration

//MongoTipIndex used to config whether to save top index data to mongo
MongoTipIndex *MongoTopIndex
//MongoTopIndex used to config whether to save top index data to mongo
MongoTopIndex *MongoTopIndex

//Transient path used to store temp file for retrieval
Transient string
Expand Down
6 changes: 4 additions & 2 deletions dagstore/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ func NewDAGStore(ctx context.Context, cfg *config.DAGStoreConfig, marketApi Mark
RecoverOnStart: dagstore.RecoverNow,
}

if cfg.MongoTipIndex != nil {
dcfg.TopLevelIndex, err = NewMongoTopIndex(ctx, cfg.MongoTipIndex.Url)
if cfg.MongoTopIndex != nil {
dcfg.TopLevelIndex, err = NewMongoTopIndex(ctx, cfg.MongoTopIndex.Url)
if err != nil {
return nil, nil, err
}
} else {
dcfg.TopLevelIndex = index.NewInverted(dstore)
}

dagst, err := dagstore.NewDAGStore(dcfg)
Expand Down

0 comments on commit 25483cb

Please sign in to comment.