Skip to content

Commit 25483cb

Browse files
authored
feat: top level index local persistence (#140)
* top level index local persistence * fix typo
1 parent 965db06 commit 25483cb

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

config/config.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ type DAGStoreConfig struct {
148148
// Default value: 1 minute.
149149
GCInterval Duration
150150

151-
//MongoTipIndex used to config whether to save top index data to mongo
152-
MongoTipIndex *MongoTopIndex
151+
//MongoTopIndex used to config whether to save top index data to mongo
152+
MongoTopIndex *MongoTopIndex
153153

154154
//Transient path used to store temp file for retrieval
155155
Transient string

dagstore/wrapper.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ func NewDAGStore(ctx context.Context, cfg *config.DAGStoreConfig, marketApi Mark
104104
RecoverOnStart: dagstore.RecoverNow,
105105
}
106106

107-
if cfg.MongoTipIndex != nil {
108-
dcfg.TopLevelIndex, err = NewMongoTopIndex(ctx, cfg.MongoTipIndex.Url)
107+
if cfg.MongoTopIndex != nil {
108+
dcfg.TopLevelIndex, err = NewMongoTopIndex(ctx, cfg.MongoTopIndex.Url)
109109
if err != nil {
110110
return nil, nil, err
111111
}
112+
} else {
113+
dcfg.TopLevelIndex = index.NewInverted(dstore)
112114
}
113115

114116
dagst, err := dagstore.NewDAGStore(dcfg)

0 commit comments

Comments
 (0)