Skip to content

feat(storage): Add package internal/storage#4511

Merged
alesforz merged 4 commits intofeature/remove-cometbftdbfrom
alesforz/one-db-iface
Nov 19, 2024
Merged

feat(storage): Add package internal/storage#4511
alesforz merged 4 commits intofeature/remove-cometbftdbfrom
alesforz/one-db-iface

Conversation

@alesforz
Copy link
Collaborator

@alesforz alesforz commented Nov 18, 2024

Partially addresses #4486.

Context

CometBFT will stop importing cometbft-db as a dependency to support multiple database backends. Instead, it will use pebble by default.

Changes

This PR adds package storage to the internal packages:

  • it exports the DB, Batch, and Iterator interfaces that database backends must implement to work with CometBFT. Previously, they were offered by cometbft-db.
  • it exports the pebbledb implementation of the above interfaces.

Users can provide their own implementation of these interfaces using a different database under the hood. However, we will support and maintain only the pebble implementation that CometBFT will use.

Note: this PR ports the code currently provided by cometbft-db. It does not add new functionalities to either the interfaces or their implementation using pebble. What it does:

  • improve docs
  • clearer error messages
  • minor refactoring of nested if statements for readability

PR checklist

  • [] Tests written/updated
  • [ ] Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

Package `storage`:
- exports the `DB`, `Batch`, and `Iterator` interfaces that database backends
  must implement to work with CometBFT. Previously, they offered by cometbft-db.
- exports the pebbledb implementation of the above interfaces.
@alesforz alesforz self-assigned this Nov 18, 2024
@alesforz alesforz added storage P:tech-debt Priority: Technical debt that needs to be paid off to enable us to move faster, reliably labels Nov 18, 2024
@alesforz alesforz mentioned this pull request Nov 18, 2024
9 tasks
Alessandro added 2 commits November 18, 2024 15:27
The linter was failing with the following error:
`import 'github.com/cockroachdb/pebble' is not allowed from list 'main'`.
even though we are not importing github.com/cockroachdb/pebble in the `main` pkg.

I think this happened because the `depguard` linter configuration treats all
files in the project as belonging to the `main` package due to the `$all` rule
in its configuration. That is all files (except test files) are evaluated with
the "main rules", even if they belong to sub-packages.
@alesforz alesforz changed the base branch from main to alesforz/cometbft-pebble November 18, 2024 15:49
@alesforz alesforz marked this pull request as ready for review November 18, 2024 16:04
@alesforz alesforz requested a review from a team as a code owner November 18, 2024 16:04
@alesforz alesforz requested a review from a team November 18, 2024 16:04
@alesforz alesforz changed the base branch from alesforz/cometbft-pebble to feature/remove-cometbftdb November 18, 2024 16:50
Copy link
Collaborator

@melekes melekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alesforz alesforz merged commit 4300bb9 into feature/remove-cometbftdb Nov 19, 2024
@alesforz alesforz deleted the alesforz/one-db-iface branch November 19, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P:tech-debt Priority: Technical debt that needs to be paid off to enable us to move faster, reliably storage

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants