BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
operation_history_object.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 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 #pragma once
25 
27 #include <graphene/db/object.hpp>
28 
29 #include <boost/multi_index/composite_key.hpp>
30 
31 namespace graphene { namespace chain {
32 
48  class operation_history_object : public abstract_object<operation_history_object,
49  protocol_ids, operation_history_object_type>
50  {
51  public:
52  explicit operation_history_object( const operation& o ):op(o){}
53  operation_history_object() = default;
54  operation_history_object( const operation& o, uint32_t bn, uint16_t tib, uint16_t oit, uint32_t vo, bool iv,
55  const time_point_sec& bt )
56  : op(o), block_num(bn), trx_in_block(tib), op_in_trx(oit), virtual_op(vo), is_virtual(iv), block_time(bt) {}
57 
61  uint32_t block_num = 0;
63  uint16_t trx_in_block = 0;
65  uint16_t op_in_trx = 0;
67  uint32_t virtual_op = 0;
69  bool is_virtual = false;
72  };
73 
95  class account_history_object : public abstract_object<account_history_object,
96  implementation_ids, impl_account_history_object_type>
97  {
98  public:
99  account_id_type account;
100  operation_history_id_type operation_id;
101  uint64_t sequence = 0;
102  account_history_id_type next;
103  };
104 
105  struct by_block;
106  struct by_time;
107 
108  using operation_history_mlti_idx_type = multi_index_container<
110  indexed_by<
111  ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
112  ordered_unique< tag<by_block>,
113  composite_key< operation_history_object,
114  member< operation_history_object, uint32_t, &operation_history_object::block_num>,
115  member< operation_history_object, uint16_t, &operation_history_object::trx_in_block>,
116  member< operation_history_object, uint16_t, &operation_history_object::op_in_trx>,
117  member< operation_history_object, uint32_t, &operation_history_object::virtual_op>
118  >
119  >,
120  ordered_unique< tag<by_time>,
121  composite_key< operation_history_object,
122  member< operation_history_object, time_point_sec, &operation_history_object::block_time>,
123  member< object, object_id_type, &object::id >
124  >,
125  composite_key_compare<
126  std::greater< time_point_sec >,
127  std::greater< object_id_type >
128  >
129  >
130  >
131  >;
132 
134 
135  struct by_seq;
136  struct by_op;
137  struct by_opid;
138 
139  using account_history_multi_idx_type = multi_index_container<
141  indexed_by<
142  ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
143  ordered_unique< tag<by_seq>,
144  composite_key< account_history_object,
145  member< account_history_object, account_id_type, &account_history_object::account>,
146  member< account_history_object, uint64_t, &account_history_object::sequence>
147  >
148  >,
149  ordered_unique< tag<by_op>,
150  composite_key< account_history_object,
151  member< account_history_object, account_id_type, &account_history_object::account>,
152  member< account_history_object, operation_history_id_type, &account_history_object::operation_id>
153  >,
154  composite_key_compare<
155  std::less< account_id_type >,
156  std::greater< operation_history_id_type >
157  >
158  >,
159  ordered_non_unique< tag<by_opid>,
160  member< account_history_object, operation_history_id_type, &account_history_object::operation_id>
161  >
162  >
163  >;
164 
166 
167 
168 } } // graphene::chain
169 
172 
175 
graphene::chain::account_history_object::operation_id
operation_history_id_type operation_id
the account this operation applies to
Definition: operation_history_object.hpp:100
graphene::chain::account_history_multi_idx_type
multi_index_container< account_history_object, indexed_by< ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >, ordered_unique< tag< by_seq >, composite_key< account_history_object, member< account_history_object, account_id_type, &account_history_object::account >, member< account_history_object, uint64_t, &account_history_object::sequence > > >, ordered_unique< tag< by_op >, composite_key< account_history_object, member< account_history_object, account_id_type, &account_history_object::account >, member< account_history_object, operation_history_id_type, &account_history_object::operation_id > >, composite_key_compare< std::less< account_id_type >, std::greater< operation_history_id_type > > >, ordered_non_unique< tag< by_opid >, member< account_history_object, operation_history_id_type, &account_history_object::operation_id > > > > account_history_multi_idx_type
Definition: operation_history_object.hpp:163
graphene::chain::operation_history_mlti_idx_type
multi_index_container< operation_history_object, indexed_by< ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >, ordered_unique< tag< by_block >, composite_key< operation_history_object, member< operation_history_object, uint32_t, &operation_history_object::block_num >, member< operation_history_object, uint16_t, &operation_history_object::trx_in_block >, member< operation_history_object, uint16_t, &operation_history_object::op_in_trx >, member< operation_history_object, uint32_t, &operation_history_object::virtual_op > > >, ordered_unique< tag< by_time >, composite_key< operation_history_object, member< operation_history_object, time_point_sec, &operation_history_object::block_time >, member< object, object_id_type, &object::id > >, composite_key_compare< std::greater< time_point_sec >, std::greater< object_id_type > > > > > operation_history_mlti_idx_type
Definition: operation_history_object.hpp:131
graphene::chain::operation_history_object::virtual_op
uint32_t virtual_op
Definition: operation_history_object.hpp:67
graphene::chain::operation_history_object::op
operation op
Definition: operation_history_object.hpp:58
fc::static_variant< transfer_operation, limit_order_create_operation, limit_order_cancel_operation, call_order_update_operation, fill_order_operation, account_create_operation, account_update_operation, account_whitelist_operation, account_upgrade_operation, account_transfer_operation, asset_create_operation, asset_update_operation, asset_update_bitasset_operation, asset_update_feed_producers_operation, asset_issue_operation, asset_reserve_operation, asset_fund_fee_pool_operation, asset_settle_operation, asset_global_settle_operation, asset_publish_feed_operation, witness_create_operation, witness_update_operation, proposal_create_operation, proposal_update_operation, proposal_delete_operation, withdraw_permission_create_operation, withdraw_permission_update_operation, withdraw_permission_claim_operation, withdraw_permission_delete_operation, committee_member_create_operation, committee_member_update_operation, committee_member_update_global_parameters_operation, vesting_balance_create_operation, vesting_balance_withdraw_operation, worker_create_operation, custom_operation, assert_operation, balance_claim_operation, override_transfer_operation, transfer_to_blind_operation, blind_transfer_operation, transfer_from_blind_operation, asset_settle_cancel_operation, asset_claim_fees_operation, fba_distribute_operation, bid_collateral_operation, execute_bid_operation, asset_claim_pool_operation, asset_update_issuer_operation, htlc_create_operation, htlc_redeem_operation, htlc_redeemed_operation, htlc_extend_operation, htlc_refund_operation, custom_authority_create_operation, custom_authority_update_operation, custom_authority_delete_operation, ticket_create_operation, ticket_update_operation, liquidity_pool_create_operation, liquidity_pool_delete_operation, liquidity_pool_deposit_operation, liquidity_pool_withdraw_operation, liquidity_pool_exchange_operation, samet_fund_create_operation, samet_fund_delete_operation, samet_fund_update_operation, samet_fund_borrow_operation, samet_fund_repay_operation, credit_offer_create_operation, credit_offer_delete_operation, credit_offer_update_operation, credit_offer_accept_operation, credit_deal_repay_operation, credit_deal_expired_operation, liquidity_pool_update_operation, credit_deal_update_operation, limit_order_update_operation >
FC_REFLECT_TYPENAME
FC_REFLECT_TYPENAME(fc::log_message)
graphene::chain::operation_history_object::trx_in_block
uint16_t trx_in_block
Definition: operation_history_object.hpp:63
graphene::chain::operation_history_object::op_in_trx
uint16_t op_in_trx
Definition: operation_history_object.hpp:65
MAP_OBJECT_ID_TO_TYPE
#define MAP_OBJECT_ID_TO_TYPE(OBJECT)
Definition: object_id.hpp:93
graphene::chain::operation_history_object::operation_history_object
operation_history_object(const operation &o, uint32_t bn, uint16_t tib, uint16_t oit, uint32_t vo, bool iv, const time_point_sec &bt)
Definition: operation_history_object.hpp:54
graphene::db::abstract_object
Definition: object.hpp:107
graphene::chain::account_history_object::account
account_id_type account
Definition: operation_history_object.hpp:99
graphene::chain::account_history_object::next
account_history_id_type next
the operation position within the given account
Definition: operation_history_object.hpp:102
operations.hpp
graphene::chain::operation_history_object::block_num
uint32_t block_num
Definition: operation_history_object.hpp:61
fc::time_point_sec
Definition: time.hpp:74
GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION
#define GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION(type)
Definition: types.hpp:85
graphene::chain::operation_history_object::operation_history_object
operation_history_object(const operation &o)
Definition: operation_history_object.hpp:52
graphene::chain::account_history_object
a node in a linked list of operation_history_objects
Definition: operation_history_object.hpp:95
graphene::chain::account_history_object::sequence
uint64_t sequence
Definition: operation_history_object.hpp:101
graphene::chain::operation_history_object::result
operation_result result
Definition: operation_history_object.hpp:59
graphene::db::generic_index
Definition: generic_index.hpp:43
graphene::chain::operation_history_object::block_time
time_point_sec block_time
Definition: operation_history_object.hpp:71
graphene::chain::operation_history_object::operation_history_object
operation_history_object()=default
object.hpp
graphene
Definition: api.cpp:48
graphene::chain::operation_history_object
tracks the history of all logical operations on blockchain state
Definition: operation_history_object.hpp:48
graphene::chain::operation_history_object::is_virtual
bool is_virtual
Definition: operation_history_object.hpp:69