BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
es_objects.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 oxarbitrage, and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 
26 
33 
36 
37 namespace graphene { namespace db {
38  template<uint8_t SpaceID, uint8_t TypeID>
39  constexpr uint16_t object_id<SpaceID, TypeID>::space_type;
40 } };
41 
42 namespace graphene { namespace es_objects {
43 
44 namespace detail
45 {
46 
48 {
49  public:
51  : _self( _plugin )
52  { }
53 
54  private:
56  friend struct data_loader;
57 
58  struct plugin_options
59  {
61  {
62  object_options( bool e, bool su, bool nd, const string& in )
63  : enabled(e), store_updates(su), no_delete(nd), index_name(in)
64  {}
65 
66  bool enabled = true;
67  bool store_updates = false;
68  bool no_delete = false;
69  string index_name = "";
70  };
71  std::string elasticsearch_url = "http://localhost:9200/";
72  std::string auth = "";
73  uint32_t bulk_replay = 10000;
74  uint32_t bulk_sync = 100;
75 
76  object_options proposals { true, false, true, "proposal" };
77  object_options accounts { true, false, true, "account" };
78  object_options assets { true, false, true, "asset" };
79  object_options balances { true, false, true, "balance" };
80  object_options limit_orders { true, false, false, "limitorder" };
81  object_options asset_bitasset { true, false, true, "bitasset" };
82  object_options budget { true, false, true, "budget" };
83 
84  std::string index_prefix = "objects-";
85 
88  uint16_t max_mapping_depth = 10;
89 
90  uint32_t start_es_after_block = 0;
91  bool sync_db_on_startup = false;
92 
93  void init(const boost::program_options::variables_map& options);
94  };
95 
96  enum class action_type
97  {
98  insertion,
99  update,
100  deletion
101  };
102 
103  void on_objects_create(const vector<object_id_type>& ids)
104  { index_database( ids, action_type::insertion ); }
105 
106  void on_objects_update(const vector<object_id_type>& ids)
107  { index_database( ids, action_type::update ); }
108 
109  void on_objects_delete(const vector<object_id_type>& ids)
110  { index_database( ids, action_type::deletion ); }
111 
112  void index_database(const vector<object_id_type>& ids, action_type action);
114  void sync_db( bool delete_before_load = false );
116  void delete_from_database( const object_id_type& id, const plugin_options::object_options& opt );
118  void delete_all_from_database( const plugin_options::object_options& opt ) const;
119 
120  es_objects_plugin& _self;
121  plugin_options _options;
122 
123  uint32_t limit_documents = _options.bulk_replay;
124 
125  uint64_t docs_sent_batch = 0;
126  uint64_t docs_sent_total = 0;
127 
128  std::unique_ptr<graphene::utilities::es_client> es;
129 
130  vector<std::string> bulk_lines;
131  size_t approximate_bulk_size = 0;
132 
133  uint32_t block_number = 0;
134  fc::time_point_sec block_time;
135  bool is_es_version_7_or_above = true;
136 
137  template<typename T>
138  void prepareTemplate( const T& blockchain_object, const plugin_options::object_options& opt );
139 
140  void init_program_options(const boost::program_options::variables_map& options);
141 
142  void send_bulk_if_ready( bool force = false );
143 };
144 
146 {
149 
151  : my(_my), db( my->_self.database() )
152  { // Nothing to do
153  }
154 
155  template<typename ObjType>
157  bool force_delete = false )
158  {
159  if( !opt.enabled )
160  return;
161 
162  // If no_delete or store_updates is true, do not delete
163  if( force_delete || !( opt.no_delete || opt.store_updates ) )
164  {
165  ilog( "Deleting all data in index " + my->_options.index_prefix + opt.index_name );
166  my->delete_all_from_database( opt );
167  }
168 
169  ilog( "Loading data into index " + my->_options.index_prefix + opt.index_name );
170  db.get_index( ObjType::space_id, ObjType::type_id ).inspect_all_objects(
171  [this, &opt](const graphene::db::object &o) {
172  my->prepareTemplate( static_cast<const ObjType&>(o), opt );
173  });
174  my->send_bulk_if_ready(true);
175  my->docs_sent_batch = 0;
176  }
177 };
178 
179 void es_objects_plugin_impl::sync_db( bool delete_before_load )
180 {
181  ilog("elasticsearch OBJECTS: loading data from the object database (chain state)");
182 
183  graphene::chain::database &db = _self.database();
184 
185  block_number = db.head_block_num();
186  block_time = db.head_block_time();
187 
188  data_loader loader( this );
189 
190  loader.load<account_object >( _options.accounts, delete_before_load );
191  loader.load<asset_object >( _options.assets, delete_before_load );
192  loader.load<asset_bitasset_data_object >( _options.asset_bitasset, delete_before_load );
193  loader.load<account_balance_object >( _options.balances, delete_before_load );
194  loader.load<proposal_object >( _options.proposals, delete_before_load );
195  loader.load<limit_order_object >( _options.limit_orders, delete_before_load );
196  loader.load<budget_record_object >( _options.budget, delete_before_load );
197 
198  ilog("elasticsearch OBJECTS: done loading data from the object database (chain state)");
199 }
200 
201 void es_objects_plugin_impl::index_database(const vector<object_id_type>& ids, action_type action)
202 {
203  graphene::chain::database &db = _self.database();
204 
205  block_number = db.head_block_num();
206 
207  if( block_number <= _options.start_es_after_block )
208  return;
209 
210  block_time = db.head_block_time();
211 
212  // check if we are in replay or in sync and change number of bulk documents accordingly
213  if( (fc::time_point::now() - block_time) < fc::seconds(30) )
214  limit_documents = _options.bulk_sync;
215  else
216  limit_documents = _options.bulk_replay;
217 
218  bulk_lines.reserve(limit_documents);
219 
220  static const unordered_map<uint16_t,plugin_options::object_options&> data_type_map = {
221  { account_id_type::space_type, _options.accounts },
222  { account_balance_id_type::space_type, _options.balances },
223  { asset_id_type::space_type, _options.assets },
224  { asset_bitasset_data_id_type::space_type, _options.asset_bitasset },
225  { limit_order_id_type::space_type, _options.limit_orders },
226  { proposal_id_type::space_type, _options.proposals },
227  { budget_record_id_type::space_type, _options.budget }
228  };
229 
230  for( const auto& value: ids )
231  {
232  const auto itr = data_type_map.find( value.space_type() );
233  if( itr == data_type_map.end() || !(itr->second.enabled) )
234  continue;
235  const auto& opt = itr->second;
236  if( action_type::deletion == action )
237  delete_from_database( value, opt );
238  else
239  {
240  switch( itr->first )
241  {
242  case account_id_type::space_type:
243  prepareTemplate( db.get<account_object>(value), opt );
244  break;
245  case account_balance_id_type::space_type:
246  prepareTemplate( db.get<account_balance_object>(value), opt );
247  break;
248  case asset_id_type::space_type:
249  prepareTemplate( db.get<asset_object>(value), opt );
250  break;
251  case asset_bitasset_data_id_type::space_type:
252  prepareTemplate( db.get<asset_bitasset_data_object>(value), opt );
253  break;
254  case limit_order_id_type::space_type:
255  prepareTemplate( db.get<limit_order_object>(value), opt );
256  break;
257  case proposal_id_type::space_type:
258  prepareTemplate( db.get<proposal_object>(value), opt );
259  break;
260  case budget_record_id_type::space_type:
261  prepareTemplate( db.get<budget_record_object>(value), opt );
262  break;
263  default:
264  break;
265  }
266  }
267  }
268 
269 }
270 
271 void es_objects_plugin_impl::delete_from_database(
272  const object_id_type& id, const es_objects_plugin_impl::plugin_options::object_options& opt )
273 {
274  if( opt.no_delete )
275  return;
276 
277  fc::mutable_variant_object delete_line;
278  delete_line["_id"] = string(id); // Note: this does not work if `store_updates` is true
279  delete_line["_index"] = _options.index_prefix + opt.index_name;
280  if( !is_es_version_7_or_above )
281  delete_line["_type"] = "_doc";
282  fc::mutable_variant_object final_delete_line;
283  final_delete_line["delete"] = std::move( delete_line );
284 
285  bulk_lines.push_back( fc::json::to_string(final_delete_line) );
286 
287  approximate_bulk_size += bulk_lines.back().size();
288 
289  send_bulk_if_ready();
290 }
291 
292 void es_objects_plugin_impl::delete_all_from_database( const plugin_options::object_options& opt ) const
293 {
294  // Note:
295  // 1. The _delete_by_query API deletes the data but keeps the index mapping, so the function is OK.
296  // Simply deleting the index is probably faster, but it requires the "delete_index" permission, and
297  // may probably mess up the index mapping and other existing settings.
298  // Don't know if there is a good way to only delete objects that do not exist in the object database.
299  // 2. We don't check the return value here, it's probably OK
300  es->query( _options.index_prefix + opt.index_name + "/_delete_by_query", R"({"query":{"match_all":{}}})" );
301 }
302 
303 template<typename T>
304 void es_objects_plugin_impl::prepareTemplate(
305  const T& blockchain_object, const es_objects_plugin_impl::plugin_options::object_options& opt )
306 {
307  fc::mutable_variant_object bulk_header;
308  bulk_header["_index"] = _options.index_prefix + opt.index_name;
309  if( !is_es_version_7_or_above )
310  bulk_header["_type"] = "_doc";
311  if( !opt.store_updates )
312  {
313  bulk_header["_id"] = string(blockchain_object.id);
314  }
315 
316  fc::variant blockchain_object_variant;
317  fc::to_variant( blockchain_object, blockchain_object_variant, GRAPHENE_NET_MAX_NESTED_OBJECTS );
319  _options.max_mapping_depth ) );
320 
321  o["object_id"] = string(blockchain_object.id);
322  o["block_time"] = block_time;
323  o["block_number"] = block_number;
324 
326 
327  auto prepare = graphene::utilities::createBulk(bulk_header, std::move(data));
328  std::move(prepare.begin(), prepare.end(), std::back_inserter(bulk_lines));
329 
330  approximate_bulk_size += bulk_lines.back().size();
331 
332  send_bulk_if_ready();
333 }
334 
335 void es_objects_plugin_impl::send_bulk_if_ready( bool force )
336 {
337  if( bulk_lines.empty() )
338  return;
339  if( !force && bulk_lines.size() < limit_documents
340  && approximate_bulk_size < graphene::utilities::es_client::request_size_threshold )
341  return;
342  constexpr uint32_t log_count_threshold = 20000; // lines
343  constexpr uint32_t log_time_threshold = 3600; // seconds
344  static uint64_t next_log_count = log_count_threshold;
345  static fc::time_point next_log_time = fc::time_point::now() + fc::seconds(log_time_threshold);
346  docs_sent_batch += bulk_lines.size();
347  docs_sent_total += bulk_lines.size();
348  bool log_by_next = ( docs_sent_total >= next_log_count || fc::time_point::now() >= next_log_time );
349  if( log_by_next || limit_documents == _options.bulk_replay || force )
350  {
351  ilog( "Sending ${n} lines of bulk data to ElasticSearch at block ${blk}, "
352  "this batch ${b}, total ${t}, approximate size ${s}",
353  ("n",bulk_lines.size())("blk",block_number)
354  ("b",docs_sent_batch)("t",docs_sent_total)("s",approximate_bulk_size) );
355  next_log_count = docs_sent_total + log_count_threshold;
356  next_log_time = fc::time_point::now() + fc::seconds(log_time_threshold);
357  }
358  // send data to elasticsearch when being forced or bulk is too large
359  if( !es->send_bulk( bulk_lines ) )
360  {
361  elog( "Error sending ${n} lines of bulk data to ElasticSearch, the first lines are:", // GCOVR_EXCL_LINE
362  ("n",bulk_lines.size()) ); // GCOVR_EXCL_LINE
363  const auto log_max = std::min( bulk_lines.size(), size_t(10) );
364  for( size_t i = 0; i < log_max; ++i )
365  {
366  edump( (bulk_lines[i]) ); // GCOVR_EXCL_LINE
367  }
368  FC_THROW_EXCEPTION( graphene::chain::plugin_exception,
369  "Error populating ES database, we are going to keep trying." );
370  }
371  bulk_lines.clear();
372  bulk_lines.reserve(limit_documents);
373  approximate_bulk_size = 0;
374 }
375 
376 } // end namespace detail
377 
379  plugin(app),
380  my( std::make_unique<detail::es_objects_plugin_impl>(*this) )
381 {
382  // Nothing else to do
383 }
384 
386 
388 {
389  return "es_objects";
390 }
392 {
393  return "Stores blockchain objects in ES database. Experimental.";
394 }
395 
397  boost::program_options::options_description& cli,
398  boost::program_options::options_description& cfg
399  )
400 {
401  cli.add_options()
402  ("es-objects-elasticsearch-url", boost::program_options::value<std::string>(),
403  "Elasticsearch node url(http://localhost:9200/)")
404  ("es-objects-auth", boost::program_options::value<std::string>(), "Basic auth username:password('')")
405  ("es-objects-bulk-replay", boost::program_options::value<uint32_t>(),
406  "Number of bulk documents to index on replay(10000)")
407  ("es-objects-bulk-sync", boost::program_options::value<uint32_t>(),
408  "Number of bulk documents to index on a synchronized chain(100)")
409 
410  ("es-objects-proposals", boost::program_options::value<bool>(), "Store proposal objects (true)")
411  ("es-objects-proposals-store-updates", boost::program_options::value<bool>(),
412  "Store all updates to the proposal objects (false)")
413  ("es-objects-proposals-no-delete", boost::program_options::value<bool>(),
414  "Do not delete a proposal from ES even if it is deleted from chain state. "
415  "It is implicitly true and can not be set to false if es-objects-proposals-store-updates is true. "
416  "(true)")
417 
418  ("es-objects-accounts", boost::program_options::value<bool>(), "Store account objects (true)")
419  ("es-objects-accounts-store-updates", boost::program_options::value<bool>(),
420  "Store all updates to the account objects (false)")
421 
422  ("es-objects-assets", boost::program_options::value<bool>(), "Store asset objects (true)")
423  ("es-objects-assets-store-updates", boost::program_options::value<bool>(),
424  "Store all updates to the asset objects (false)")
425 
426  ("es-objects-balances", boost::program_options::value<bool>(), "Store account balances (true)")
427  ("es-objects-balances-store-updates", boost::program_options::value<bool>(),
428  "Store all updates to the account balances (false)")
429 
430  ("es-objects-limit-orders", boost::program_options::value<bool>(), "Store limit order objects (true)")
431  ("es-objects-limit-orders-store-updates", boost::program_options::value<bool>(),
432  "Store all updates to the limit orders (false)")
433  ("es-objects-limit-orders-no-delete", boost::program_options::value<bool>(),
434  "Do not delete a limit order object from ES even if it is deleted from chain state. "
435  "It is implicitly true and can not be set to false if es-objects-limit-orders-store-updates is true. "
436  "(false)")
437 
438  ("es-objects-asset-bitasset", boost::program_options::value<bool>(),
439  "Store bitasset data, including price feeds (true)")
440  ("es-objects-asset-bitasset-store-updates", boost::program_options::value<bool>(),
441  "Store all updates to the bitasset data (false)")
442 
443  ("es-objects-budget-records", boost::program_options::value<bool>(), "Store budget records (true)")
444 
445  ("es-objects-index-prefix", boost::program_options::value<std::string>(),
446  "Add a prefix to the index(objects-)")
447  ("es-objects-max-mapping-depth", boost::program_options::value<uint16_t>(),
448  "Can not exceed the maximum index mapping depth (index.mapping.depth.limit) setting in ES, "
449  "and need to be even smaller to not trigger the index.mapping.total_fields.limit error (10)")
450  ("es-objects-keep-only-current", boost::program_options::value<bool>(),
451  "Deprecated. Please use the store-updates or no-delete options. "
452  "Keep only current state of the objects(true)")
453  ("es-objects-start-es-after-block", boost::program_options::value<uint32_t>(),
454  "Start doing ES job after block(0)")
455  ("es-objects-sync-db-on-startup", boost::program_options::value<bool>(),
456  "Copy all applicable objects from the object database (chain state) to ES on program startup (false)")
457  ;
458  cfg.add(cli);
459 }
460 
461 void detail::es_objects_plugin_impl::init_program_options(const boost::program_options::variables_map& options)
462 {
463  _options.init( options );
464 
465  es = std::make_unique<graphene::utilities::es_client>( _options.elasticsearch_url, _options.auth );
466 
467  FC_ASSERT( es->check_status(), "ES database is not up in url ${url}", ("url", _options.elasticsearch_url) );
468 
469  es->check_version_7_or_above( is_es_version_7_or_above );
470 }
471 
472 void detail::es_objects_plugin_impl::plugin_options::init(const boost::program_options::variables_map& options)
473 {
474  utilities::get_program_option( options, "es-objects-elasticsearch-url", elasticsearch_url );
475  utilities::get_program_option( options, "es-objects-auth", auth );
476  utilities::get_program_option( options, "es-objects-bulk-replay", bulk_replay );
477  utilities::get_program_option( options, "es-objects-bulk-sync", bulk_sync );
478  utilities::get_program_option( options, "es-objects-proposals", proposals.enabled );
479  utilities::get_program_option( options, "es-objects-proposals-store-updates", proposals.store_updates );
480  utilities::get_program_option( options, "es-objects-proposals-no-delete", proposals.no_delete );
481  utilities::get_program_option( options, "es-objects-accounts", accounts.enabled );
482  utilities::get_program_option( options, "es-objects-accounts-store-updates", accounts.store_updates );
483  utilities::get_program_option( options, "es-objects-assets", assets.enabled );
484  utilities::get_program_option( options, "es-objects-assets-store-updates", assets.store_updates );
485  utilities::get_program_option( options, "es-objects-balances", balances.enabled );
486  utilities::get_program_option( options, "es-objects-balances-store-updates", balances.store_updates );
487  utilities::get_program_option( options, "es-objects-limit-orders", limit_orders.enabled );
488  utilities::get_program_option( options, "es-objects-limit-orders-store-updates", limit_orders.store_updates );
489  utilities::get_program_option( options, "es-objects-limit-orders-no-delete", limit_orders.no_delete );
490  utilities::get_program_option( options, "es-objects-asset-bitasset", asset_bitasset.enabled );
491  utilities::get_program_option( options, "es-objects-asset-bitasset-store-updates", asset_bitasset.store_updates );
492  utilities::get_program_option( options, "es-objects-budget-records", budget.enabled );
493  utilities::get_program_option( options, "es-objects-index-prefix", index_prefix );
494  utilities::get_program_option( options, "es-objects-max-mapping-depth", max_mapping_depth );
495  utilities::get_program_option( options, "es-objects-start-es-after-block", start_es_after_block );
496  utilities::get_program_option( options, "es-objects-sync-db-on-startup", sync_db_on_startup );
497 }
498 
499 void es_objects_plugin::plugin_initialize(const boost::program_options::variables_map& options)
500 {
501  my->init_program_options( options );
502 
503  database().new_objects.connect([this]( const vector<object_id_type>& ids,
504  const flat_set<account_id_type>& ) {
505  my->on_objects_create( ids );
506  });
507  database().changed_objects.connect([this]( const vector<object_id_type>& ids,
508  const flat_set<account_id_type>& ) {
509  my->on_objects_update( ids );
510  });
511  database().removed_objects.connect([this](const vector<object_id_type>& ids,
512  const vector<const object*>&, const flat_set<account_id_type>& ) {
513  my->on_objects_delete( ids );
514  });
515 
516 }
517 
519 {
520  if( 0 == database().head_block_num() )
521  my->sync_db( true );
522  else if( my->_options.sync_db_on_startup )
523  my->sync_db();
524 }
525 
527 {
528  my->send_bulk_if_ready(true); // flush
529 }
530 
531 } }
graphene::utilities::es_data_adaptor::adapt
static fc::variant adapt(const fc::variant_object &op, uint16_t max_depth)
Definition: elasticsearch.cpp:264
graphene::es_objects::detail::data_loader::data_loader
data_loader(es_objects_plugin_impl *_my)
Definition: es_objects.cpp:150
graphene::chain::database
tracks the blockchain state in an extensible manner
Definition: database.hpp:70
graphene::es_objects::detail::es_objects_plugin_impl::plugin_options::object_options::index_name
string index_name
Definition: es_objects.cpp:69
graphene::es_objects::detail::data_loader::load
void load(const es_objects_plugin_impl::plugin_options::object_options &opt, bool force_delete=false)
Definition: es_objects.cpp:156
graphene::es_objects::es_objects_plugin::~es_objects_plugin
~es_objects_plugin() override
graphene::utilities::get_program_option
void get_program_option(const boost::program_options::variables_map &from, const std::string &key, T &to)
Definition: boost_program_options.hpp:30
graphene::chain::database::head_block_time
time_point_sec head_block_time() const
Definition: db_getter.cpp:67
fc::mutable_variant_object
An order-perserving dictionary of variant's.
Definition: variant_object.hpp:108
graphene::utilities::createBulk
std::vector< std::string > createBulk(const fc::mutable_variant_object &bulk_header, std::string &&data)
Definition: elasticsearch.cpp:69
asset_object.hpp
graphene::db::object_database::get
const T & get(const object_id_type &id) const
Definition: object_database.hpp:119
graphene::es_objects::detail::es_objects_plugin_impl::plugin_options::object_options::store_updates
bool store_updates
Definition: es_objects.cpp:67
graphene::db::index::inspect_all_objects
virtual void inspect_all_objects(std::function< void(const object &)> inspector) const =0
budget_record_object.hpp
graphene::app::plugin::database
chain::database & database()
Definition: plugin.hpp:115
graphene::db::object_id::space_type
static constexpr uint16_t space_type
Definition: object_id.hpp:112
graphene::es_objects::es_objects_plugin::plugin_initialize
void plugin_initialize(const boost::program_options::variables_map &options) override
Perform early startup routines and register plugin indexes, callbacks, etc.
Definition: es_objects.cpp:499
boost_program_options.hpp
graphene::es_objects::detail::data_loader::db
graphene::chain::database & db
Definition: es_objects.cpp:148
elasticsearch.hpp
GRAPHENE_NET_MAX_NESTED_OBJECTS
#define GRAPHENE_NET_MAX_NESTED_OBJECTS
Definition: config.hpp:112
graphene::chain::database::removed_objects
fc::signal< void(const vector< object_id_type > &, const vector< const object * > &, const flat_set< account_id_type > &)> removed_objects
Definition: database.hpp:648
graphene::chain::asset_object
tracks the parameters of an asset
Definition: asset_object.hpp:75
graphene::es_objects::detail::data_loader::my
es_objects_plugin_impl * my
Definition: es_objects.cpp:147
graphene::es_objects::detail::es_objects_plugin_impl::plugin_options::object_options::object_options
object_options(bool e, bool su, bool nd, const string &in)
Definition: es_objects.cpp:62
graphene::chain::account_balance_object
Tracks the balance of a single account/asset pair.
Definition: account_object.hpp:157
proposal_object.hpp
fc::seconds
microseconds seconds(int64_t s)
Definition: time.hpp:34
fc::json::to_string
static string to_string(const variant &v, output_formatting format=stringify_large_ints_and_doubles, uint32_t max_depth=DEFAULT_MAX_RECURSION_DEPTH)
Definition: json.cpp:650
graphene::es_objects::detail::es_objects_plugin_impl
Definition: es_objects.cpp:47
graphene::chain::database::changed_objects
fc::signal< void(const vector< object_id_type > &, const flat_set< account_id_type > &)> changed_objects
Definition: database.hpp:642
graphene::app::application
Definition: application.hpp:91
graphene::utilities::es_client::request_size_threshold
static constexpr size_t request_size_threshold
When doing bulk operations, call send_bulk when the approximate size of pending data reaches this val...
Definition: elasticsearch.hpp:110
es_objects.hpp
ilog
#define ilog(FORMAT,...)
Definition: logger.hpp:117
graphene::es_objects::detail::es_objects_plugin_impl::plugin_options::object_options
Definition: es_objects.cpp:60
edump
#define edump(SEQ)
Definition: logger.hpp:182
graphene::chain::account_object
This class represents an account on the object graph.
Definition: account_object.hpp:180
fc::time_point_sec
Definition: time.hpp:74
account_object.hpp
graphene::es_objects::detail::es_objects_plugin_impl::plugin_options::object_options::no_delete
bool no_delete
Definition: es_objects.cpp:68
graphene::es_objects::es_objects_plugin::plugin_name
std::string plugin_name() const override
Get the name of the plugin.
Definition: es_objects.cpp:387
fc::json::legacy_generator
@ legacy_generator
Definition: json.hpp:33
graphene::es_objects::detail::data_loader
Definition: es_objects.cpp:145
graphene::chain::asset_bitasset_data_object
contains properties that only apply to bitassets (market issued assets)
Definition: asset_object.hpp:255
fc::to_variant
void to_variant(const flat_set< T, A... > &var, variant &vo, uint32_t _max_depth)
Definition: flat.hpp:105
graphene::es_objects::es_objects_plugin::plugin_shutdown
void plugin_shutdown() override
Cleanly shut down the plugin.
Definition: es_objects.cpp:526
graphene::es_objects::es_objects_plugin::plugin_set_program_options
void plugin_set_program_options(boost::program_options::options_description &cli, boost::program_options::options_description &cfg) override
Fill in command line parameters used by the plugin.
Definition: es_objects.cpp:396
graphene::es_objects::es_objects_plugin::plugin_description
std::string plugin_description() const override
Get the description of the plugin.
Definition: es_objects.cpp:391
graphene::chain::database::head_block_num
uint32_t head_block_num() const
Definition: db_getter.cpp:72
graphene::es_objects::detail::es_objects_plugin_impl::plugin_options::object_options::enabled
bool enabled
Definition: es_objects.cpp:66
graphene::es_objects::es_objects_plugin
Definition: es_objects.hpp:38
fc::time_point::now
static time_point now()
Definition: time.cpp:13
FC_ASSERT
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Definition: exception.hpp:345
fc::variant::get_object
variant_object & get_object()
Definition: variant.cpp:554
fc::variant
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition: variant.hpp:198
fc::time_point
Definition: time.hpp:44
std
Definition: zeroed_array.hpp:76
graphene::es_objects::detail::es_objects_plugin_impl::data_loader
friend struct data_loader
Definition: es_objects.cpp:56
graphene::es_objects::es_objects_plugin::es_objects_plugin
es_objects_plugin(graphene::app::application &app)
Definition: es_objects.cpp:378
graphene::chain::budget_record_object
Definition: budget_record_object.hpp:66
balance_object.hpp
graphene::db::object_database::get_index
const index & get_index() const
Definition: object_database.hpp:83
FC_THROW_EXCEPTION
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
Definition: exception.hpp:379
market_object.hpp
graphene::chain::proposal_object
tracks the approval of a partially approved transaction
Definition: proposal_object.hpp:40
graphene::chain::limit_order_object
an offer to sell an amount of an asset at a specified exchange rate by a certain time
Definition: market_object.hpp:45
graphene::chain::database::new_objects
fc::signal< void(const vector< object_id_type > &, const flat_set< account_id_type > &)> new_objects
Definition: database.hpp:636
graphene::es_objects::detail::es_objects_plugin_impl::es_objects_plugin_impl
es_objects_plugin_impl(es_objects_plugin &_plugin)
Definition: es_objects.cpp:50
graphene
Definition: api.cpp:48
graphene::es_objects::es_objects_plugin::plugin_startup
void plugin_startup() override
Begin normal runtime operations.
Definition: es_objects.cpp:518
elog
#define elog(FORMAT,...)
Definition: logger.hpp:129
graphene::db::object
base for all database objects
Definition: object.hpp:61