Skip to content

Commit

Permalink
Conservative bloomfilter (#42)
Browse files Browse the repository at this point in the history
* goleveldb bloom filter

* update marko's branch

* bloom filter

* Update settings.json

* Update goleveldb.go

* Update goleveldb.go

* remove all changes to goleveldb config except for the bloom filter

* fumpt

* Update .gitpod.yml

* some files were changed that shouldn't be

* restore .vscode

* update changelog

* gofumpt

Co-authored-by: Marko Baricevic <[email protected]>
  • Loading branch information
faddat and tac0turtle authored Nov 13, 2022
1 parent ab01609 commit dd9f801
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

## Unreleased

- added bloom filter: https://github.com/cosmos/cosmos-db/pull/42/files
- Removed Badger & Boltdb
6 changes: 4 additions & 2 deletions goleveldb.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/spf13/cast"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/errors"
"github.com/syndtr/goleveldb/leveldb/filter"
"github.com/syndtr/goleveldb/leveldb/opt"
"github.com/syndtr/goleveldb/leveldb/util"
)
Expand All @@ -25,8 +26,9 @@ type GoLevelDB struct {
var _ DB = (*GoLevelDB)(nil)

func NewGoLevelDB(name string, dir string, opts Options) (*GoLevelDB, error) {
defaultOpts := &opt.Options{}

defaultOpts := &opt.Options{
Filter: filter.NewBloomFilter(10), // by default, goleveldb doesn't use a bloom filter.
}
if opts != nil {
files := cast.ToInt(opts.Get("maxopenfiles"))
if files > 0 {
Expand Down

0 comments on commit dd9f801

Please sign in to comment.