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

[WIP] Querys & Views #1701

Closed
wants to merge 6 commits into from
Closed

[WIP] Querys & Views #1701

wants to merge 6 commits into from

Conversation

dignifiedquire
Copy link
Contributor

Description

Implementation of #1667

@ramfox ramfox added this to the v0.10.0 milestone Nov 1, 2023
@ramfox ramfox assigned ramfox and Frando and unassigned ramfox Nov 1, 2023
@ramfox ramfox added the c-api iroh-api crate issues label Nov 1, 2023
@Frando Frando mentioned this pull request Nov 2, 2023
3 tasks
@Frando
Copy link
Member

Frando commented Nov 3, 2023

Closing in favor of #1766

@Frando Frando closed this Nov 3, 2023
github-merge-queue bot pushed a commit that referenced this pull request Nov 7, 2023
## Description

Implementation of #1667, extends #1701

With the following changes after discussions in Discord:

* Remove the notion of views, instead embed the info in the query. If
the high-level concept of views makes more sense for people from an API
perspective, we can restore it in the client api. However under the hood
the query details are different per view, this is why here I expose a
single `Query` struct
* Add a query builder with a typestate to only allow possible
combinations
* Add an index to the redb (fs) document store to make queries that are
sorted by key, or that are filtered by key but not by author, efficient.
This also is what allows to do queries for the "latest only" entry per
key, without allocating the full result set.

In the process I did a refactoring of the redb store to be safer to use.
Especially, I moved the `ouroboros` self-referencing stuff into a
`ranges` module, and encapsulated in an inner type to keep the
self-referencing compilcations scoped. Also did something I had mind for
a while: Add some type-safe abstractions around the range bounds
constructions that are used when selecting on redb tables. All this
turned out quite nice, IMO.

Also contains the changes from #1772 : 
* Renames `get_one` to `get_exact`
* Add flag to `get_exact` whether to include empty entries or not
* Add `get_one` to `iroh::client::Doc` to get a single entry with the
same query mechanisms as `get_many`


Open questions and tasks:
* Naming review of the query builder methods
* Integration of the query parameters in the console


## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the PR.
-->

## Change checklist

- [x] Self-review.
- [x] Documentation updates if relevant.
- [ ] Tests if relevant.

---------

Co-authored-by: dignifiedquire <me@dignifiedquire.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-api iroh-api crate issues
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants