Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst > Class Template Reference

#include <apply_context.hpp>

Public Types

typedef ObjectType::secondary_key_type secondary_key_type
 
typedef SecondaryKeyProxy secondary_key_proxy_type
 
typedef SecondaryKeyProxyConst secondary_key_proxy_const_type
 
using secondary_key_helper_t = secondary_key_helper<secondary_key_type, secondary_key_proxy_type, secondary_key_proxy_const_type>
 

Public Member Functions

 generic_index (apply_context &c)
 
int store (uint64_t scope, uint64_t table, const account_name &payer, uint64_t id, secondary_key_proxy_const_type value)
 
void remove (int iterator)
 
void update (int iterator, account_name payer, secondary_key_proxy_const_type secondary)
 
int find_secondary (uint64_t code, uint64_t scope, uint64_t table, secondary_key_proxy_const_type secondary, uint64_t &primary)
 
int lowerbound_secondary (uint64_t code, uint64_t scope, uint64_t table, secondary_key_proxy_type secondary, uint64_t &primary)
 
int upperbound_secondary (uint64_t code, uint64_t scope, uint64_t table, secondary_key_proxy_type secondary, uint64_t &primary)
 
int end_secondary (uint64_t code, uint64_t scope, uint64_t table)
 
int next_secondary (int iterator, uint64_t &primary)
 
int previous_secondary (int iterator, uint64_t &primary)
 
int find_primary (uint64_t code, uint64_t scope, uint64_t table, secondary_key_proxy_type secondary, uint64_t primary)
 
int lowerbound_primary (uint64_t code, uint64_t scope, uint64_t table, uint64_t primary)
 
int upperbound_primary (uint64_t code, uint64_t scope, uint64_t table, uint64_t primary)
 
int next_primary (int iterator, uint64_t &primary)
 
int previous_primary (int iterator, uint64_t &primary)
 
void get (int iterator, uint64_t &primary, secondary_key_proxy_type secondary)
 

Detailed Description

template<typename ObjectType, typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
class sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >

Definition at line 166 of file apply_context.hpp.

Member Typedef Documentation

◆ secondary_key_helper_t

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
using sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::secondary_key_helper_t = secondary_key_helper<secondary_key_type, secondary_key_proxy_type, secondary_key_proxy_const_type>

Definition at line 173 of file apply_context.hpp.

◆ secondary_key_proxy_const_type

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
SecondaryKeyProxyConst sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::secondary_key_proxy_const_type

Definition at line 171 of file apply_context.hpp.

◆ secondary_key_proxy_type

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
SecondaryKeyProxy sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::secondary_key_proxy_type

Definition at line 170 of file apply_context.hpp.

◆ secondary_key_type

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
ObjectType::secondary_key_type sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::secondary_key_type

Definition at line 169 of file apply_context.hpp.

Constructor & Destructor Documentation

◆ generic_index()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::generic_index ( apply_context & c)
inline

Definition at line 175 of file apply_context.hpp.

175:context(c){}

Member Function Documentation

◆ end_secondary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::end_secondary ( uint64_t code,
uint64_t scope,
uint64_t table )
inline

Definition at line 334 of file apply_context.hpp.

334 {
335 auto tab = context.find_table( name(code), name(scope), name(table) );
336 if( !tab ) return -1;
337
338 return itr_cache.cache_table( *tab );
339 }
std::string name

◆ find_primary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::find_primary ( uint64_t code,
uint64_t scope,
uint64_t table,
secondary_key_proxy_type secondary,
uint64_t primary )
inline

Definition at line 388 of file apply_context.hpp.

388 {
389 auto tab = context.find_table( name(code), name(scope), name(table) );
390 if( !tab ) return -1;
391
392 auto table_end_itr = itr_cache.cache_table( *tab );
393
394 const auto* obj = context.db.find<ObjectType, by_primary>( boost::make_tuple( tab->id, primary ) );
395 if( !obj ) return table_end_itr;
396 secondary_key_helper_t::get(secondary, obj->secondary_key);
397
398 return itr_cache.add( *obj );
399 }

◆ find_secondary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::find_secondary ( uint64_t code,
uint64_t scope,
uint64_t table,
secondary_key_proxy_const_type secondary,
uint64_t & primary )
inline

Definition at line 286 of file apply_context.hpp.

