-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
[typed store] enable iterator methods for in_memory_db and tidehunter #21709
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
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.
Looks good, I added some suggestions
@@ -544,8 +544,7 @@ impl ObjectStore for AuthorityPerpetualTables { | |||
} | |||
|
|||
pub struct LiveSetIter<'a> { | |||
iter: | |||
<DBMap<ObjectKey, StoreObjectWrapper> as Map<'a, ObjectKey, StoreObjectWrapper>>::SafeIterator, | |||
iter: Box<dyn Iterator<Item = Result<(ObjectKey, StoreObjectWrapper), TypedStoreError>> + 'a>, |
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 can make a type alias in typed-store crate for this iterator since it seem to repeat very often.
Something like
type DbIterator<T> = Box<dyn Iterator<Item = Result<T, TypedStoreError>>>
crates/typed-store/src/util.rs
Outdated
use typed_store_error::TypedStoreError; | ||
|
||
#[inline] | ||
pub fn be_fix_int_ser<S>(t: &S) -> Result<Vec<u8>, TypedStoreError> |
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.
Seeing that in all call sites of this function we just call expect
on the results, perhaps it makes sense to just call expect
inside of this function and not return Result
?
9dbbf5e
to
4c52210
Compare
Description
PR enables iterator methods for in_memory_db and tidehunter
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.