-
Notifications
You must be signed in to change notification settings - Fork 296
Conversation
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
This allows addition of validator in the future Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
This allows addition of validator in the future Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/benchmark/CMakeLists.txt # test/benchmark/bm_proto_creation.cpp
Signed-off-by: Nikita Alekseev <[email protected]>
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # irohad/ametsuchi/impl/mutable_storage_impl.cpp # irohad/ametsuchi/impl/mutable_storage_impl.hpp # irohad/ametsuchi/impl/postgres_block_query.cpp # irohad/ametsuchi/impl/postgres_wsv_common.hpp # irohad/ametsuchi/impl/postgres_wsv_query.cpp # irohad/ametsuchi/impl/postgres_wsv_query.hpp # irohad/ametsuchi/impl/storage_impl.cpp # irohad/ametsuchi/impl/storage_impl.hpp # irohad/ametsuchi/impl/temporary_wsv_impl.cpp # irohad/ametsuchi/impl/temporary_wsv_impl.hpp # test/module/irohad/ametsuchi/CMakeLists.txt # test/module/irohad/ametsuchi/ametsuchi_fixture.hpp # test/module/irohad/ametsuchi/wsv_query_command_test.cpp # test/module/shared_model/backend_proto/CMakeLists.txt
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # irohad/ametsuchi/impl/mutable_storage_impl.cpp # irohad/ametsuchi/impl/mutable_storage_impl.hpp # irohad/ametsuchi/impl/postgres_block_query.cpp # irohad/ametsuchi/impl/postgres_wsv_common.hpp # irohad/ametsuchi/impl/postgres_wsv_query.cpp # irohad/ametsuchi/impl/postgres_wsv_query.hpp # irohad/ametsuchi/impl/storage_impl.cpp # irohad/ametsuchi/impl/storage_impl.hpp # irohad/ametsuchi/impl/temporary_wsv_impl.cpp # irohad/ametsuchi/impl/temporary_wsv_impl.hpp # test/module/irohad/ametsuchi/CMakeLists.txt # test/module/irohad/ametsuchi/ametsuchi_fixture.hpp # test/module/irohad/ametsuchi/wsv_query_command_test.cpp # test/module/shared_model/backend_proto/CMakeLists.txt
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/module/shared_model/backend_proto/CMakeLists.txt
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/module/shared_model/backend_proto/CMakeLists.txt
89b23bf
to
40d7996
Compare
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # test/module/shared_model/backend_proto/CMakeLists.txt
40d7996
to
c436031
Compare
…ects_factory_wsv_query Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # shared_model/backend/protobuf/common_objects/proto_common_objects_factory.hpp # shared_model/interfaces/common_objects/common_objects_factory.hpp # test/module/shared_model/backend_proto/common_objects/proto_common_objects_factory_test.cpp
cbd122a
to
482e712
Compare
@@ -24,8 +24,12 @@ | |||
#include <boost/optional.hpp> | |||
#include <cmath> | |||
#include <shared_mutex> | |||
|
|||
#include <boost/optional.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.
Is it the same include at line 24?
#include "interfaces/common_objects/account_asset.hpp" | ||
#include "interfaces/common_objects/asset.hpp" | ||
#include "interfaces/common_objects/domain.hpp" | ||
#include "interfaces/common_objects/signature.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.
Maybe replace it with a forward declaration since it has only declarations?
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.
Also domain include seems to be duplication
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.
The issues is with signature::SignedType. We cannot forward-declare inner classes.
storageResult.match( | ||
auto new_storage_result = | ||
StorageImpl::create(block_store_path, pgopt_, factory); | ||
new_storage_result.match( |
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.
Top!
auto factory = | ||
std::make_shared<shared_model::proto::ProtoCommonObjectsFactory< | ||
shared_model::validation::FieldValidator>>(); | ||
auto storageResult = StorageImpl::create(block_store_dir_, pg_conn_, factory); |
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.
Maybe create factory
variable directly inside StorageImpl::create(..)
? It's not used in code, and the space will be saved
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.
We want to isolate protobuf specific implementations from the rest of the system.
@@ -78,6 +80,12 @@ namespace iroha { | |||
|
|||
std::shared_ptr<soci::session> sql; | |||
|
|||
std::shared_ptr<shared_model::proto::ProtoCommonObjectsFactory< | |||
shared_model::validation::FieldValidator>> | |||
factory = |
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 not auto
?
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 a class member
@@ -216,7 +216,7 @@ TEST_F(AmetsuchiTest, SampleTest) { | |||
.build()})) | |||
.height(2) | |||
.prevHash(block1.hash()) | |||
.build(); | |||
.build(); |
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.
Empty space?
@@ -34,6 +36,11 @@ class StorageInitTest : public ::testing::Test { | |||
std::string pg_opt_without_dbname_; | |||
std::string pgopt_; | |||
|
|||
std::shared_ptr<shared_model::proto::ProtoCommonObjectsFactory< | |||
shared_model::validation::FieldValidator>> | |||
factory = std::make_shared<shared_model::proto::ProtoCommonObjectsFactory< |
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.
Again not auto
, is there a reason?
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # shared_model/backend/protobuf/common_objects/proto_common_objects_factory.hpp # shared_model/interfaces/common_objects/common_objects_factory.hpp # test/module/shared_model/backend_proto/common_objects/proto_common_objects_factory_test.cpp
@@ -17,6 +17,7 @@ | |||
|
|||
#include "ametsuchi/impl/postgres_wsv_query.hpp" | |||
#include "backend/protobuf/permissions.hpp" | |||
#include "common/result.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.
This include is presented in postgres_wsv_common.hpp. It is not necessary to have it here
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 better not to have transitive includes, so that if we change one header, we won't break stuff
@@ -284,16 +295,16 @@ namespace iroha { | |||
(sql_.prepare << "SELECT public_key, address FROM peer"); | |||
std::vector<std::shared_ptr<shared_model::interface::Peer>> peers; | |||
|
|||
auto results = transform< |
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 'transform' from postgres_wsv_common.hpp called from somewhere? Can the method be removed?
@@ -13,6 +13,10 @@ | |||
#include "interfaces/common_objects/peer.hpp" | |||
#include "interfaces/common_objects/types.hpp" | |||
#include "interfaces/common_objects/domain.hpp" | |||
#include "interfaces/common_objects/account_asset.hpp" | |||
#include "interfaces/common_objects/asset.hpp" | |||
#include "interfaces/common_objects/domain.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.
It is the duplication of line 15
Signed-off-by: Nikita Alekseev <[email protected]> # Conflicts: # shared_model/backend/protobuf/common_objects/proto_common_objects_factory.hpp # shared_model/interfaces/common_objects/common_objects_factory.hpp # test/module/shared_model/backend_proto/common_objects/proto_common_objects_factory_test.cpp
8970d8f
to
be92c27
Compare
SonarQube analysis reported 7 issues
|
Signed-off-by: Nikita Alekseev <[email protected]>
Signed-off-by: Nikita Alekseev <[email protected]>
Signed-off-by: Nikita Alekseev <[email protected]>
Signed-off-by: Nikita Alekseev <[email protected]>
Signed-off-by: Nikita Alekseev <[email protected]>
Signed-off-by: Nikita Alekseev <[email protected]>
Signed-off-by: Nikita Alekseev <[email protected]>
Description of the Change
Replace builders in wsv_query with common objects factory
Benefits
No dependency on builders
Possible Drawbacks
none