提交 4a4026eb 编写于 作者: B Brian Johnson

Moved object and multi index definition to its own header file and added type comment

上级 69f0bb13
......@@ -171,7 +171,7 @@ namespace eos { namespace chain {
transaction_object_type,
producer_object_type,
chain_property_object_type,
transaction_history_object_type,
transaction_history_object_type, ///< Defined by account history plugin library
balance_object_type, ///< Defined by native_contract library
staked_balance_object_type, ///< Defined by native_contract library
producer_votes_object_type, ///< Defined by native_contract library
......
#include <eos/account_history_plugin/account_history_plugin.hpp>
#include <eos/account_history_plugin/account_history_object.hpp>
#include <eos/chain/chain_controller.hpp>
#include <eos/chain/config.hpp>
#include <eos/chain/exceptions.hpp>
......@@ -13,6 +14,8 @@
#include <boost/multi_index/mem_fun.hpp>
#include <eos/chain/multi_index_includes.hpp>
namespace fc { class variant; }
namespace eos {
using chain::block_id_type;
......@@ -22,26 +25,6 @@ using boost::multi_index_container;
using chain::transaction_id_type;
using namespace boost::multi_index;
class transaction_history_object : public chainbase::object<chain::transaction_history_object_type, transaction_history_object> {
OBJECT_CTOR(transaction_history_object)
id_type id;
block_id_type block_id;
transaction_id_type transaction_id;
};
struct by_id;
struct by_trx_id;
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_unique<tag<by_trx_id>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, transaction_id_type, transaction_id), std::hash<transaction_id_type>>
>
>;
typedef chainbase::generic_index<transaction_history_multi_index> transaction_history_index;
class account_history_plugin_impl {
public:
ProcessedTransaction get_transaction(const chain::transaction_id_type& transaction_id) const;
......@@ -151,7 +134,3 @@ read_only::get_transaction_results read_only::get_transaction(const read_only::g
} // namespace account_history_apis
} // namespace eos
CHAINBASE_SET_INDEX_TYPE( eos::transaction_history_object, eos::transaction_history_multi_index )
FC_REFLECT( eos::transaction_history_object, (block_id)(transaction_id) )
#pragma once
#include <chainbase/chainbase.hpp>
namespace eos {
using chain::block_id_type;
using chain::transaction_id_type;
using namespace boost::multi_index;
class transaction_history_object : public chainbase::object<chain::transaction_history_object_type, transaction_history_object> {
OBJECT_CTOR(transaction_history_object)
id_type id;
block_id_type block_id;
transaction_id_type transaction_id;
};
struct by_id;
struct by_trx_id;
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_unique<tag<by_trx_id>, BOOST_MULTI_INDEX_MEMBER(transaction_history_object, transaction_id_type, transaction_id), std::hash<transaction_id_type>>
>
>;
typedef chainbase::generic_index<transaction_history_multi_index> transaction_history_index;
}
CHAINBASE_SET_INDEX_TYPE( eos::transaction_history_object, eos::transaction_history_multi_index )
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.
先完成此消息的编辑!
想要评论请 注册