Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve DB provider API #9400

Closed
Rjected opened this issue Jul 9, 2024 · 0 comments · Fixed by #9412
Closed

Improve DB provider API #9400

Rjected opened this issue Jul 9, 2024 · 0 comments · Fixed by #9412
Assignees
Labels
A-db Related to the database C-enhancement New feature or request

Comments

@Rjected
Copy link
Member

Rjected commented Jul 9, 2024

Describe the feature

Currently we have a lot of methods that use a TAKE const internally, and we use this method often for removing things from the database. However, we also need a method that actually removes the elements from the database, without allocating. We also do not need to use a const for this.

Examples include:

  • get_or_take
  • get_or_take_block_and_execution_range
  • unwind_or_peek_state

Instead, we should have:

  • get
  • take
  • remove
  • get_block_and_execution_range
  • take_block_and_execution_range
  • remove_block_and_execution_range
  • unwind_state (or take_state)
  • get_state
  • remove_state
  • etc...

This would also allow us to remove get_block_and_execution_range from the BlockWriter trait, if we wanted to have a more clear Read/Write distinction in our traits. This method is in the BlockWriter trait likely because the get_or_take method requires TX: DbTxMut. Ideally the get methods don't need this bound

Additional context

No response

@Rjected Rjected added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Jul 9, 2024
@Rjected Rjected added A-db Related to the database and removed S-needs-triage This issue needs to be labelled labels Jul 9, 2024
@Rjected Rjected self-assigned this Jul 9, 2024
Rjected added a commit that referenced this issue Jul 9, 2024
This allows for the use of ranges in `unwind_table_by_walker`, which is
required for this method to be used in other methods which take a range
as input.

ref #9400
Rjected added a commit that referenced this issue Jul 9, 2024
This adds a remove method that can be used in places where we're not
using the output of `get_or_take`, and just need to remove a range of
entries from a table.

ref #9400
Rjected added a commit that referenced this issue Jul 9, 2024
This separates functionality into individual `get` and `take` methods,
which are used internally for the `get_or_take` method.

ref #9400
Rjected added a commit that referenced this issue Jul 9, 2024
This separates functionality into individual `get` and `take` methods,
which are used internally for the `get_or_take` method.

ref #9400
@github-project-automation github-project-automation bot moved this from Todo to Done in Reth Tracker Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-db Related to the database C-enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant