-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(storage) L1BlockManager
#552
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #552 +/- ##
==========================================
- Coverage 56.76% 56.67% -0.10%
==========================================
Files 306 308 +2
Lines 31263 31364 +101
==========================================
+ Hits 17747 17774 +27
- Misses 13516 13590 +74
|
But now you're introducing new paradigms and consumers have to import additional traits to use it in addition to using the type itself. Why? Can we discuss things in #eng or in meetings before we start changing strategy here so that we consider all the needs across the team? |
This also still retains the |
use crate::cache::{self, CacheTable}; | ||
|
||
/// Caching manager of L1 blocks in the block database. | ||
pub struct L1BlockManager<DB> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the major reasons to have managers was to be free from these Db generics. The Ops
construct was to facilitate this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What issues would arise from having this generic here if the compiler is going to infer it anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to pass it down through everything that wants to interact with the database / manager, which becomes cumbersome.
This is not really a new paradigm - there's no need for a inst_ops macro and the current implementation is very convoluted and jumps through many hoops to achieve the same thing. I'm not sure I understand how importing a trait could be problematic either |
The need is that it cleanly wraps up all the machinery to implement async and blocking calls over a simpler blocking database interface and give some extra space for future indirection in the |
I'm not sure what you mean by this, but the async version is just a generated version of the original sync trait. "The machinery" is just spawning it on a thread pool and waiting for a oneshot which is implemented via a trait. Synchronously we just implement the original sync trait and the caller can just decides what works best. |
The main issue right now is that this doesn't remove the need to pass around the generic type parameter as in the current strategy. We don't want the manager to just transparently implement the database traits but with additional caching, we want it to be the high level interface that can hide the implementation details. This is more apparent in the intention for the chainstate manager, which we want to be the main thing handling reconstructing arbitrary states from the checkpointed states and writes. The architecture with the other managers/ops also gives a lot of flexibility for transparently adding things like metrics collection to improve visibility. The generics are great for performance sensitive code (because of monomorphization helping with automatic inlining) or logic that's highly abstracted (with associated types). But this isn't that, we're just using them for indirection between different underlying database impls. |
Description
This PR adds a
L1BlockManager
struct that handles caching of L1 block data.Type of Change
Notes to Reviewers
I'm not using
inst_ops!
because it's kinda manky 🦨Checklist
Related Issues
STR-797