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

feat: Added primary indexes and GraphQL interface. #12

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
@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

Makefile Show resolved Hide resolved
storage/encode.go Outdated Show resolved Hide resolved
storage/encode.go Show resolved Hide resolved
storage/encode.go Show resolved Hide resolved
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 🙌 🎉

tools.go Show resolved Hide resolved
storage/encode.go Outdated Show resolved Hide resolved
storage/encode.go Show resolved Hide resolved
storage/encode.go Show resolved Hide resolved
storage/pebble.go Show resolved Hide resolved
serve/graph/schema.graphql Show resolved Hide resolved
serve/graph/schema.resolvers.go Outdated Show resolved Hide resolved
serve/graph/resolver.go Outdated Show resolved Hide resolved
serve/graph/model/block.go Show resolved Hide resolved
gqlgen.yml Show resolved Hide resolved
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 👏

gqlgen.yml Show resolved Hide resolved
client/batch.go Show resolved Hide resolved
cmd/start.go Show resolved Hide resolved
serve/server.go Show resolved Hide resolved
serve/handlers/tx/tx.go Show resolved Hide resolved
storage/encode.go Show resolved Hide resolved
storage/pebble.go Show resolved Hide resolved
storage/types.go Show resolved Hide resolved
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 <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
Signed-off-by: Antonio Navarro Perez <[email protected]>
@ajnavarro ajnavarro merged commit ac3eda5 into main Mar 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants