hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
irohad.cpp File Reference
#include <gflags/gflags.h>
#include <grpc++/grpc++.h>
#include <chrono>
#include <csignal>
#include <fstream>
#include <future>
#include <thread>
#include "ametsuchi/storage.hpp"
#include "backend/protobuf/common_objects/proto_common_objects_factory.hpp"
#include "common/bind.hpp"
#include "common/files.hpp"
#include "common/hexutils.hpp"
#include "common/irohad_version.hpp"
#include "common/result.hpp"
#include "crypto/keys_manager_impl.hpp"
#include "cryptography/ed25519_sha3_impl/crypto_provider.hpp"
#include "cryptography/private_key.hpp"
#include "logger/logger.hpp"
#include "logger/logger_manager.hpp"
#include "main/application.hpp"
#include "main/impl/pg_connection_init.hpp"
#include "main/impl/rocksdb_connection_init.hpp"
#include "main/iroha_conf_literals.hpp"
#include "main/iroha_conf_loader.hpp"
#include "main/raw_block_loader.hpp"
#include "maintenance/metrics.hpp"
#include "network/impl/channel_factory.hpp"
#include "util/status_notifier.hpp"
#include "util/utility_service.hpp"
#include "validators/field_validator.hpp"
Include dependency graph for irohad.cpp:

Functions

 DEFINE_string (config, "", "Specify iroha provisioning path.")
 
 DEFINE_string (genesis_block, "", "Specify file with initial block")
 
 DEFINE_string (keypair_name, "", "Specify name of .pub and .priv files")
 
 DEFINE_bool (overwrite_ledger, false, "Overwrite ledger data if existing")
 
 DEFINE_bool (reuse_state, true, "Try to reuse existing state data at startup (Deprecated, startup " "reuses state by default. Use drop_state to drop the WSV).")
 
 DEFINE_bool (drop_state, false, "Drops existing state data at startup.")
 
 DEFINE_bool (wait_for_new_blocks, false, "Startup synchronization policy - waits for new blocks in " "blockstore, does not run network")
 
static bool validateVerbosity (const char *flagname, const std::string &val)
 
 DEFINE_string (verbosity, kLogSettingsFromConfigFile, "Log verbosity")
 Verbosity flag for spdlog configuration. More...
 
 DEFINE_validator (verbosity, &validateVerbosity)
 
 DEFINE_string (metrics_addr, "127.0.0.1", "Prometeus HTTP server listen address")
 Metrics. ToDo validator. More...
 
 DEFINE_string (metrics_port, "", "Prometeus HTTP server listens port, disabled by default")
 
std::lock_guard< std::mutex > shutdown_wait_locker (shutdown_wait_mutex)
 
static shared_model::crypto::Keypair getKeypairFromConfig (IrohadConfig::Crypto const &config)
 
static shared_model::crypto::Keypair getKeypairFromFile (std::string const &keypair_name, logger::LoggerManagerTreePtr log_manager)
 
void initUtilityService (const IrohadConfig::UtilityService &config, iroha::utility_service::UtilityService::ShutdownCallback shutdown_callback, logger::LoggerManagerTreePtr log_manager)
 
logger::LoggerManagerTreePtr getDefaultLogManager ()
 
std::shared_ptr< shared_model::interface::CommonObjectsFactorygetCommonObjectsFactory ()
 
int main (int argc, char *argv[])
 

Variables

static const std::string kListenIp = "0.0.0.0"
 
static const std::string kLogSettingsFromConfigFile = "config_file"
 
static const std::string kDefaultWorkingDatabaseName {"iroha_default"}
 
static const std::chrono::milliseconds kExitCheckPeriod {1000}
 
std::sig_atomic_t caught_signal = 0
 
std::promise< void > exit_requested
 
std::shared_ptr< iroha::utility_service::UtilityServiceutility_service
 
std::unique_ptr< iroha::network::ServerRunnerutility_server
 
std::mutex shutdown_wait_mutex
 
std::shared_ptr< iroha::utility_service::StatusNotifierdaemon_status_notifier
 

Function Documentation

◆ DEFINE_bool() [1/4]

DEFINE_bool ( overwrite_ledger  ,
false  ,
"Overwrite ledger data if existing"   
)

Creating boolean flag for overwriting already existing block storage

◆ DEFINE_bool() [2/4]