286 {
287 auto tab = context.find_table( name(code), name(scope), name(table) );
288 if( !tab ) return -1;
289
290 auto table_end_itr = itr_cache.cache_table( *tab );
291
292 const auto* obj = context.db.find<ObjectType, by_secondary>( secondary_key_helper_t::create_tuple( *tab, secondary ) );
293 if( !obj ) return table_end_itr;
294
295 primary = obj->primary_key;
296
297 return itr_cache.add( *obj );
298 }

◆ get()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
void sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::get ( int iterator,
uint64_t & primary,
secondary_key_proxy_type secondary )
inline

Definition at line 477 of file apply_context.hpp.

477 {
478 const auto& obj = itr_cache.get( iterator );
479 primary = obj.primary_key;
480 secondary_key_helper_t::get(secondary, obj.secondary_key);
481 }

◆ lowerbound_primary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::lowerbound_primary ( uint64_t code,
uint64_t scope,
uint64_t table,
uint64_t primary )
inline

Definition at line 401 of file apply_context.hpp.

401 {
402 auto tab = context.find_table( name(code), name(scope), name(table) );
403 if (!tab) return -1;
404
405 auto table_end_itr = itr_cache.cache_table( *tab );
406
407 const auto& idx = context.db.get_index<typename chainbase::get_index_type<ObjectType>::type, by_primary>();
408 auto itr = idx.lower_bound(boost::make_tuple(tab->id, primary));
409 if (itr == idx.end()) return table_end_itr;
410 if (itr->t_id != tab->id) return table_end_itr;
411
412 return itr_cache.add(*itr);
413 }

◆ lowerbound_secondary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::lowerbound_secondary ( uint64_t code,
uint64_t scope,
uint64_t table,
secondary_key_proxy_type secondary,
uint64_t & primary )
inline

Definition at line 300 of file apply_context.hpp.

300 {
301 auto tab = context.find_table( name(code), name(scope), name(table) );
302 if( !tab ) return -1;
303
304 auto table_end_itr = itr_cache.cache_table( *tab );
305
306 const auto& idx = context.db.get_index< typename chainbase::get_index_type<ObjectType>::type, by_secondary >();
307 auto itr = idx.lower_bound( secondary_key_helper_t::create_tuple( *tab, secondary ) );
308 if( itr == idx.end() ) return table_end_itr;
309 if( itr->t_id != tab->id ) return table_end_itr;
310
311 primary = itr->primary_key;
312 secondary_key_helper_t::get(secondary, itr->secondary_key);
313
314 return itr_cache.add( *itr );
315 }

◆ next_primary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::next_primary ( int iterator,
uint64_t & primary )
inline

Definition at line 430 of file apply_context.hpp.

430 {
431 if( iterator < -1 ) return -1; // cannot increment past end iterator of table
432
433 const auto& obj = itr_cache.get(iterator); // Check for iterator != -1 happens in this call
434 const auto& idx = context.db.get_index<typename chainbase::get_index_type<ObjectType>::type, by_primary>();
435
436 auto itr = idx.iterator_to(obj);
437 ++itr;
438
439 if( itr == idx.end() || itr->t_id != obj.t_id ) return itr_cache.get_end_iterator_by_table_id(obj.t_id);
440
441 primary = itr->primary_key;
442 return itr_cache.add(*itr);
443 }

◆ next_secondary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::next_secondary ( int iterator,
uint64_t & primary )
inline

Definition at line 341 of file apply_context.hpp.

341 {
342 if( iterator < -1 ) return -1; // cannot increment past end iterator of index
343
344 const auto& obj = itr_cache.get(iterator); // Check for iterator != -1 happens in this call
345 const auto& idx = context.db.get_index<typename chainbase::get_index_type<ObjectType>::type, by_secondary>();
346
347 auto itr = idx.iterator_to(obj);
348 ++itr;
349
350 if( itr == idx.end() || itr->t_id != obj.t_id ) return itr_cache.get_end_iterator_by_table_id(obj.t_id);
351
352 primary = itr->primary_key;
353 return itr_cache.add(*itr);
354 }

◆ previous_primary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::previous_primary ( int iterator,
uint64_t & primary )
inline

Definition at line 445 of file apply_context.hpp.

