Skip to content

Commit db329d2

Browse files
Marek KochanowiczAndrzej Lisak
authored andcommitted
implement pool allocator for chain objects
1 parent f1510e3 commit db329d2

File tree

26 files changed

+564
-132
lines changed

26 files changed

+564
-132
lines changed

libraries/chain/include/hive/chain/account_object.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ namespace hive { namespace chain {
585585
>
586586
>
587587
>,
588-
allocator< account_object >
588+
multi_index_allocator< account_object >
589589
> account_index;
590590

591591
struct by_account {};
@@ -598,7 +598,7 @@ namespace hive { namespace chain {
598598
ordered_unique< tag< by_account >,
599599
member< account_metadata_object, account_id_type, &account_metadata_object::account > >
600600
>,
601-
allocator< account_metadata_object >
601+
multi_index_allocator< account_metadata_object >
602602
> account_metadata_index;
603603

604604
typedef multi_index_container <
@@ -615,7 +615,7 @@ namespace hive { namespace chain {
615615
composite_key_compare< std::less< account_name_type >, std::less< time_point_sec >, std::less< owner_authority_history_id_type > >
616616
>
617617
>,
618-
allocator< owner_authority_history_object >
618+
multi_index_allocator< owner_authority_history_object >
619619
> owner_authority_history_index;
620620

621621
typedef multi_index_container <
@@ -631,7 +631,7 @@ namespace hive { namespace chain {
631631
composite_key_compare< std::less< account_name_type >, std::less< account_authority_id_type > >
632632
>
633633
>,
634-
allocator< account_authority_object >
634+
multi_index_allocator< account_authority_object >
635635
> account_authority_index;
636636

637637
struct by_delegation {};
@@ -648,7 +648,7 @@ namespace hive { namespace chain {
648648
>
649649
>
650650
>,
651-
allocator< vesting_delegation_object >
651+
multi_index_allocator< vesting_delegation_object >
652652
> vesting_delegation_index;
653653

654654
struct by_expiration {};
@@ -673,7 +673,7 @@ namespace hive { namespace chain {
673673
>
674674
>
675675
>,
676-
allocator< vesting_delegation_expiration_object >
676+
multi_index_allocator< vesting_delegation_expiration_object >
677677
> vesting_delegation_expiration_index;
678678

679679
struct by_expiration;
@@ -694,7 +694,7 @@ namespace hive { namespace chain {
694694
composite_key_compare< std::less< time_point_sec >, std::less< const account_name_type& > >
695695
>
696696
>,
697-
allocator< account_recovery_request_object >
697+
multi_index_allocator< account_recovery_request_object >
698698
> account_recovery_request_index;
699699

700700
struct by_effective_date {};
@@ -715,7 +715,7 @@ namespace hive { namespace chain {
715715
composite_key_compare< std::less< time_point_sec >, std::less< const account_name_type& > >
716716
>
717717
>,
718-
allocator< change_recovery_account_request_object >
718+
multi_index_allocator< change_recovery_account_request_object >
719719
> change_recovery_account_request_index;
720720
} }
721721

libraries/chain/include/hive/chain/block_summary_object.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace hive { namespace chain {
2929
ordered_unique< tag< by_id >,
3030
const_mem_fun< block_summary_object, block_summary_object::id_type, &block_summary_object::get_id > >
3131
>,
32-
allocator< block_summary_object >
32+
multi_index_allocator< block_summary_object >
3333
> block_summary_index;
3434

3535
} } // hive::chain

libraries/chain/include/hive/chain/comment_object.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ namespace hive { namespace chain {
436436
>
437437
>
438438
>,
439-
allocator< comment_vote_object >
439+
multi_index_allocator< comment_vote_object >
440440
> comment_vote_index;
441441

442442

@@ -454,7 +454,7 @@ namespace hive { namespace chain {
454454
ordered_unique< tag< by_permlink >, /// used by consensus to find posts referenced in ops
455455
const_mem_fun< comment_object, const comment_object::author_and_permlink_hash_type&, &comment_object::get_author_and_permlink_hash > >
456456
>,
457-
allocator< comment_object >
457+
multi_index_allocator< comment_object >
458458
> comment_index;
459459

460460
struct by_cashout_time; /// cashout_time
@@ -471,7 +471,7 @@ namespace hive { namespace chain {
471471
>
472472
>
473473
>,
474-
allocator< comment_cashout_object >
474+
multi_index_allocator< comment_cashout_object >
475475
> comment_cashout_index;
476476

477477
struct by_root;
@@ -489,7 +489,7 @@ namespace hive { namespace chain {
489489
>
490490
>
491491
>,
492-
allocator< comment_cashout_ex_object >
492+
multi_index_allocator< comment_cashout_ex_object >
493493
> comment_cashout_ex_index;
494494

495495
} } // hive::chain

libraries/chain/include/hive/chain/dhf_objects.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ typedef multi_index_container<
121121
composite_key_compare< std::less< uint64_t >, std::less< uint32_t > >
122122
>
123123
>,
124-
allocator< proposal_object >
124+
multi_index_allocator< proposal_object >
125125
> proposal_index;
126126

127127
struct by_voter_proposal;
@@ -145,7 +145,7 @@ typedef multi_index_container<
145145
>
146146
>
147147
>,
148-
allocator< proposal_vote_object >
148+
multi_index_allocator< proposal_vote_object >
149149
> proposal_vote_index;
150150

151151
} } // hive::chain

libraries/chain/include/hive/chain/hardfork_property_object.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace hive { namespace chain {
5252
ordered_unique< tag< by_id >,
5353
const_mem_fun< hardfork_property_object, hardfork_property_object::id_type, &hardfork_property_object::get_id > >
5454
>,
55-
allocator< hardfork_property_object >
55+
multi_index_allocator< hardfork_property_object >
5656
> hardfork_property_index;
5757

5858
} } // hive::chain

libraries/chain/include/hive/chain/hive_object_types.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ using chainbase::object;
2727
using chainbase::oid;
2828
using chainbase::oid_ref;
2929
using chainbase::allocator;
30+
using chainbase::multi_index_allocator;
31+
using chainbase::undo_state_allocator;
3032

3133
using hive::protocol::block_id_type;
3234
using hive::protocol::transaction_id_type;

libraries/chain/include/hive/chain/hive_objects.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ namespace hive { namespace chain {
439439
>
440440
>
441441
>,
442-
allocator< limit_order_object >
442+
multi_index_allocator< limit_order_object >
443443
> limit_order_index;
444444

445445
struct by_owner;
@@ -462,7 +462,7 @@ namespace hive { namespace chain {
462462
>
463463
>
464464
>,
465-
allocator< convert_request_object >
465+
multi_index_allocator< convert_request_object >
466466
> convert_request_index;
467467

468468
struct by_owner;
@@ -485,7 +485,7 @@ namespace hive { namespace chain {
485485
>
486486
>
487487
>,
488-
allocator< collateralized_convert_request_object >
488+
multi_index_allocator< collateralized_convert_request_object >
489489
> collateralized_convert_request_index;
490490

491491
struct by_owner;
@@ -506,7 +506,7 @@ namespace hive { namespace chain {
506506
composite_key_compare< std::greater< fc::uint128 >, std::less< account_id_type > >
507507
>
508508
>,
509-
allocator< liquidity_reward_balance_object >
509+
multi_index_allocator< liquidity_reward_balance_object >
510510
> liquidity_reward_balance_index;
511511

512512
typedef multi_index_container<
@@ -515,7 +515,7 @@ namespace hive { namespace chain {
515515
ordered_unique< tag< by_id >,
516516
const_mem_fun< feed_history_object, feed_history_object::id_type, &feed_history_object::get_id > >
517517
>,
518-
allocator< feed_history_object >
518+
multi_index_allocator< feed_history_object >
519519
> feed_history_index;
520520

521521
struct by_withdraw_route;
@@ -539,7 +539,7 @@ namespace hive { namespace chain {
539539
>
540540
>
541541
>,
542-
allocator< withdraw_vesting_route_object >
542+
multi_index_allocator< withdraw_vesting_route_object >
543543
> withdraw_vesting_route_index;
544544

545545
struct by_from_id {};
@@ -564,7 +564,7 @@ namespace hive { namespace chain {
564564
composite_key_compare< std::less< bool >, std::less< time_point_sec >, std::less< escrow_id_type > >
565565
>
566566
>,
567-
allocator< escrow_object >
567+
multi_index_allocator< escrow_object >
568568
> escrow_index;
569569

570570
struct by_from_rid {};
@@ -596,7 +596,7 @@ namespace hive { namespace chain {
596596
>
597597
>
598598
>,
599-
allocator< savings_withdraw_object >
599+
multi_index_allocator< savings_withdraw_object >
600600
> savings_withdraw_index;
601601

602602
struct by_account;
@@ -617,7 +617,7 @@ namespace hive { namespace chain {
617617
composite_key_compare< std::less< time_point_sec >, std::less< account_name_type > >
618618
>
619619
>,
620-
allocator< decline_voting_rights_request_object >
620+
multi_index_allocator< decline_voting_rights_request_object >
621621
> decline_voting_rights_request_index;
622622

623623
typedef multi_index_container<
@@ -628,7 +628,7 @@ namespace hive { namespace chain {
628628
ordered_unique< tag< by_name >,
629629
member< reward_fund_object, reward_fund_name_type, &reward_fund_object::name > >
630630
>,
631-
allocator< reward_fund_object >
631+
multi_index_allocator< reward_fund_object >
632632
> reward_fund_index;
633633

634634
struct by_from_to_id;
@@ -660,7 +660,7 @@ namespace hive { namespace chain {
660660
composite_key_compare< std::less< account_id_type >, std::less< account_id_type >, std::less< uint8_t > >
661661
>
662662
>,
663-
allocator< recurrent_transfer_object >
663+
multi_index_allocator< recurrent_transfer_object >
664664
> recurrent_transfer_index;
665665

666666
} } // hive::chain

libraries/chain/include/hive/chain/rc/rc_objects.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ typedef multi_index_container<
261261
ordered_unique< tag< by_id >,
262262
const_mem_fun< rc_resource_param_object, rc_resource_param_object::id_type, &rc_resource_param_object::get_id > >
263263
>,
264-
allocator< rc_resource_param_object >
264+
multi_index_allocator< rc_resource_param_object >
265265
> rc_resource_param_index;
266266

267267
typedef multi_index_container<
@@ -270,7 +270,7 @@ typedef multi_index_container<
270270
ordered_unique< tag< by_id >,
271271
const_mem_fun< rc_pool_object, rc_pool_object::id_type, &rc_pool_object::get_id > >
272272
>,
273-
allocator< rc_pool_object >
273+
multi_index_allocator< rc_pool_object >
274274
> rc_pool_index;
275275

276276
typedef multi_index_container<
@@ -279,7 +279,7 @@ typedef multi_index_container<
279279
ordered_unique< tag< by_id >,
280280
const_mem_fun< rc_stats_object, rc_stats_object::id_type, &rc_stats_object::get_id > >
281281
>,
282-
allocator< rc_stats_object >
282+
multi_index_allocator< rc_stats_object >
283283
> rc_stats_index;
284284

285285
struct by_from_to;
@@ -296,7 +296,7 @@ typedef multi_index_container<
296296
>
297297
>
298298
>,
299-
allocator< rc_direct_delegation_object >
299+
multi_index_allocator< rc_direct_delegation_object >
300300
> rc_direct_delegation_index;
301301

302302
typedef multi_index_container<
@@ -307,7 +307,7 @@ typedef multi_index_container<
307307
ordered_unique< tag< by_account >,
308308
member< rc_expired_delegation_object, account_id_type, &rc_expired_delegation_object::from > >
309309
>,
310-
allocator< rc_expired_delegation_object >
310+
multi_index_allocator< rc_expired_delegation_object >
311311
> rc_expired_delegation_index;
312312

313313
struct by_timestamp;
@@ -320,7 +320,7 @@ typedef multi_index_container<
320320
ordered_unique< tag< by_timestamp >,
321321
const_mem_fun< rc_usage_bucket_object, time_point_sec, &rc_usage_bucket_object::get_timestamp > >
322322
>,
323-
allocator< rc_usage_bucket_object >
323+
multi_index_allocator< rc_usage_bucket_object >
324324
> rc_usage_bucket_index;
325325

326326
} } // hive::chain

libraries/chain/include/hive/chain/smt_objects/account_balance_object.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ typedef multi_index_container <
9393
>
9494
>
9595
>,
96-
allocator< account_regular_balance_object >
96+
multi_index_allocator< account_regular_balance_object >
9797
> account_regular_balance_index;
9898

9999
typedef multi_index_container <
@@ -109,7 +109,7 @@ typedef multi_index_container <
109109
>
110110
>
111111
>,
112-
allocator< account_rewards_balance_object >
112+
multi_index_allocator< account_rewards_balance_object >
113113
> account_rewards_balance_index;
114114

115115
} } // namespace hive::chain

libraries/chain/include/hive/chain/smt_objects/nai_pool_object.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace hive { namespace chain {
3838
ordered_unique< tag< by_id >,
3939
const_mem_fun< nai_pool_object, nai_pool_object::id_type, &nai_pool_object::get_id > >
4040
>,
41-
allocator< nai_pool_object >
41+
multi_index_allocator< nai_pool_object >
4242
> nai_pool_index;
4343

4444
} } // namespace hive::chain

0 commit comments

Comments
 (0)