Skip to content

Commit

Permalink
feat: add pebbledb (#112)
Browse files Browse the repository at this point in the history
* add pebbledb

* use latest pebble

* Update pebble.go

Co-authored-by: Jasmina Malicevic <[email protected]>

* Update pebble.go

Co-authored-by: Jasmina Malicevic <[email protected]>

* Update pebble.go

Co-authored-by: Jasmina Malicevic <[email protected]>

* Update pebble.go

Co-authored-by: Jasmina Malicevic <[email protected]>

* Update pebble.go

Co-authored-by: Jasmina Malicevic <[email protected]>

* Update pebble.go

Co-authored-by: Jasmina Malicevic <[email protected]>

* clean up

* change default ForceSync=1

* Update db.go

Co-authored-by: Anton Kaliaev <[email protected]>

* resolve conflicts

* update CHANGELOG.md: Added support for pebbledb v1.0.0

* add unclog entry

* add changelog

* Update .changelog/unreleased/feat/112.md

Co-authored-by: Anton Kaliaev <[email protected]>

* add changelog...

* add changelog...
renamed 112-add-pebbledb.md to 112-pebbledb.md

---------

Co-authored-by: Tuan Pham Anh <[email protected]>
Co-authored-by: Jasmina Malicevic <[email protected]>
Co-authored-by: Anton Kaliaev <[email protected]>
  • Loading branch information
4 people authored Jan 24, 2024
1 parent f7a229f commit 2af169e
Show file tree
Hide file tree
Showing 7 changed files with 1,102 additions and 21 deletions.
1 change: 1 addition & 0 deletions .changelog/unreleased/features/112-pebbledb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added support for pebbledb [v1.0.0](https://github.com/cockroachdb/pebble/releases/tag/v1.0.0) ([\#112](https://github.com/cometbft/cometbft-db/pull/112))
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ test-badgerdb:
@go test $(PACKAGES) -tags badgerdb -v
.PHONY: test-badgerdb

test-pebble:
@echo "--> Running go test"
@go test $(PACKAGES) -tags pebbledb -v

test-all:
@echo "--> Running go test"
@go test $(PACKAGES) -tags cleveldb,boltdb,rocksdb,grocksdb_clean_link,badgerdb -v
Expand All @@ -52,7 +56,7 @@ test-all-with-coverage:
-race \
-coverprofile=coverage.txt \
-covermode=atomic \
-tags=memdb,goleveldb,cleveldb,boltdb,rocksdb,grocksdb_clean_link,badgerdb \
-tags=memdb,goleveldb,cleveldb,boltdb,rocksdb,grocksdb_clean_link,badgerdb,pebbledb \
-v
.PHONY: test-all-with-coverage

Expand Down
5 changes: 5 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ const (
RocksDBBackend BackendType = "rocksdb"

BadgerDBBackend BackendType = "badgerdb"

// PebbleDBDBBackend represents pebble (uses github.com/cockroachdb/pebble)
// - EXPERIMENTAL
// - use pebbledb build tag (go build -tags pebbledb)
PebbleDBBackend BackendType = "pebbledb"
)

type dbCreator func(name string, dir string) (DB, error)
Expand Down
31 changes: 24 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/cometbft/cometbft-db
go 1.21

require (
github.com/cockroachdb/pebble v1.0.0
github.com/dgraph-io/badger/v2 v2.2007.4
github.com/google/btree v1.1.2
github.com/jmhodges/levigo v1.0.0
Expand All @@ -13,17 +14,33 @@ require (
)

require (
github.com/DataDog/zstd v1.4.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.8.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect
github.com/cockroachdb/redact v1.0.8 // indirect
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/ristretto v0.0.3 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
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/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.12.0 // indirect
github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
golang.org/x/exp v0.0.0-20200513190911-00229845015e // indirect
github.com/google/go-cmp v0.6.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
Expand Down
Loading

0 comments on commit 2af169e

Please sign in to comment.