30 #include <boost/multi_index/composite_key.hpp> 32 namespace graphene {
namespace chain {
40 protocol_ids, custom_authority_object_type>
44 mutable optional<restriction_predicate_function> predicate_cache;
57 bool is_valid(time_point_sec now)
const {
return enabled && now >= valid_from && now <
valid_to; }
61 vector<restriction> rs;
63 std::back_inserter(rs), [](
auto i) {
return i.second; });
68 if (!predicate_cache.valid())
71 return *predicate_cache;
81 struct by_account_custom;
87 typedef multi_index_container<
90 ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>,
91 ordered_unique<tag<by_account_custom>,
92 composite_key<custom_authority_object,
93 member<custom_authority_object, account_id_type, &custom_authority_object::account>,
94 member<custom_authority_object, unsigned_int, &custom_authority_object::operation_type>,
95 member<custom_authority_object, bool, &custom_authority_object::enabled>,
96 member<object, object_id_type, &object::id>
98 ordered_unique<tag<by_expiration>,
99 composite_key<custom_authority_object,
100 member<custom_authority_object, time_point_sec, &custom_authority_object::valid_to>,
101 member<object, object_id_type, &object::id>
Identifies a weighted set of keys and accounts that must approve operations.
time_point_sec valid_from
restriction_predicate_function get_restriction_predicate(vector< restriction > rs, operation::tag_type op_type)
get_restriction_predicate Get a predicate function for the supplied restriction
#define MAP_OBJECT_ID_TO_TYPE(OBJECT)
void clear_predicate_cache()
Clear the cache of the predicate function.
unsigned_int operation_type
Tracks account custom authorities.
FC_REFLECT_TYPENAME(fc::log_message)
#define GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION(type)
std::function< predicate_result(const operation &)> restriction_predicate_function
A restriction predicate is a function accepting an operation and returning a predicate_result.
uint16_t restriction_counter
flat_map< uint16_t, restriction > restrictions
multi_index_container< custom_authority_object, indexed_by< ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >, ordered_unique< tag< by_account_custom >, composite_key< custom_authority_object, member< custom_authority_object, account_id_type, &custom_authority_object::account >, member< custom_authority_object, unsigned_int, &custom_authority_object::operation_type >, member< custom_authority_object, bool, &custom_authority_object::enabled >, member< object, object_id_type, &object::id > > >, ordered_unique< tag< by_expiration >, composite_key< custom_authority_object, member< custom_authority_object, time_point_sec, &custom_authority_object::valid_to >, member< object, object_id_type, &object::id > > > > > custom_authority_multi_index_type
typename impl::transform< List, Transformer >::type transform
Transform elements of a typelist.
restriction_predicate_function get_predicate() const
Get predicate, from cache if possible, and update cache if not (modifies const object!) ...
void update_predicate_cache() const
Regenerate predicate function and update predicate cache.
bool is_valid(time_point_sec now) const
Check whether the custom authority is valid.
vector< restriction > get_restrictions() const
Get the restrictions as a vector rather than a map.