-
Notifications
You must be signed in to change notification settings - Fork 648
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
Changes from 1 commit
10a382f
00496a9
2a6d7b2
1737d45
6dda9fe
26e9f16
4fac171
29bf975
de76301
5838a38
1f6ac14
63f7aff
a7fc6b0
13d8034
07de45e
f1bedc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ class elasticsearch_plugin_impl | |
bool _elasticsearch_operation_object = false; | ||
uint32_t _elasticsearch_start_es_after_block = 0; | ||
bool _elasticsearch_operation_string = true; | ||
std::string _elasticsearch_mode = "only_save"; | ||
mode _elasticsearch_mode = mode::only_save; | ||
CURL *curl; // curl handler | ||
vector <string> bulk_lines; // vector of op lines | ||
vector<std::string> prepare; | ||
|
@@ -446,8 +446,8 @@ void elasticsearch_plugin::plugin_set_program_options( | |
"Start doing ES job after block(0)") | ||
("elasticsearch-operation-string", boost::program_options::value<bool>(), | ||
"Save operation as string. Needed to serve history api calls(true)") | ||
("elasticsearch-mode", boost::program_options::value<std::string>(), | ||
"Mode of operation: only_save, only_query, all(only_save)") | ||
("elasticsearch-mode", boost::program_options::value<uint16_t>(), | ||
"Mode of operation: only_save(0), only_query(1), all(2) - Default: 0") | ||
; | ||
cfg.add(cli); | ||
} | ||
|
@@ -485,11 +485,14 @@ void elasticsearch_plugin::plugin_initialize(const boost::program_options::varia | |
my->_elasticsearch_operation_string = options["elasticsearch-operation-string"].as<bool>(); | ||
} | ||
if (options.count("elasticsearch-mode")) { | ||
my->_elasticsearch_mode = options["elasticsearch-mode"].as<std::string>(); | ||
const auto option_number = options["elasticsearch-mode"].as<uint16_t>(); | ||
if(option_number > mode::all) | ||
FC_THROW_EXCEPTION(fc::exception, "Elasticsearch mode not valid"); | ||
my->_elasticsearch_mode = static_cast<mode>(options["elasticsearch-mode"].as<uint16_t>()); | ||
} | ||
|
||
if(my->_elasticsearch_mode != "only_query") { | ||
if (my->_elasticsearch_mode == "all") | ||
if(my->_elasticsearch_mode != mode::only_query) { | ||
if (my->_elasticsearch_mode == mode::all) | ||
my->_elasticsearch_operation_string = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Silently overriding this will cause confusion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, i am now not allowing the mode to be all if operation_string is false so no silent changes are made. |
||
|
||
database().applied_block.connect([this](const signed_block &b) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use values 1,2,3 so the option behaves like a bitset. But that's just me.