Skip to content

Commit 1fa8597

Browse files
committed
config: add config option for bloom filter
License: MIT Signed-off-by: Jakub Sztandera <[email protected]>
1 parent 6912f47 commit 1fa8597

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

core/builder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
136136
var err error
137137
bs := bstore.NewBlockstore(n.Repo.Datastore())
138138
opts := bstore.DefaultCacheOpts()
139+
opts.HasBloomFilterSize = n.Repo.Config().Datastore.BloomFilterSize
139140
if !cfg.Permament {
140141
opts.HasBloomFilterSize = 0
141142
}

repo/config/datastore.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ type Datastore struct {
1515
StorageGCWatermark int64 // in percentage to multiply on StorageMax
1616
GCPeriod string // in ns, us, ms, s, m, h
1717

18-
Params *json.RawMessage
19-
NoSync bool
20-
HashOnRead bool
18+
Params *json.RawMessage
19+
NoSync bool
20+
HashOnRead bool
21+
BloomFilterSize int
2122
}
2223

2324
func (d *Datastore) ParamData() []byte {

repo/config/init.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func datastoreConfig() (Datastore, error) {
8585
StorageGCWatermark: 90, // 90%
8686
GCPeriod: "1h",
8787
HashOnRead: false,
88+
BloomFilterSize: 0,
8889
}, nil
8990
}
9091

0 commit comments

Comments
 (0)