445 {
446 const auto& idx = context.db.get_index<typename chainbase::get_index_type<ObjectType>::type, by_primary>();
447
448 if( iterator < -1 ) // is end iterator
449 {
450 auto tab = itr_cache.find_table_by_end_iterator(iterator);
451 SYS_ASSERT( tab, invalid_table_iterator, "not a valid end iterator" );
452
453 auto itr = idx.upper_bound(tab->id);
454 if( idx.begin() == idx.end() || itr == idx.begin() ) return -1; // Empty table
455
456 --itr;
457
458 if( itr->t_id != tab->id ) return -1; // Empty table
459
460 primary = itr->primary_key;
461 return itr_cache.add(*itr);
462 }
463
464 const auto& obj = itr_cache.get(iterator); // Check for iterator != -1 happens in this call
465
466 auto itr = idx.iterator_to(obj);
467 if( itr == idx.begin() ) return -1; // cannot decrement past beginning iterator of table
468
469 --itr;
470
471 if( itr->t_id != obj.t_id ) return -1; // cannot decrement past beginning iterator of index
472
473 primary = itr->primary_key;
474 return itr_cache.add(*itr);
475 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7

◆ previous_secondary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::previous_secondary ( int iterator,
uint64_t & primary )
inline

Definition at line 356 of file apply_context.hpp.

356 {
357 const auto& idx = context.db.get_index<typename chainbase::get_index_type<ObjectType>::type, by_secondary>();
358
359 if( iterator < -1 ) // is end iterator
360 {
361 auto tab = itr_cache.find_table_by_end_iterator(iterator);
362 SYS_ASSERT( tab, invalid_table_iterator, "not a valid end iterator" );
363
364 auto itr = idx.upper_bound(tab->id);
365 if( idx.begin() == idx.end() || itr == idx.begin() ) return -1; // Empty index
366
367 --itr;
368
369 if( itr->t_id != tab->id ) return -1; // Empty index
370
371 primary = itr->primary_key;
372 return itr_cache.add(*itr);
373 }
374
375 const auto& obj = itr_cache.get(iterator); // Check for iterator != -1 happens in this call
376
377 auto itr = idx.iterator_to(obj);
378 if( itr == idx.begin() ) return -1; // cannot decrement past beginning iterator of index
379
380 --itr;
381
382 if( itr->t_id != obj.t_id ) return -1; // cannot decrement past beginning iterator of index
383
384 primary = itr->primary_key;
385 return itr_cache.add(*itr);
386 }

◆ remove()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
void sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::remove ( int iterator)
inline

Definition at line 213 of file apply_context.hpp.

213 {
214 const auto& obj = itr_cache.get( iterator );
215
216 const auto& table_obj = itr_cache.get_table( obj.t_id );
217 SYS_ASSERT( table_obj.code == context.receiver, table_access_violation, "db access violation" );
218
219 if (auto dm_logger = context.control.get_deep_mind_logger()) {
220 std::string event_id = RAM_EVENT_ID("${code}:${scope}:${table}:${index_name}",
221 ("code", table_obj.code)
222 ("scope", table_obj.scope)
223 ("table", table_obj.table)
224 ("index_name", name(obj.primary_key))
225 );
226 dm_logger->on_ram_trace(std::move(event_id), "secondary_index", "remove", "secondary_index_remove");
227 }
228
229 context.update_db_usage( obj.payer, -( config::billable_size_v<ObjectType> ) );
230
231// context.require_write_lock( table_obj.scope );
232
233 context.db.modify( table_obj, [&]( auto& t ) {
234 --t.count;
235 });
236 context.db.remove( obj );
237
238 if (table_obj.count == 0) {
239 context.remove_table(table_obj);
240 }
241
242 itr_cache.remove( iterator );
243 }
#define RAM_EVENT_ID(FORMAT,...)
Definition deep_mind.hpp:27
constexpr uint64_t billable_size_v
Definition config.hpp:147

◆ store()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::store ( uint64_t scope,
uint64_t table,
const account_name & payer,
uint64_t id,
secondary_key_proxy_const_type value )
inline

Definition at line 177 of file apply_context.hpp.

179 {
180 SYS_ASSERT( payer != account_name(), invalid_table_payer, "must specify a valid account to pay for new record" );
181
182// context.require_write_lock( scope );
183
184 const auto& tab = context.find_or_create_table( context.receiver, name(scope), name(table), payer );
185
186 const auto& obj = context.db.create<ObjectType>( [&]( auto& o ){
187 o.t_id = tab.id;
188 o.primary_key = id;
189 secondary_key_helper_t::set(o.secondary_key, value);
190 o.payer = payer;
191 });
192
193 context.db.modify( tab, [&]( auto& t ) {
194 ++t.count;
195
196 if (auto dm_logger = context.control.get_deep_mind_logger()) {
197 std::string event_id = RAM_EVENT_ID("${code}:${scope}:${table}:${index_name}",
198 ("code", t.code)
199 ("scope", t.scope)
200 ("table", t.table)
201 ("index_name", name(id))
202 );
203 dm_logger->on_ram_trace(std::move(event_id), "secondary_index", "add", "secondary_index_add");
204 }
205 });
206
207 context.update_db_usage( payer, config::billable_size_v<ObjectType> );
208
209 itr_cache.cache_table( tab );
210 return itr_cache.add( obj );
211 }
uint64_t id
Definition code_cache.cpp:0
name account_name
Definition types.hpp:120
#define value
Definition pkcs11.h:157

◆ update()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
void sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::update ( int iterator,
account_name payer,
secondary_key_proxy_const_type secondary )
inline

Definition at line 245 of file apply_context.hpp.

245 {
246 const auto& obj = itr_cache.get( iterator );
247
248 const auto& table_obj = itr_cache.get_table( obj.t_id );
249 SYS_ASSERT( table_obj.code == context.receiver, table_access_violation, "db access violation" );
250
251// context.require_write_lock( table_obj.scope );
252
253 if( payer == account_name() ) payer = obj.payer;
254
256
257 std::string event_id;
258 if (context.control.get_deep_mind_logger() != nullptr) {
259 event_id = RAM_EVENT_ID("${code}:${scope}:${table}:${index_name}",
260 ("code", table_obj.code)
261 ("scope", table_obj.scope)
262 ("table", table_obj.table)
263 ("index_name", name(obj.primary_key))
264 );
265 }
266
267 if( obj.payer != payer ) {
268 if (auto dm_logger = context.control.get_deep_mind_logger())
269 {
270 dm_logger->on_ram_trace(std::string(event_id), "secondary_index", "remove", "secondary_index_remove");
271 }
272 context.update_db_usage( obj.payer, -(billing_size) );
273 if (auto dm_logger = context.control.get_deep_mind_logger())
274 {
275 dm_logger->on_ram_trace(std::move(event_id), "secondary_index", "add", "secondary_index_update_add_new_payer");
276 }
277 context.update_db_usage( payer, +(billing_size) );
278 }
279
280 context.db.modify( obj, [&]( auto& o ) {
281 secondary_key_helper_t::set(o.secondary_key, secondary);
282 o.payer = payer;
283 });
284 }
signed __int64 int64_t
Definition stdint.h:135

◆ upperbound_primary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::upperbound_primary ( uint64_t code,
uint64_t scope,
uint64_t table,
uint64_t primary )
inline

Definition at line 415 of file apply_context.hpp.

415 {
416 auto tab = context.find_table( name(code), name(scope), name(table) );
417 if ( !tab ) return -1;
418
419 auto table_end_itr = itr_cache.cache_table( *tab );
420
421 const auto& idx = context.db.get_index<typename chainbase::get_index_type<ObjectType>::type, by_primary>();
422 auto itr = idx.upper_bound(boost::make_tuple(tab->id, primary));
423 if (itr == idx.end()) return table_end_itr;
424 if (itr->t_id != tab->id) return table_end_itr;
425
426 itr_cache.cache_table(*tab);
427 return itr_cache.add(*itr);
428 }

◆ upperbound_secondary()

template<typename ObjectType , typename SecondaryKeyProxy = typename std::add_lvalue_reference<typename ObjectType::secondary_key_type>::type, typename SecondaryKeyProxyConst = typename std::add_lvalue_reference< typename std::add_const<typename ObjectType::secondary_key_type>::type>::type>
int sysio::chain::apply_context::generic_index< ObjectType, SecondaryKeyProxy, SecondaryKeyProxyConst >::upperbound_secondary ( uint64_t code,
uint64_t scope,
uint64_t table,
secondary_key_proxy_type secondary,
uint64_t & primary )
inline

Definition at line 317 of file apply_context.hpp.

317 {
318 auto tab = context.find_table( name(code), name(scope), name(table) );
319 if( !tab ) return -1;
320
321 auto table_end_itr = itr_cache.cache_table( *tab );
322
323 const auto& idx = context.db.get_index< typename chainbase::get_index_type<ObjectType>::type, by_secondary >();
324 auto itr = idx.upper_bound( secondary_key_helper_t::create_tuple( *tab, secondary ) );
325 if( itr == idx.end() ) return table_end_itr;
326 if( itr->t_id != tab->id ) return table_end_itr;
327
328 primary = itr->primary_key;
329 secondary_key_helper_t::get(secondary, itr->secondary_key);
330
331 return itr_cache.add( *itr );
332 }

The documentation for this class was generated from the following file: