-
Notifications
You must be signed in to change notification settings - Fork 3
feat(tx-cache): Pagination types and client impl #131
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
base: main
Are you sure you want to change the base?
Conversation
695f90e to
38133ea
Compare
38133ea to
9c99eeb
Compare
|
is this a breaking change for existing consumers of the api? i.e. if they are using an older version of the builder will their builder break if I deploy this version of the tx cache? |
|
Not technically a breaking change. The builder will still be able to fetch items from the cache as serde can partially deserialize JSON (it's a self-described format). They will be missing the pagination info, which is fine for now. I've added partial deser tests on the companion pagination PR to confirm this. |
|
these changes are currently breaking, as serde will expect pagination info to be present unless given a specific |
|
I would prefer to see something like: |
|
took a stab at the suggestion @prestwich, wdyt? |
prestwich
left a comment
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.
add serde roundtrip tests with what you think these json objects should look like.
If pagination params is a query, I don't think it's appropriate to use serde. Instead, there should be a method to apply it to a url?
crates/tx-cache/src/types.rs
Outdated
|
|
||
| /// A query for pagination. | ||
| #[derive(Clone, Debug, Serialize, Deserialize, Default)] | ||
| pub struct PaginationParams<C: CursorKey> { |
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.
why does this struct exist now?
8ab5d34 to
60b3efa
Compare

Adds cursor-based pagination types to the tx-cache crate. This allows us to implement pagination on the cache, and for the tx-cache client to be able to use pagination queries.
Getting all items in one of the collections in the cache is as simple as:
PaginationInfoPaginationInfointo the next request. This can easily be done by.into()ing aPaginationInfointo aPaginationParams.PaginationInfohas an utility method to detect this.These changes are not breaking for the current tx cache consumers.