Skip to content

feat: Added primary indexes and GraphQL interface. #12

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 13 commits into from
Mar 18, 2024

Conversation

ajnavarro
Copy link
Collaborator

@ajnavarro ajnavarro commented Feb 14, 2024

  • Added graphQL API using 99designs/gqlgen. Really easy to use interface throught GraphQL playground, with a ton of extra documentation explaining all the Query functions and filter parameters.
  • Store Transactions by block height and index, making them queriable
  • Added a ton of special encoders on storage/encode.go. They are intended to be used as a fast, sortable way to encode/decode keys on any key/value store. That allows us to use advanced features when iterating keys, like adding upper and lower keys as limiters, or in the future adding secondary indexes.
  • BREAKING CHANGE: I had to change prefixes on pebble keys to make them queriable, so previous db states are invalid.
  • Added BlockIterator and TxIterator to Reader storage interface.

Easy, standard, graphQL API with documentation:

graphql-docs

Easy filtering and data querying:

graphql-complex-demo

Subscriptions!:

subscriptions

@ajnavarro ajnavarro self-assigned this Feb 14, 2024
@ajnavarro ajnavarro marked this pull request as ready for review February 19, 2024 15:35
@ajnavarro ajnavarro requested a review from a team as a code owner February 19, 2024 15:35
@zivkovicmilos zivkovicmilos self-requested a review February 19, 2024 16:17
@ajnavarro ajnavarro mentioned this pull request Feb 26, 2024
@harry-hov harry-hov self-requested a review March 4, 2024 16:01
Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initial comments from reviewing together; will continue this afternoon

Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what happened but I ended up with 18 comments

Great work, no major comments 🙌 🎉

@ajnavarro ajnavarro requested a review from thehowl March 7, 2024 15:15
@ajnavarro ajnavarro force-pushed the feature/indexes-on-storage branch from 6b2856a to 01ff43f Compare March 7, 2024 15:40
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great 💯

The feature is amazing, I really love it -- it's something I will actively use for all of my projects / clients.

The only thing that we need to change (keep) is the ability to keep lookups using transaction hashes, because it's a critical feature. I am completely in favor of having an index that maps hashes to the block number / tx index, but the ability to ask the indexer for the transaction result using a tx hash needs to stay.

Thank you for adding this feature, and for optimizing the way we utilize pebble - it was a joy to read 👏

@ajnavarro ajnavarro requested a review from zivkovicmilos March 14, 2024 14:49
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for resolving the convos, now the functionality is air tight 💯

- Added graphQL API using 99designs/gqlgen. Really easy to use interface throught GraphQL playground, with a ton of extra documentation explaining all the Query functions and filter parameters.
- Store Transactions by block height and index, making them queriable
- Added a ton of special encoders on storage/encode.go. They are intended to be used as a fast, sortable way to encode/decode keys on any key/value store. That allows us to use advanced features when iterating keys, like adding upper and lower keys as limiters, or in the future adding secondary indexes.
- BREAKING CHANGE: I had to change prefixes on pebble keys to make them queriable, so previous db states are invalid.
- Added BlockIterator and TxIterator to Reader storage interface.

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
@ajnavarro ajnavarro force-pushed the feature/indexes-on-storage branch from c2cdb79 to 05edf24 Compare March 18, 2024 10:08
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
@ajnavarro ajnavarro merged commit ac3eda5 into main Mar 18, 2024
@ajnavarro ajnavarro deleted the feature/indexes-on-storage branch March 18, 2024 10:45
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants