BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
db_init.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cryptonomex, Inc., 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 
54 
75 
76 namespace graphene { namespace chain {
77 
78 void database::initialize_evaluators()
79 {
80  constexpr size_t max_num_of_evaluators = 255;
81  _operation_evaluators.resize(max_num_of_evaluators);
82  register_evaluator<account_create_evaluator>();
83  register_evaluator<account_update_evaluator>();
84  register_evaluator<account_upgrade_evaluator>();
85  register_evaluator<account_whitelist_evaluator>();
86  register_evaluator<committee_member_create_evaluator>();
87  register_evaluator<committee_member_update_evaluator>();
88  register_evaluator<committee_member_update_global_parameters_evaluator>();
89  register_evaluator<custom_evaluator>();
90  register_evaluator<asset_create_evaluator>();
91  register_evaluator<asset_issue_evaluator>();
92  register_evaluator<asset_reserve_evaluator>();
93  register_evaluator<asset_update_evaluator>();
94  register_evaluator<asset_update_bitasset_evaluator>();
95  register_evaluator<asset_update_feed_producers_evaluator>();
96  register_evaluator<asset_settle_evaluator>();
97  register_evaluator<asset_global_settle_evaluator>();
98  register_evaluator<assert_evaluator>();
99  register_evaluator<limit_order_create_evaluator>();
100  register_evaluator<limit_order_update_evaluator>();
101  register_evaluator<limit_order_cancel_evaluator>();
102  register_evaluator<call_order_update_evaluator>();
103  register_evaluator<bid_collateral_evaluator>();
104  register_evaluator<transfer_evaluator>();
105  register_evaluator<override_transfer_evaluator>();
106  register_evaluator<asset_fund_fee_pool_evaluator>();
107  register_evaluator<asset_publish_feeds_evaluator>();
108  register_evaluator<proposal_create_evaluator>();
109  register_evaluator<proposal_update_evaluator>();
110  register_evaluator<proposal_delete_evaluator>();
111  register_evaluator<vesting_balance_create_evaluator>();
112  register_evaluator<vesting_balance_withdraw_evaluator>();
113  register_evaluator<witness_create_evaluator>();
114  register_evaluator<witness_update_evaluator>();
115  register_evaluator<withdraw_permission_create_evaluator>();
116  register_evaluator<withdraw_permission_claim_evaluator>();
117  register_evaluator<withdraw_permission_update_evaluator>();
118  register_evaluator<withdraw_permission_delete_evaluator>();
119  register_evaluator<worker_create_evaluator>();
120  register_evaluator<balance_claim_evaluator>();
121  register_evaluator<transfer_to_blind_evaluator>();
122  register_evaluator<transfer_from_blind_evaluator>();
123  register_evaluator<blind_transfer_evaluator>();
124  register_evaluator<asset_claim_fees_evaluator>();
125  register_evaluator<asset_update_issuer_evaluator>();
126  register_evaluator<asset_claim_pool_evaluator>();
127  register_evaluator<htlc_create_evaluator>();
128  register_evaluator<htlc_redeem_evaluator>();
129  register_evaluator<htlc_extend_evaluator>();
130  register_evaluator<custom_authority_create_evaluator>();
131  register_evaluator<custom_authority_update_evaluator>();
132  register_evaluator<custom_authority_delete_evaluator>();
133  register_evaluator<ticket_create_evaluator>();
134  register_evaluator<ticket_update_evaluator>();
135  register_evaluator<liquidity_pool_create_evaluator>();
136  register_evaluator<liquidity_pool_delete_evaluator>();
137  register_evaluator<liquidity_pool_update_evaluator>();
138  register_evaluator<liquidity_pool_deposit_evaluator>();
139  register_evaluator<liquidity_pool_withdraw_evaluator>();
140  register_evaluator<liquidity_pool_exchange_evaluator>();
141  register_evaluator<samet_fund_create_evaluator>();
142  register_evaluator<samet_fund_delete_evaluator>();
143  register_evaluator<samet_fund_update_evaluator>();
144  register_evaluator<samet_fund_borrow_evaluator>();
145  register_evaluator<samet_fund_repay_evaluator>();
146  register_evaluator<credit_offer_create_evaluator>();
147  register_evaluator<credit_offer_delete_evaluator>();
148  register_evaluator<credit_offer_update_evaluator>();
149  register_evaluator<credit_offer_accept_evaluator>();
150  register_evaluator<credit_deal_repay_evaluator>();
151  register_evaluator<credit_deal_update_evaluator>();
152 }
153 
155 {
156  reset_indexes();
158 
159  //Protocol object indexes
160  add_index< primary_index<asset_index, 13> >(); // 8192 assets per chunk
161  add_index< primary_index<force_settlement_index> >();
162 
163  add_index< primary_index<account_index, 20> >(); // ~1 million accounts per chunk
164  add_index< primary_index<committee_member_index, 8> >(); // 256 members per chunk
165  add_index< primary_index<witness_index, 10> >(); // 1024 witnesses per chunk
166  add_index< primary_index<limit_order_index > >();
167  add_index< primary_index<call_order_index > >();
168  add_index< primary_index<proposal_index > >();
169  add_index< primary_index<withdraw_permission_index > >();
170  add_index< primary_index<vesting_balance_index> >();
171  add_index< primary_index<worker_index> >();
172  add_index< primary_index<balance_index> >();
173  add_index< primary_index<blinded_balance_index> >();
174  add_index< primary_index< htlc_index> >();
175  add_index< primary_index< custom_authority_index> >();
176  add_index< primary_index<ticket_index> >();
177  add_index< primary_index<liquidity_pool_index> >();
178  add_index< primary_index<samet_fund_index> >();
179  add_index< primary_index<credit_offer_index> >();
180  add_index< primary_index<credit_deal_index> >();
181 
182  //Implementation object indexes
183  add_index< primary_index<transaction_index > >();
184 
185  auto bal_idx = add_index< primary_index<account_balance_index > >();
186  bal_idx->add_secondary_index<balances_by_account_index>();
187 
188  add_index< primary_index<asset_bitasset_data_index, 13 > >(); // 8192
189  add_index< primary_index<simple_index<global_property_object >> >();
190  add_index< primary_index<simple_index<dynamic_global_property_object >> >();
191  add_index< primary_index<account_stats_index, 20 > >(); // 1 Mi
192  add_index< primary_index<simple_index<asset_dynamic_data_object >> >();
193  add_index< primary_index<simple_index<block_summary_object >> >();
194  add_index< primary_index<simple_index<chain_property_object > > >();
195  add_index< primary_index<simple_index<witness_schedule_object > > >();
196  add_index< primary_index<simple_index<budget_record_object > > >();
197  add_index< primary_index< special_authority_index > >();
198  add_index< primary_index< buyback_index > >();
199  add_index< primary_index<collateral_bid_index > >();
200  add_index< primary_index< simple_index< fba_accumulator_object > > >();
201  add_index< primary_index<credit_deal_summary_index > >();
202 }
203 
204 } }
liquidity_pool_object.hpp
transaction_history_object.hpp
samet_fund_object.hpp
htlc_evaluator.hpp
asset_object.hpp
budget_record_object.hpp
database.hpp
worker_evaluator.hpp
proposal_evaluator.hpp
account_evaluator.hpp
custom_authority_object.hpp
chain_property_object.hpp
custom_authority_evaluator.hpp
custom_evaluator.hpp
proposal_object.hpp
graphene::chain::balances_by_account_index
This secondary index will allow fast access to the balance objects that belonging to an account.
Definition: account_object.hpp:361
special_authority_object.hpp
committee_member_evaluator.hpp
worker_object.hpp
asset_evaluator.hpp
ticket_evaluator.hpp
buyback_object.hpp
account_object.hpp
withdraw_permission_evaluator.hpp
samet_fund_evaluator.hpp
htlc_object.hpp
vesting_balance_object.hpp
committee_member_object.hpp
credit_offer_object.hpp
transfer_evaluator.hpp
witness_evaluator.hpp
graphene::db::undo_database::set_max_size
void set_max_size(size_t new_max_size)
Definition: undo_database.hpp:121
operation_history_object.hpp
credit_offer_evaluator.hpp
vesting_balance_evaluator.hpp
block_summary_object.hpp
liquidity_pool_evaluator.hpp
confidential_object.hpp
balance_evaluator.hpp
graphene::chain::database::initialize_indexes
void initialize_indexes()
Reset the object graph in-memory.
Definition: db_init.cpp:154
confidential_evaluator.hpp
balance_object.hpp
GRAPHENE_MIN_UNDO_HISTORY
#define GRAPHENE_MIN_UNDO_HISTORY
Definition: config.hpp:30
witness_schedule_object.hpp
market_object.hpp
withdraw_permission_object.hpp
fba_object.hpp
witness_object.hpp
global_property_object.hpp
assert_evaluator.hpp
graphene
Definition: api.cpp:48
ticket_object.hpp
market_evaluator.hpp
graphene::db::object_database::reset_indexes
void reset_indexes()
Definition: object_database.hpp:47
graphene::db::object_database::_undo_db
undo_database _undo_db
Definition: object_database.hpp:170