#85 - changing key_object from simple_index to multi_index
This commit is contained in:
parent
ffd797c048
commit
c4b2bb443b
3 changed files with 28 additions and 1 deletions
|
|
@ -103,11 +103,18 @@ void database::initialize_indexes()
|
|||
//Protocol object indexes
|
||||
add_index< primary_index<asset_index> >();
|
||||
add_index< primary_index<force_settlement_index> >();
|
||||
|
||||
auto acnt_index = add_index< primary_index<account_index> >();
|
||||
acnt_index->add_secondary_index<account_member_index>();
|
||||
acnt_index->add_secondary_index<account_referrer_index>();
|
||||
|
||||
add_index< primary_index<simple_index<key_object>> >();
|
||||
// this is the fast effecient version for validation only
|
||||
// add_index< primary_index<simple_index<key_object>> >();
|
||||
|
||||
// this is the slower version designed to aid GUI use. We will
|
||||
// default to the "slow" version until we need a faster version.
|
||||
add_index< primary_index<key_index> >();
|
||||
|
||||
add_index< primary_index<delegate_index> >();
|
||||
add_index< primary_index<witness_index> >();
|
||||
add_index< primary_index<limit_order_index > >();
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ namespace graphene { namespace chain {
|
|||
|
||||
explicit operator std::string()const; ///< converts to base58 + checksum
|
||||
|
||||
friend size_t hash_value( const address& v ) { return *((size_t*)&v.addr._hash[2]); }
|
||||
fc::ripemd160 addr;
|
||||
};
|
||||
inline bool operator == ( const address& a, const address& b ) { return a.addr == b.addr; }
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
#include <graphene/chain/address.hpp>
|
||||
#include <fc/static_variant.hpp>
|
||||
#include <graphene/chain/types.hpp>
|
||||
#include <graphene/db/generic_index.hpp>
|
||||
#include <boost/multi_index/composite_key.hpp>
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
typedef static_variant<address,public_key_type> address_or_key;
|
||||
|
|
@ -42,6 +44,23 @@ namespace graphene { namespace chain {
|
|||
|
||||
address_or_key key_data;
|
||||
};
|
||||
|
||||
struct by_address;
|
||||
|
||||
/**
|
||||
* @ingroup object_index
|
||||
*/
|
||||
typedef multi_index_container<
|
||||
key_object,
|
||||
indexed_by<
|
||||
hashed_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
|
||||
hashed_non_unique< tag<by_address>, const_mem_fun<key_object, address, &key_object::key_address> >
|
||||
>
|
||||
> key_multi_index_type;
|
||||
/**
|
||||
* @ingroup object_index
|
||||
*/
|
||||
typedef generic_index<key_object, key_multi_index_type> key_index;
|
||||
} }
|
||||
|
||||
FC_REFLECT_TYPENAME( graphene::chain::address_or_key )
|
||||
|
|
|
|||
Loading…
Reference in a new issue