Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Elasticplugin, snapshot plugin and graphene updates to beatrice #304

Merged
merged 43 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
614e51c
check witness signature before adding block to fork db
srpatel19590 Nov 28, 2019
ffbae79
Replace verify_no_send_in_progress with no_parallel_execution_guard
srpatel19590 Dec 2, 2019
45aac6d
fixed cli_wallet log issue
srpatel19590 Dec 3, 2019
5606fc5
Port plugin sanitization code
srpatel19590 Dec 3, 2019
d3ecbba
avoid directly overwriting wallet file
srpatel19590 Dec 11, 2019
e1244eb
Implemented "plugins" config variable
pmconrad May 24, 2017
f3d961b
allow plugin to have descriptions
oxarbitrage Nov 10, 2017
00f14c4
Merge pull request #444 from oxarbitrage/elasticsearch
oxarbitrage Nov 11, 2017
8d900a5
Merge pull request #500 from oxarbitrage/elasticsearch-extras
oxarbitrage Mar 20, 2018
e91e61e
Merge pull request #873 from pmconrad/585_fix_history_ids
abitmore Apr 25, 2018
c9583f4
Merge pull request #1201 from oxarbitrage/elasticsearch_tests2
abitmore Aug 2, 2018
2d19aa3
Merge pull request #1271 from oxarbitrage/es_objects
oxarbitrage Oct 15, 2018
4f5f8f4
Merge pull request #1429 from oxarbitrage/es_objects_templates
oxarbitrage Dec 19, 2018
c4612a5
Merge pull request #1458 from oxarbitrage/issue1455
oxarbitrage Dec 21, 2018
6d9ad94
Merge pull request #1541 from oxarbitrage/es_objects_start_after_block
oxarbitrage Jan 30, 2019
82ef3a5
explicitly cleanup external library facilities
crypto-ape Apr 2, 2019
2f054ac
Merge pull request #1717 from oxarbitrage/issue1652
oxarbitrage Apr 23, 2019
de4faee
Merge pull request #1073 from xiangxn/merge-impacted
oxarbitrage Jun 21, 2018
62247c5
Merge pull request #1725 from oxarbitrage/issue1682
oxarbitrage Aug 14, 2019
bfa878f
change ES index prefixes to Peerplays-specific
Dec 13, 2019
63750ec
sync develop with beatrice
pbattu123 Jan 2, 2020
0a90442
fix the data writing to ES during sync issues
Jan 13, 2020
62b8bde
Merge pull request #258 from peerplays-network/sync-develop
pbattu123 Jan 16, 2020
e55075e
fix CLI tests
Jan 17, 2020
11919cd
brought updates from mainnet branch (#285)
pbattu123 Feb 12, 2020
046ee5b
Merge pull request #257 from peerplays-network/feature/GRPH-205
pbattu123 Feb 13, 2020
bf25029
Merge pull request #242 from peerplays-network/feature/GRPH-169
pbattu123 Feb 13, 2020
0579058
Merge branch 'develop' into feature/GRPH-163
pbattu123 Feb 13, 2020
0e4434a
Merge branch 'develop' into feature/GRPH-155
pbattu123 Feb 13, 2020
524b308
Merge pull request #228 from peerplays-network/feature/GRPH-162
pbattu123 Feb 13, 2020
c93c3d3
Merge pull request #226 from peerplays-network/feature/GRPH-160
pbattu123 Feb 13, 2020
d5df449
Merge pull request #230 from peerplays-network/feature/GRPH-163
pbattu123 Feb 13, 2020
5188a68
Merge pull request #229 from peerplays-network/feature/GRPH-155
pbattu123 Feb 13, 2020
b68e6ce
Fix unit test failures (#289)
pbattu123 Feb 20, 2020
926d4ae
enable snapshot plugin (#288)
pbattu123 Feb 24, 2020
71e7314
sync fc branch(build optimization changes)
pbattu123 Feb 24, 2020
371c4c5
Merge pull request #293 from peerplays-network/sync_fc_dev
pbattu123 Feb 24, 2020
7f0bc33
update to es plugin
pbattu123 Feb 26, 2020
b7951e9
fix verify witness signature method (#295)
pbattu123 Feb 26, 2020
24e7610
Merge pull request #296 from peerplays-network/es_update1
pbattu123 Feb 26, 2020
32d9175
enable mandatory plugins to have smooth transition for next release
pbattu123 Feb 27, 2020
cd8d725
updated tests to keep in-line with plugin changes
pbattu123 Mar 6, 2020
ac10923
Merge pull request #299 from peerplays-network/plugins_enable_fix1
pbattu123 Mar 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
[submodule "libraries/fc"]
path = libraries/fc
url = https://github.com/peerplays-network/peerplays-fc.git
branch = beatrice
branch = latest-fc
ignore = dirty
3 changes: 1 addition & 2 deletions libraries/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ add_library( graphene_app
api.cpp
application.cpp
database_api.cpp
impacted.cpp
plugin.cpp
config_util.cpp
${HEADERS}
Expand All @@ -14,7 +13,7 @@ add_library( graphene_app

# need to link graphene_debug_witness because plugins aren't sufficiently isolated #246
#target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_chain fc graphene_db graphene_net graphene_utilities graphene_debug_witness )
target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_chain fc graphene_db graphene_net graphene_time graphene_utilities graphene_debug_witness graphene_bookie )
target_link_libraries( graphene_app graphene_market_history graphene_account_history graphene_accounts_list graphene_affiliate_stats graphene_chain fc graphene_db graphene_net graphene_time graphene_utilities graphene_debug_witness graphene_bookie graphene_elasticsearch )
target_include_directories( graphene_app
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../egenesis/include" )
Expand Down
13 changes: 12 additions & 1 deletion libraries/app/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <graphene/app/api.hpp>
#include <graphene/app/api_access.hpp>
#include <graphene/app/application.hpp>
#include <graphene/app/impacted.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/get_config.hpp>
#include <graphene/utilities/key_conversion.hpp>
Expand Down Expand Up @@ -581,6 +580,18 @@ namespace graphene { namespace app {
start = node.operation_id;
} catch(...) { return result; }

if(_app.is_plugin_enabled("elasticsearch")) {
auto es = _app.get_plugin<elasticsearch::elasticsearch_plugin>("elasticsearch");
if(es.get()->get_running_mode() != elasticsearch::mode::only_save) {
if(!_app.elasticsearch_thread)
_app.elasticsearch_thread= std::make_shared<fc::thread>("elasticsearch");

return _app.elasticsearch_thread->async([&es, &account, &stop, &limit, &start]() {
return es->get_account_history(account, stop, limit, start);
}, "thread invoke for method " BOOST_PP_STRINGIZE(method_name)).wait();
}
}

const auto& hist_idx = db.get_index_type<account_transaction_history_index>();
const auto& by_op_idx = hist_idx.indices().get<by_op>();
auto index_start = by_op_idx.begin();
Expand Down
58 changes: 51 additions & 7 deletions libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,8 @@ namespace detail {
std::shared_ptr<fc::http::websocket_server> _websocket_server;
std::shared_ptr<fc::http::websocket_tls_server> _websocket_tls_server;

std::map<string, std::shared_ptr<abstract_plugin>> _plugins;
std::map<string, std::shared_ptr<abstract_plugin>> _active_plugins;
std::map<string, std::shared_ptr<abstract_plugin>> _available_plugins;

bool _is_finished_syncing = false;
};
Expand Down Expand Up @@ -933,6 +934,7 @@ void application::set_program_options(boost::program_options::options_descriptio
("enable-standby-votes-tracking", bpo::value<bool>()->implicit_value(true),
"Whether to enable tracking of votes of standby witnesses and committee members. "
"Set it to true to provide accurate data to API clients, set to false for slightly better performance.")
("plugins", bpo::value<string>(), "Space-separated list of plugins to activate")
;
command_line_options.add(configuration_file_options);
command_line_options.add_options()
Expand Down Expand Up @@ -978,6 +980,36 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti

std::exit(EXIT_SUCCESS);
}

std::set<string> wanted;
if( options.count("plugins") )
{
boost::split(wanted, options.at("plugins").as<std::string>(), [](char c){return c == ' ';});
}
else
{
wanted.insert("account_history");
wanted.insert("market_history");
wanted.insert("accounts_list");
wanted.insert("affiliate_stats");
}
wanted.insert("witness");
wanted.insert("bookie");

int es_ah_conflict_counter = 0;
for (auto& it : wanted)
{
if(it == "account_history")
++es_ah_conflict_counter;
if(it == "elasticsearch")
++es_ah_conflict_counter;

if(es_ah_conflict_counter > 1) {
elog("Can't start program with elasticsearch and account_history plugin at the same time");
std::exit(EXIT_FAILURE);
}
if (!it.empty()) enable_plugin(it);
}
}

void application::startup()
Expand All @@ -995,7 +1027,12 @@ void application::startup()

std::shared_ptr<abstract_plugin> application::get_plugin(const string& name) const
{
return my->_plugins[name];
return my->_active_plugins[name];
}

bool application::is_plugin_enabled(const string& name) const
{
return !(my->_active_plugins.find(name) == my->_active_plugins.end());
}

net::node_ptr application::p2p_node()
Expand Down Expand Up @@ -1028,14 +1065,21 @@ bool application::is_finished_syncing() const
return my->_is_finished_syncing;
}

void graphene::app::application::add_plugin(const string& name, std::shared_ptr<graphene::app::abstract_plugin> p)
void graphene::app::application::enable_plugin(const string& name)
{
FC_ASSERT(my->_available_plugins[name], "Unknown plugin '" + name + "'");
my->_active_plugins[name] = my->_available_plugins[name];
my->_active_plugins[name]->plugin_set_app(this);
}

void graphene::app::application::add_available_plugin(std::shared_ptr<graphene::app::abstract_plugin> p)
{
my->_plugins[name] = p;
my->_available_plugins[p->plugin_name()] = p;
}

void application::shutdown_plugins()
{
for( auto& entry : my->_plugins )
for( auto& entry : my->_active_plugins )
entry.second->plugin_shutdown();
return;
}
Expand All @@ -1049,14 +1093,14 @@ void application::shutdown()

void application::initialize_plugins( const boost::program_options::variables_map& options )
{
for( auto& entry : my->_plugins )
for( auto& entry : my->_active_plugins )
entry.second->plugin_initialize( options );
return;
}

void application::startup_plugins()
{
for( auto& entry : my->_plugins )
for( auto& entry : my->_active_plugins )
entry.second->plugin_startup();
return;
}
Expand Down
Loading