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

Endpoint: fetch blocked skylink hashes #4

Open
ro-tex opened this issue Nov 22, 2021 · 0 comments
Open

Endpoint: fetch blocked skylink hashes #4

ro-tex opened this issue Nov 22, 2021 · 0 comments

Comments

@ro-tex
Copy link
Collaborator

ro-tex commented Nov 22, 2021

Overview

This endpoint will allow clients to fetch the list of block skylink hashes.

Design or Proposal

Add a new endpoint such as GET /hash.

Requesting the data should allow for limiting the period by a timestamp (e.g. all records after 2021-11-11).

There are two ways we can go about delivering the data:

  • pagination
  • limit on number of records

Pagination

This approach is quite simple - break the data down into pages with predefined size and allow provide a link to the next page in the payload. If that link is not present then the user has the last page of data.

Example payload:

{
    "hashes": [ <JSON Array of hash objects> ],
    "nextPage": <link to the next page>
}

This approach can work with the other standard approach where the offset if given by query parameters.

The main advantage of this approach is that clients won't need to process the data before querying the next page.

Limit the number of records returned

This works in a slight less obvious way but it achieves the same thing - we still limit the number of records we return but we do not provide pagination. Instead, the user can read and parse the data, figure out the last timestamp present and make a new request with that timestamp+1ns.

The main advantage of this approach is the sheer simplicity of not implementing pagination at all.

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

No branches or pull requests

1 participant