39 if( itr == in_collateral.end() )
46 auto itr = backing_collateral.find( o.
debt_type() );
47 if( itr == backing_collateral.end() )
61 if( itr != in_collateral.end() )
66 auto itr = backing_collateral.find( o.
debt_type() );
67 if( itr != backing_collateral.end() )
85 auto itr = in_collateral.find( asst );
86 if( itr == in_collateral.end() )
return 0;
92 auto itr = backing_collateral.find( asst );
93 if( itr == backing_collateral.end() )
return 0;
100 const liquidity_pool_id_type pool_id = o.
get_id();
101 asset_in_pools_map[ o.asset_a ].insert( pool_id );
102 asset_in_pools_map[ o.asset_b ].insert( pool_id );
108 const liquidity_pool_id_type pool_id = o.
get_id();
109 asset_in_pools_map[ o.asset_a ].erase( pool_id );
110 asset_in_pools_map[ o.asset_b ].erase( pool_id );
125 const asset_id_type& a )
const
127 auto itr = asset_in_pools_map.find( a );
128 if( itr != asset_in_pools_map.end() )
156 my(
std::make_unique<detail::api_helper_indexes_impl>(*this) )
161 api_helper_indexes::~api_helper_indexes() =
default;
163 std::string api_helper_indexes::plugin_name()
const
165 return "api_helper_indexes";
167 std::string api_helper_indexes::plugin_description()
const
169 return "Provides some helper indexes used by various API calls";
172 void api_helper_indexes::plugin_set_program_options(
173 boost::program_options::options_description& cli,
174 boost::program_options::options_description& cfg
179 void api_helper_indexes::plugin_initialize(
const boost::program_options::variables_map& options)
183 void api_helper_indexes::plugin_startup()
185 ilog(
"api_helper_indexes: plugin_startup() begin");
211 _next_ids_map_initialized =
true;
215 void api_helper_indexes::refresh_next_ids()
218 if( _next_ids_map_initialized )
220 for(
auto& item : next_object_ids_idx->_next_ids )
222 item.second = db.get_index( item.first.first, item.first.second ).get_next_id();
230 size_t failed_count = 0;
237 const auto& idx = db.get_index( space, type );
238 next_object_ids_idx->_next_ids[ std::make_pair( space, type ) ] = idx.get_next_id();
247 dlog(
"${count} indexes detected, ${failed_count} not found", (
"count",count)(
"failed_count",failed_count) );
252 return _next_ids.at( std::make_pair( space_id, type_id ) );