Skip to content

Commit

Permalink
Correct naming of ON_PROCESS status and update of cpp_redis
Browse files Browse the repository at this point in the history
- Update cpp_redis and tacopie library up to 4.3.0 version with fixes
- Change ON_PROCESS to IN_PROGRESS
- Fix failing tests in Torii module
- Add removal of CLion debug folder in clean.sh

Signed-off-by: Nikolay Yushkevich <[email protected]>
  • Loading branch information
neewy authored and kamilsa committed Dec 27, 2017
1 parent f3b78c2 commit 146d3ae
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 30 deletions.
1 change: 1 addition & 0 deletions clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
rm schema/*.{cc,h}
rm -rf external
rm -rf build
rm -rf cmake-build-debug
4 changes: 2 additions & 2 deletions cmake/Modules/Findcpp_redis.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ find_package_handle_standard_args(cpp_redis DEFAULT_MSG
)

set(URL1 https://github.com/Cylix/cpp_redis.git)
set(VERSION1 727aa5f06c8ce498168cbab5a023cad5b9c00bc0)
set(VERSION1 f390eef447a62dcb6da288fb1e91f25f8a9b838c)
set_target_description(cpp_redis "C++ redis client" ${URL1} ${VERSION1})

set(URL2 https://github.com/Cylix/tacopie.git)
set(VERSION2 290dc38681f346adae41d3cc8feabbe534424675)
set(VERSION2 4c551b8ff1c53c5fa63286371c9c884254fc9423)
set_target_description(tacopie "C++ tcp library" ${URL2} ${VERSION2})

if (NOT cpp_redis_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion iroha-cli/interactive/impl/interactive_status_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace iroha_cli {
"Transaction has successfully passed stateful validation."},
{iroha::protocol::TxStatus::COMMITTED,
"Transaction was successfully committed."},
{iroha::protocol::TxStatus::IN_PROCESS,
{iroha::protocol::TxStatus::IN_PROGRESS,
"Transaction is being processed at the moment."},
{iroha::protocol::TxStatus::NOT_RECEIVED,
"Transaction was not found in the system."}};
Expand Down
2 changes: 1 addition & 1 deletion irohad/ametsuchi/impl/mutable_storage_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace iroha {
namespace ametsuchi {
MutableStorageImpl::MutableStorageImpl(
hash256_t top_hash,
std::unique_ptr<cpp_redis::redis_client> index,
std::unique_ptr<cpp_redis::client> index,
std::unique_ptr<pqxx::lazyconnection> connection,
std::unique_ptr<pqxx::nontransaction> transaction,
std::shared_ptr<model::CommandExecutorFactory> command_executors)
Expand Down
6 changes: 3 additions & 3 deletions irohad/ametsuchi/impl/mutable_storage_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "ametsuchi/mutable_storage.hpp"

#include <unordered_map>
#include <cpp_redis/redis_client.hpp>
#include <cpp_redis/cpp_redis>
#include <pqxx/connection>
#include <pqxx/nontransaction>

Expand All @@ -35,7 +35,7 @@ namespace iroha {

public:
MutableStorageImpl(
hash256_t top_hash, std::unique_ptr<cpp_redis::redis_client> index,
hash256_t top_hash, std::unique_ptr<cpp_redis::client> index,
std::unique_ptr<pqxx::lazyconnection> connection,
std::unique_ptr<pqxx::nontransaction> transaction,
std::shared_ptr<model::CommandExecutorFactory> command_executors);
Expand All @@ -52,7 +52,7 @@ namespace iroha {
// ordered collection is used to enforce block insertion order in
// StorageImpl::commit
std::map<uint32_t, model::Block> block_store_;
std::unique_ptr<cpp_redis::redis_client> index_;
std::unique_ptr<cpp_redis::client> index_;

std::unique_ptr<pqxx::lazyconnection> connection_;
std::unique_ptr<pqxx::nontransaction> transaction_;
Expand Down
2 changes: 1 addition & 1 deletion irohad/ametsuchi/impl/redis_block_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
namespace iroha {
namespace ametsuchi {

RedisBlockIndex::RedisBlockIndex(cpp_redis::redis_client &client)
RedisBlockIndex::RedisBlockIndex(cpp_redis::client &client)
: client_(client),
account_id_height_("%s:%s"),
account_id_height_asset_id_("%s:%s:%s") {}
Expand Down
6 changes: 3 additions & 3 deletions irohad/ametsuchi/impl/redis_block_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
#include "ametsuchi/impl/block_index.hpp"

#include <boost/format.hpp>
#include <cpp_redis/redis_client.hpp>
#include <cpp_redis/cpp_redis>

namespace iroha {
namespace ametsuchi {
class RedisBlockIndex : public BlockIndex {
public:
explicit RedisBlockIndex(cpp_redis::redis_client &client);
explicit RedisBlockIndex(cpp_redis::client &client);

void index(const model::Block &block) override;

Expand All @@ -54,7 +54,7 @@ namespace iroha {
const std::string &index,
const model::Transaction::CommandsType &commands);

cpp_redis::redis_client &client_;
cpp_redis::client &client_;
/// format strings for index keys
boost::format account_id_height_, account_id_height_asset_id_;
};
Expand Down
2 changes: 1 addition & 1 deletion irohad/ametsuchi/impl/redis_block_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
namespace iroha {
namespace ametsuchi {

RedisBlockQuery::RedisBlockQuery(cpp_redis::redis_client &client,
RedisBlockQuery::RedisBlockQuery(cpp_redis::client &client,
FlatFile &file_store)
: block_store_(file_store), client_(client) {}

Expand Down
6 changes: 3 additions & 3 deletions irohad/ametsuchi/impl/redis_block_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef IROHA_REDIS_FLAT_BLOCK_QUERY_HPP
#define IROHA_REDIS_FLAT_BLOCK_QUERY_HPP

#include <cpp_redis/redis_client.hpp>
#include <cpp_redis/cpp_redis>
#include "ametsuchi/block_query.hpp"
#include "ametsuchi/impl/flat_file/flat_file.hpp"

Expand All @@ -33,7 +33,7 @@ namespace iroha {
*/
class RedisBlockQuery : public BlockQuery {
public:
RedisBlockQuery(cpp_redis::redis_client &client, FlatFile &file_store);
RedisBlockQuery(cpp_redis::client &client, FlatFile &file_store);

rxcpp::observable<model::Transaction> getAccountTransactions(
const std::string &account_id) override;
Expand Down Expand Up @@ -82,7 +82,7 @@ namespace iroha {
const rxcpp::subscriber<model::Transaction> &s, uint64_t block_id);

FlatFile &block_store_;
cpp_redis::redis_client &client_;
cpp_redis::client &client_;
model::converters::JsonBlockFactory serializer_;
};
} // namespace ametsuchi
Expand Down
8 changes: 4 additions & 4 deletions irohad/ametsuchi/impl/storage_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace iroha {
std::size_t redis_port,
std::string postgres_options,
std::unique_ptr<FlatFile> block_store,
std::unique_ptr<cpp_redis::redis_client> index,
std::unique_ptr<cpp_redis::client> index,
std::unique_ptr<pqxx::lazyconnection> wsv_connection,
std::unique_ptr<pqxx::nontransaction> wsv_transaction)
: block_store_dir_(std::move(block_store_dir)),
Expand Down Expand Up @@ -94,7 +94,7 @@ namespace iroha {
auto wsv_transaction = std::make_unique<pqxx::nontransaction>(
*postgres_connection, "TemporaryWsv");

auto index = std::make_unique<cpp_redis::redis_client>();
auto index = std::make_unique<cpp_redis::client>();
try {
index->connect(redis_host_, redis_port_);
} catch (const cpp_redis::redis_error &e) {
Expand Down Expand Up @@ -159,7 +159,7 @@ DROP TABLE IF EXISTS role;

// erase tx index
log_->info("drop redis");
cpp_redis::redis_client client;
cpp_redis::client client;
client.connect(redis_host_, redis_port_);
client.flushall();
client.sync_commit();
Expand All @@ -184,7 +184,7 @@ DROP TABLE IF EXISTS role;
}
log_->info("block store created");

auto index = std::make_unique<cpp_redis::redis_client>();
auto index = std::make_unique<cpp_redis::client>();
try {
index->connect(redis_host, redis_port);
} catch (const cpp_redis::redis_error &e) {
Expand Down
8 changes: 4 additions & 4 deletions irohad/ametsuchi/impl/storage_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace iroha {

struct ConnectionContext {
ConnectionContext(std::unique_ptr<FlatFile> block_store,
std::unique_ptr<cpp_redis::redis_client> index,
std::unique_ptr<cpp_redis::client> index,
std::unique_ptr<pqxx::lazyconnection> pg_lazy,
std::unique_ptr<pqxx::nontransaction> pg_nontx)
: block_store(std::move(block_store)),
Expand All @@ -45,7 +45,7 @@ namespace iroha {
}

std::unique_ptr<FlatFile> block_store;
std::unique_ptr<cpp_redis::redis_client> index;
std::unique_ptr<cpp_redis::client> index;
std::unique_ptr<pqxx::lazyconnection> pg_lazy;
std::unique_ptr<pqxx::nontransaction> pg_nontx;
};
Expand Down Expand Up @@ -84,7 +84,7 @@ namespace iroha {
std::size_t redis_port,
std::string postgres_options,
std::unique_ptr<FlatFile> block_store,
std::unique_ptr<cpp_redis::redis_client> index,
std::unique_ptr<cpp_redis::client> index,
std::unique_ptr<pqxx::lazyconnection> wsv_connection,
std::unique_ptr<pqxx::nontransaction> wsv_transaction);

Expand All @@ -104,7 +104,7 @@ namespace iroha {
/**
* Redis connection
*/
std::unique_ptr<cpp_redis::redis_client> index_;
std::unique_ptr<cpp_redis::client> index_;

/**
* Pg connection with direct transaction management
Expand Down
2 changes: 1 addition & 1 deletion irohad/model/transaction_response.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace iroha {
STATEFUL_VALIDATION_FAILED, // stateful validation failed
STATEFUL_VALIDATION_SUCCESS, // stateful validation passed
COMMITTED, // tx pipeline succeeded, tx is committed
ON_PROCESS, // transaction is received, but not validated
IN_PROGRESS, // transaction is received, but not validated
NOT_RECEIVED // transaction is not in handler map
};

Expand Down
6 changes: 3 additions & 3 deletions irohad/torii/impl/command_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ namespace torii {
case iroha::model::TransactionResponse::COMMITTED:
res->set_tx_status(iroha::protocol::TxStatus::COMMITTED);
break;
case iroha::model::TransactionResponse::ON_PROCESS:
res->set_tx_status(iroha::protocol::TxStatus::ON_PROCESS);
case iroha::model::TransactionResponse::IN_PROGRESS:
res->set_tx_status(iroha::protocol::TxStatus::IN_PROGRESS);
break;
case iroha::model::TransactionResponse::NOT_RECEIVED:
default:
Expand All @@ -89,7 +89,7 @@ namespace torii {

iroha::protocol::ToriiResponse response;
response.set_tx_hash(tx_hash);
response.set_tx_status(iroha::protocol::TxStatus::ON_PROCESS);
response.set_tx_status(iroha::protocol::TxStatus::IN_PROGRESS);

cache_->addItem(tx_hash, response);
// Send transaction to iroha
Expand Down
9 changes: 8 additions & 1 deletion irohad/torii/torii_service_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ namespace torii {
/**
* shuts down service handler. (actually, shuts down completion queue only)
*/
void ToriiServiceHandler::shutdown() { completionQueue_->Shutdown(); }
void ToriiServiceHandler::shutdown() { completionQueue_->Shutdown();
void* tag = nullptr;
bool ok = false;

while (completionQueue_->Next(&tag, &ok)){
//wait until completion queue shuts down
}
}

/**
* handles rpcs loop in CommandService.
Expand Down
2 changes: 1 addition & 1 deletion schema/endpoint.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum TxStatus {
STATEFUL_VALIDATION_FAILED = 2;
STATEFUL_VALIDATION_SUCCESS = 3;
COMMITTED = 4;
IN_PROCESS = 5;
IN_PROGRESS = 5;
NOT_RECEIVED = 6;
}

Expand Down
2 changes: 1 addition & 1 deletion test/module/irohad/ametsuchi/ametsuchi_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ DROP TABLE IF EXISTS role;

std::shared_ptr<pqxx::lazyconnection> connection;

cpp_redis::redis_client client;
cpp_redis::client client;

model::generators::CommandGenerator cmd_gen;

Expand Down

0 comments on commit 146d3ae

Please sign in to comment.