Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

[typed_store] Write an iterator-based variant of multi_get #14

Closed
huitseeker opened this issue Feb 2, 2022 · 2 comments
Closed

[typed_store] Write an iterator-based variant of multi_get #14

huitseeker opened this issue Feb 2, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@huitseeker
Copy link
Contributor

  • multi_get was added in Added multi_get and Iter seek #2
  • its argument is a slice of values, leading to value copies, because we serialize each of these before passing them to the DB:
    multi_get(&self, keys: &[K]) -> Result<Vec<Option<V>>>
  • We should instead take an iterator with references or values for keys at Item (std::borrow::Borrow is useful here),
  • inspiration can be gleaned by the type of the delete_batch function, which takes the same sort of argument:
    pub fn delete_batch<J: Borrow<K>, K: Serialize, V>(
    mut self,
    db: &DBMap<K, V>,
    purged_vals: impl IntoIterator<Item = J>,
    ) -> Result<Self, TypedStoreError> {
  • this change should then be propagated downstream to packages using this.
@huitseeker huitseeker added enhancement New feature or request good first issue Good for newcomers labels Feb 2, 2022
@huitseeker
Copy link
Contributor Author

@akichidis
Copy link
Contributor

huitseeker added a commit to MystenLabs/sui that referenced this issue Mar 22, 2022
They don't need a vec since MystenLabs/mysten-infra#14 was solved.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants