Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

GetAccountTransactions Pagination #1903

Merged

Conversation

nickaleks
Copy link
Contributor

Description of the Change

This PR introduces pagination logic to get account transactions query.
You can now specify starting hash and page size of the response.

Benefits

Pagination

Possible Drawbacks

Slower queries due to added complexity

Alternate Designs [optional]

In several places, additional indexes can be introduced in the future to optimize query

Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
@nickaleks nickaleks changed the title GetAccountTransactionsPagination GetAccountTransactions Pagination Dec 3, 2018
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
@nickaleks nickaleks force-pushed the feature/get_transactions_pagination branch from b1b287a to 81a1fd4 Compare December 4, 2018 10:49
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
@@ -606,9 +606,10 @@ CREATE TABLE IF NOT EXISTS account_has_grantable_permissions (
+ R"() NOT NULL,
PRIMARY KEY (permittee_account_id, account_id)
);
CREATE TABLE IF NOT EXISTS height_by_hash (
Copy link
Contributor

Choose a reason for hiding this comment

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

We still have that table in ametsuchi fixture. Replace it there as well

using PermissionTuple = boost::tuple<int>;

auto cmd = (boost::format(R"(WITH has_perms AS (%s),
auto &pagination_info = q.paginationMeta();
Copy link
Contributor

Choose a reason for hiding this comment

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

If paginationMeta() returns constref, it should be const auto &pagination_info


return query_response_factory_->createTransactionsResponse(
std::move(response_txs), query_hash_);
// next transaction exists
Copy link
Contributor

Choose a reason for hiding this comment

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

Not very clear comment, please expand it a little

framework::SpecifiedVisitor<
shared_model::interface::AccountResponse>(),
result->get());
const auto &cast_resp = getRef<AccountResponse>(result->get());
Copy link
Contributor

Choose a reason for hiding this comment

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

Please, cancel changes in existing tests, as there will be a significant amount of conflicts with this PR when merging

@nickaleks nickaleks force-pushed the feature/get_transactions_pagination branch 2 times, most recently from 5dbe520 to a14daa4 Compare December 5, 2018 11:45
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
@nickaleks nickaleks merged commit d6eaaf4 into trunk/tx-queries-pagination Dec 6, 2018
@nickaleks nickaleks deleted the feature/get_transactions_pagination branch December 6, 2018 06:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants