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

database: Test heed get_range #350

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gzalz
Copy link

@gzalz gzalz commented Nov 27, 2024

What

Test the get_range function in storage/database/src/backend/heed/database.rs.

Why

This is meant to address issue #348 .

Where

This is related to the heed database backend and related tests.

How

This PR is meant to address a perceived misunderstanding in issue #348 . The table insertions in the test have incrementing keys but all have a value equal to 0u64.

get_range is defined to return Values rather than Keys, as per the function signature, yet in the reproduction code all the Values must equal 0.

impl<T: Table> DatabaseIter<T> for HeedTableRo<'_, T> {
    #[inline]
    fn get_range<'a, Range>(
        &'a self,
        range: Range,
    ) -> Result<impl Iterator<Item = Result<T::Value, RuntimeError>> + 'a, RuntimeError>
    where
        Range: RangeBounds<T::Key> + 'a

If we wish to test get_range we should be checking the Values within the new loop, as this is what get_range returns. I believe the functionality of get_range is correct.

@github-actions github-actions bot added the A-storage Related to storage. label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-storage Related to storage.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants