Skip to content

Commit

Permalink
goleveldb: ForceCompact (#216)
Browse files Browse the repository at this point in the history
* add force compact

* go mod tidy

* dont break the interface

* bring back remotedb

* fix lint
  • Loading branch information
tac0turtle authored Feb 8, 2022
1 parent ce3673b commit 9ea19a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/cosmos/gorocksdb v1.2.0
github.com/dgraph-io/badger/v2 v2.2007.2
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.4.3 // indirect
github.com/google/btree v1.0.0
github.com/jmhodges/levigo v1.0.0
github.com/stretchr/testify v1.7.0
Expand All @@ -21,7 +22,6 @@ require (
github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions goleveldb.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ func (db *GoLevelDB) Stats() map[string]string {
return stats
}

func (db *GoLevelDB) ForceCompact(start, limit []byte) error {
return db.db.CompactRange(util.Range{Start: start, Limit: limit})
}

// NewBatch implements DB.
func (db *GoLevelDB) NewBatch() Batch {
return newGoLevelDBBatch(db)
Expand Down

0 comments on commit 9ea19a1

Please sign in to comment.