-
Notifications
You must be signed in to change notification settings - Fork 297
Conversation
* Add transactions page response Signed-off-by: kamilsa <kamilsa16@gmail.com>
* Add transactions page response Signed-off-by: kamilsa <kamilsa16@gmail.com>
* tx pagination in proto * shared_model::interface::TxPaginationMeta class * shared_model::proto::TxPaginationMeta class * make PrettyStringBuilder constants static * fix validators module tests * added pagination_meta to queries' toString() Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
* FieldValidator::validateTxPaginationMeta * validation::TxPaginationMetaValidator * updated the paged query building Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
merged commits add: * Pimpl for QueryResponse * ITF: PortGuard Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
* removed TxPaginationMetaValidator * constref first_hash Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
…or_test (#1915) * postgres_query_executor_test: common tx pagination tests Signed-off-by: Mikhail Boldyrev <miboldyrev@gmail.com>
* Add documentation for queries pagination Signed-off-by: kamilsa <kamilsa16@gmail.com>
…/tx-queries-pagination
…rledger/iroha into trunk/tx-queries-pagination Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
% first_hash->hex()) | ||
.str(); | ||
// TODO: IR-82 nickaleks 7.12.18 | ||
// add status code for invalid pagination |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove TODO please
…/tx-queries-pagination
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, the issue with bindings can be ignored, but a warning note will definitely be useful.
#ifndef IROHA_SHARED_MODEL_PROTO_TRANSACTION_PAGE_RESPONSE_HPP | ||
#define IROHA_SHARED_MODEL_PROTO_TRANSACTION_PAGE_RESPONSE_HPP | ||
|
||
#include "backend/protobuf/common_objects/trivial_proto.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "interfaces/query_responses/transactions_page_response.hpp"
#include "backend/protobuf/common_objects/trivial_proto.hpp"
#include "backend/protobuf/transaction.hpp"
#include "interfaces/common_objects/types.hpp"
#include "qry_responses.pb.h"
|
||
namespace shared_model { | ||
namespace proto { | ||
class TransactionsPageResponse final |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File has to be renamed to proto_transactions_page_response.hpp
@@ -124,6 +124,34 @@ namespace shared_model { | |||
transactions, | |||
const crypto::Hash &query_hash) const = 0; | |||
|
|||
/** | |||
* Create response for transactions pagination query | |||
* @param transactions to be inserted into the response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really necessary to list the parameters with copied "x to be inserted into the response"? Please add some description to fields, or merge them into something like "Create response for transactions pagination query with given transactions, next_tx_hash..."
Same for method below.
.append("page_size", std::to_string(pageSize())); | ||
auto first_tx_hash = firstTxHash(); | ||
if (first_tx_hash) { | ||
pretty_builder = std::move( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String builder is mutable, so there is no need to reassign it. append
should be enough.
: public ModelPrimitive<TransactionsPageResponse> { | ||
public: | ||
/** | ||
* @return Attached transactions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this method require a doc while other methods do not?
: CopyableProto(std::forward<QueryResponseType>(queryResponse)), | ||
transactionPageResponse_{proto_->transactions_page_response()}, | ||
transactions_{[this] { | ||
return std::vector<proto::Transaction>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like lambda can be removed.
return ModelQueryBuilder(builder_.getAccountTransactions(account_id)); | ||
const interface::types::AccountIdType &account_id, | ||
interface::types::TransactionsNumberType page_size, | ||
const boost::optional<interface::types::HashType> &first_hash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is highly likely that optional is not wrapped with SWIG in an expected way. Please check java bindings and comment if it was successful or not.
} | ||
|
||
bool TransactionsPageResponse::operator==(const ModelType &rhs) const { | ||
return transactions() == rhs.transactions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it not required to also compare nextTxHash and allTransactionsSize?
|
||
// old compilers fail to deduce that a variant contains reference | ||
template <typename T, typename Variant> | ||
ConstRef<T> getRef(Variant &&v) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method is unused, please remove.
.build()); | ||
|
||
template <typename T> | ||
using ConstRef = const T &; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with unused, please remove.
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
Signed-off-by: Nikita Alekseev <n.alekseev2104@gmail.com>
…/tx-queries-pagination
Description of the Change
This Pull Request adds pagination to several queries. This allows to work on large data sets without returning all the data in a single request
Benefits
Better interface for queries
Possible Drawbacks
Nonne