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

Commit

Permalink
Replace builders with common_objects_factory in wsv_query (#1573)
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita Alekseev <[email protected]>
  • Loading branch information
nickaleks authored and l4l committed Jul 25, 2018
1 parent 25d6bad commit c9a652b
Show file tree
Hide file tree
Showing 24 changed files with 210 additions and 232 deletions.
4 changes: 4 additions & 0 deletions irohad/ametsuchi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ target_link_libraries(ametsuchi
SOCI::core
SOCI::postgresql
)

target_compile_definitions(ametsuchi
PRIVATE SOCI_USE_BOOST HAVE_BOOST
)
6 changes: 4 additions & 2 deletions irohad/ametsuchi/impl/mutable_storage_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@
#include "ametsuchi/impl/postgres_wsv_command.hpp"
#include "ametsuchi/impl/postgres_wsv_query.hpp"
#include "ametsuchi/wsv_command.hpp"
#include "interfaces/common_objects/common_objects_factory.hpp"
#include "model/sha3_hash.hpp"

namespace iroha {
namespace ametsuchi {
MutableStorageImpl::MutableStorageImpl(
shared_model::interface::types::HashType top_hash,
std::unique_ptr<soci::session> sql)
std::unique_ptr<soci::session> sql,
std::shared_ptr<shared_model::interface::CommonObjectsFactory> factory)
: top_hash_(top_hash),
sql_(std::move(sql)),
wsv_(std::make_shared<PostgresWsvQuery>(*sql_)),
wsv_(std::make_shared<PostgresWsvQuery>(*sql_, factory)),
executor_(std::make_shared<PostgresWsvCommand>(*sql_)),
block_index_(std::make_unique<PostgresBlockIndex>(*sql_)),
command_executor_(std::make_shared<CommandExecutor>(wsv_, executor_)),
Expand Down
5 changes: 4 additions & 1 deletion irohad/ametsuchi/impl/mutable_storage_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "ametsuchi/mutable_storage.hpp"
#include "execution/command_executor.hpp"
#include "interfaces/common_objects/common_objects_factory.hpp"
#include "logger/logger.hpp"

namespace iroha {
Expand All @@ -37,7 +38,9 @@ namespace iroha {

public:
MutableStorageImpl(shared_model::interface::types::HashType top_hash,
std::unique_ptr<soci::session> sql);
std::unique_ptr<soci::session> sql,
std::shared_ptr<shared_model::interface::CommonObjectsFactory>
factory);

bool apply(
const shared_model::interface::Block &block,
Expand Down
2 changes: 1 addition & 1 deletion irohad/ametsuchi/impl/postgres_block_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <boost/format.hpp>

#include "ametsuchi/impl/block_index.hpp"
#include "ametsuchi/impl/postgres_wsv_common.hpp"
#include "ametsuchi/impl/soci_utils.hpp"
#include "interfaces/transaction.hpp"
#include "logger/logger.hpp"

Expand Down
2 changes: 1 addition & 1 deletion irohad/ametsuchi/impl/postgres_block_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "ametsuchi/block_query.hpp"
#include "ametsuchi/impl/flat_file/flat_file.hpp"
#include "logger/logger.hpp"
#include "postgres_wsv_common.hpp"
#include "ametsuchi/impl/soci_utils.hpp"

namespace iroha {
namespace ametsuchi {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef IROHA_POSTGRES_ORDERING_SERVICE_PERSISTENT_STATE_HPP
#define IROHA_POSTGRES_ORDERING_SERVICE_PERSISTENT_STATE_HPP

#include "ametsuchi/impl/postgres_wsv_common.hpp"
#include "ametsuchi/impl/soci_utils.hpp"
#include "ametsuchi/ordering_service_persistent_state.hpp"
#include "common/result.hpp"
#include "logger/logger.hpp"
Expand Down
8 changes: 8 additions & 0 deletions irohad/ametsuchi/impl/postgres_wsv_command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@

#include "ametsuchi/impl/postgres_wsv_command.hpp"

#include <numeric>

#include <boost/format.hpp>

#include "backend/protobuf/permissions.hpp"
#include "interfaces/common_objects/account.hpp"
#include "interfaces/common_objects/account_asset.hpp"
#include "interfaces/common_objects/asset.hpp"
#include "interfaces/common_objects/domain.hpp"
#include "interfaces/common_objects/peer.hpp"

namespace iroha {
namespace ametsuchi {
Expand Down
2 changes: 1 addition & 1 deletion irohad/ametsuchi/impl/postgres_wsv_command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "ametsuchi/wsv_command.hpp"

#include "ametsuchi/impl/postgres_wsv_common.hpp"
#include "ametsuchi/impl/soci_utils.hpp"

namespace iroha {
namespace ametsuchi {
Expand Down
176 changes: 0 additions & 176 deletions irohad/ametsuchi/impl/postgres_wsv_common.hpp

This file was deleted.

Loading

0 comments on commit c9a652b

Please sign in to comment.