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

cursor-style pagination? #41

Closed
roadscape opened this issue Dec 6, 2017 · 1 comment
Closed

cursor-style pagination? #41

roadscape opened this issue Dec 6, 2017 · 1 comment

Comments

@roadscape
Copy link
Contributor

currently with steemd all "posts" queries take a start (author,permlink) as a cursor to load successive pages from. hive just uses offset/limit. if we want to replicate existing APIs (nearly) 100% we would need to add the cursor option. this involves a bit more complexity because we'll need to perform a lookup on the column we're ordering by based on the author-permlink provided to know on which value to start. aside from the extra queries an upside is that seeking could be more efficient than simple offset; it's more infinite-scroll friendly; and, may be more consistent when result rows are 'moving' around.

for reference:

struct discussion_query {
   void validate()const{
      FC_ASSERT( filter_tags.find(tag) == filter_tags.end() );
      FC_ASSERT( limit <= 100 );
   }

   string           tag;
   uint32_t         limit = 0;
   set<string>      filter_tags;
   set<string>      select_authors; ///< list of authors to include, posts not by this author are filtered
   set<string>      select_tags; ///< list of tags to include, posts without these tags are filtered
   uint32_t         truncate_body = 0; ///< the number of bytes of the post body to return, 0 for all
   optional<string> start_author;
   optional<string> start_permlink;
   optional<string> parent_author;
   optional<string> parent_permlink;
};
@roadscape
Copy link
Contributor Author

cursor-style pagination is being implemented as a requirement for legacy api (#19).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant