提交 6283188f 编写于 作者: B Brian Johnson

Splitting out tracking account transactions into its own index.

上级 f0d14a0c
......@@ -174,6 +174,7 @@ namespace eos { namespace chain {
generated_transaction_object_type,
producer_object_type,
chain_property_object_type,
account_transaction_history_object_type, ///< Defined by account_history_plugin
transaction_history_object_type, ///< Defined by account_history_plugin
balance_object_type, ///< Defined by native_contract library
staked_balance_object_type, ///< Defined by native_contract library
......@@ -223,6 +224,7 @@ FC_REFLECT_ENUM(eos::chain::object_type,
(generated_transaction_object_type)
(producer_object_type)
(chain_property_object_type)
(account_transaction_history_object_type)
(transaction_history_object_type)
(balance_object_type)
(staked_balance_object_type)
......
#pragma once
#include <chainbase/chainbase.hpp>
#include <eos/chain/types.hpp>
namespace std {
template<>
struct hash<eos::chain::AccountName>
{
size_t operator()( const eos::chain::AccountName& name )const
{
return (uint64_t)name;
}
};
}
namespace eos {
using chain::AccountName;
using chain::shared_vector;
using chain::transaction_id_type;
using namespace boost::multi_index;
class account_transaction_history_object : public chainbase::object<chain::account_transaction_history_object_type, account_transaction_history_object> {
OBJECT_CTOR(account_transaction_history_object)
id_type id;
AccountName account_name;
transaction_id_type transaction_id;
};
struct by_id;
struct by_account_name;
struct by_account_name_trx_id;
using account_transaction_history_multi_index = chainbase::shared_multi_index_container<
account_transaction_history_object,
indexed_by<
ordered_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(account_transaction_history_object, account_transaction_history_object::id_type, id)>,
hashed_non_unique<tag<by_account_name>, BOOST_MULTI_INDEX_MEMBER(account_transaction_history_object, AccountName, account_name), std::hash<AccountName>>,
hashed_unique<tag<by_account_name_trx_id>,
composite_key< account_transaction_history_object,
member<account_transaction_history_object, AccountName, &account_transaction_history_object::account_name>,
member<account_transaction_history_object, transaction_id_type, &account_transaction_history_object::transaction_id>
>,
composite_key_hash< std::hash<AccountName>, std::hash<transaction_id_type> >
>
>
>;
typedef chainbase::generic_index<account_transaction_history_multi_index> account_transaction_history_index;
}
CHAINBASE_SET_INDEX_TYPE( eos::account_transaction_history_object, eos::account_transaction_history_multi_index )
FC_REFLECT( eos::account_transaction_history_object, (account_name)(transaction_id) )
......@@ -2,20 +2,7 @@
#include <chainbase/chainbase.hpp>
namespace std {
template<>
struct hash<eos::chain::AccountName>
{
size_t operator()( const eos::chain::AccountName& name )const
{
return (uint64_t)name;
}
};
}
namespace eos {
using chain::AccountName;
using chain::block_id_type;
using chain::transaction_id_type;
using namespace boost::multi_index;
......@@ -26,18 +13,15 @@ class transaction_history_object : public chainbase::object<chain::transaction_h
id_type id;
block_id_type block_id;
transaction_id_type transaction_id;
AccountName account_name;
};
struct by_id;
struct by_trx_id;
struct by_account_name;
using transaction_history_multi_index = chainbase::shared_multi_index_container<
transaction_history_object,
indexed_by<
ordered_unique<tag<by_id>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, transaction_history_object::id_type, id)>,
hashed_non_unique<tag<by_trx_id>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, transaction_id_type, transaction_id), std::hash<transaction_id_type>>,
hashed_non_unique<tag<by_account_name>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, AccountName, account_name), std::hash<AccountName>>
hashed_unique<tag<by_trx_id>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, transaction_id_type, transaction_id), std::hash<transaction_id_type>>
>
>;
......@@ -47,5 +31,5 @@ typedef chainbase::generic_index<transaction_history_multi_index> transaction_hi
CHAINBASE_SET_INDEX_TYPE( eos::transaction_history_object, eos::transaction_history_multi_index )
FC_REFLECT( eos::transaction_history_object, (block_id)(transaction_id)(account_name) )
FC_REFLECT( eos::transaction_history_object, (block_id)(transaction_id) )
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册