DEFINE_bool ( reuse_state  ,
true  ,
"Try to reuse existing state data at startup (Deprecated, startup " "reuses state by default. Use drop_state to drop the WSV)."   
)

Startup option to reuse existing WSV. Ignored since state is reused by default.

◆ DEFINE_bool() [3/4]

DEFINE_bool ( drop_state  ,
false  ,
"Drops existing state data at startup."   
)

Startup option to drop existing WSV. Cannot be used with 'reuse_state'.

◆ DEFINE_bool() [4/4]

DEFINE_bool ( wait_for_new_blocks  ,
false  ,
"Startup synchronization policy - waits for new blocks in " "  blockstore,
does not run network"   
)

Startup option for WSV synchronization mode.

◆ DEFINE_string() [1/6]

DEFINE_string ( config  ,
""  ,
"Specify iroha provisioning path."   
)

Creating input argument for the configuration file location.

Here is the caller graph for this function:

◆ DEFINE_string() [2/6]

DEFINE_string ( genesis_block  ,
""  ,
"Specify file with initial block"   
)

Creating input argument for the genesis block file location.

◆ DEFINE_string() [3/6]

DEFINE_string ( keypair_name  ,
""  ,
"Specify name of .pub and .priv files"   
)

Creating input argument for the keypair files location.

◆ DEFINE_string() [4/6]

DEFINE_string ( verbosity  ,
kLogSettingsFromConfigFile  ,
"Log verbosity"   
)

Verbosity flag for spdlog configuration.

◆ DEFINE_string() [5/6]

DEFINE_string ( metrics_addr  ,
"127.0.0.1"  ,
"Prometeus HTTP server listen address"   
)

Metrics. ToDo validator.

◆ DEFINE_string() [6/6]

DEFINE_string ( metrics_port  ,
""  ,
"Prometeus HTTP server listens  port,
disabled by default"   
)

◆ DEFINE_validator()

DEFINE_validator ( verbosity  ,
validateVerbosity 
)
Here is the caller graph for this function:

◆ getCommonObjectsFactory()

std::shared_ptr<shared_model::interface::CommonObjectsFactory> getCommonObjectsFactory ( )
Here is the caller graph for this function:

◆ getDefaultLogManager()

logger::LoggerManagerTreePtr getDefaultLogManager ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getKeypairFromConfig()

static shared_model::crypto::Keypair getKeypairFromConfig ( IrohadConfig::Crypto const &  config)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getKeypairFromFile()

static shared_model::crypto::Keypair getKeypairFromFile ( std::string const &  keypair_name,
logger::LoggerManagerTreePtr  log_manager 
)
static
Here is the caller graph for this function:

◆ initUtilityService()

void initUtilityService ( const IrohadConfig::UtilityService config,
iroha::utility_service::UtilityService::ShutdownCallback  shutdown_callback,
logger::LoggerManagerTreePtr  log_manager 
)
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

if there are any blocks in blockstore, then true

genesis block file is specified as launch parameter

overwrite ledger flag was set as launch parameter

Here is the call graph for this function:

◆ shutdown_wait_locker()

std::lock_guard<std::mutex> shutdown_wait_locker ( shutdown_wait_mutex  )

◆ validateVerbosity()

static bool validateVerbosity ( const char *  flagname,
const std::string &  val 
)
static
Here is the call graph for this function:

Variable Documentation

◆ caught_signal

std::sig_atomic_t caught_signal = 0

◆ daemon_status_notifier

std::shared_ptr<iroha::utility_service::StatusNotifier> daemon_status_notifier
Initial value:
=
std::make_shared<iroha::utility_service::StatusNotifier>()

◆ exit_requested

std::promise<void> exit_requested

◆ kDefaultWorkingDatabaseName

const std::string kDefaultWorkingDatabaseName {"iroha_default"}
static

◆ kExitCheckPeriod

const std::chrono::milliseconds kExitCheckPeriod {1000}
static

◆ kListenIp

const std::string kListenIp = "0.0.0.0"
static

Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

◆ kLogSettingsFromConfigFile

const std::string kLogSettingsFromConfigFile = "config_file"
static

◆ shutdown_wait_mutex

std::mutex shutdown_wait_mutex

◆ utility_server

std::unique_ptr<iroha::network::ServerRunner> utility_server

◆ utility_service

std::shared_ptr<iroha::utility_service::UtilityService> utility_service