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

elasticsearch history api #1682 #1725

Merged
merged 16 commits into from Aug 14, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

add is_plugin_enabled to application

  • Loading branch information...
oxarbitrage committed Jul 15, 2019
commit 2a6d7b26c861dfbe691d8e1233792c121a0eee8e
@@ -328,9 +328,10 @@ namespace graphene { namespace app {
start = node.operation_id;
} catch(...) { return result; }

auto es = _app.get_plugin<elasticsearch::elasticsearch_plugin>("elasticsearch");
if(es)
if(_app.is_plugin_enabled("elasticsearch")) {
auto es = _app.get_plugin<elasticsearch::elasticsearch_plugin>("elasticsearch");
return es->get_account_history(account, stop, limit, start);
This conversation was marked as resolved by pmconrad

This comment has been minimized.

Copy link
@pmconrad

pmconrad Apr 20, 2019

Contributor

Problem: this works synchronously, inside the database thread. It is important to decouple this.
The ES query plugin should set up a separate thread for executing the queries and parsing the responses. The database thread should then make the call to the ES thread and wait for the result to return. Waiting will yield, which frees up the DB thread for other things.

This comment has been minimized.

Copy link
@oxarbitrage

oxarbitrage Apr 20, 2019

Author Member

I understand the importance of this.

Can you point me in the right direction on how to make it following the graphene/bitshares style. Example in the codebase, functions to use, etc will be of great help.

Thank you.

This comment has been minimized.

Copy link
@pmconrad

pmconrad Apr 23, 2019

Contributor

We don't have many examples where threading is used.

Check the network node.

_async returns a future. Waiting for the future result will yield, i. e. other tasks within the current thread will be executed in parallel. Not sure what that means in the context of an API call, you'll have to experiment there.

}

const auto& hist_idx = db.get_index_type<account_transaction_history_index>();
const auto& by_op_idx = hist_idx.indices().get<by_op>();
@@ -1073,6 +1073,13 @@ std::shared_ptr<abstract_plugin> application::get_plugin(const string& name) con
return my->_active_plugins[name];
}

bool application::is_plugin_enabled(const string& name) const
{
if(my->_active_plugins.find(name) == my->_active_plugins.end())
This conversation was marked as resolved by oxarbitrage

This comment has been minimized.

Copy link
@pmconrad

pmconrad Jul 26, 2019

Contributor

if (x) return false; else return true; can be simplified to return !x;.

return false;
return true;
}

net::node_ptr application::p2p_node()
{
return my->_p2p_network;
@@ -117,7 +117,10 @@ namespace graphene { namespace app {

void enable_plugin( const string& name );

private:
bool is_plugin_enabled(const string& name) const;


private:
void add_available_plugin( std::shared_ptr<abstract_plugin> p );
std::shared_ptr<detail::application_impl> my;

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.