BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
custom_objects.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 oxarbitrage 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 
26 #include <boost/multi_index/composite_key.hpp>
28 
29 namespace graphene { namespace custom_operations {
30 
31 using namespace chain;
32 
33 constexpr uint8_t CUSTOM_OPERATIONS_SPACE_ID = 7;
34 
35 constexpr uint16_t CUSTOM_OPERATIONS_MAX_KEY_SIZE = 200;
36 
38  account_map = 0
39 };
40 
41 struct account_storage_object : public abstract_object<account_storage_object, CUSTOM_OPERATIONS_SPACE_ID,
42  static_cast<uint8_t>( custom_operations_object_types::account_map )>
43 {
44  account_id_type account;
45  string catalog;
46  string key;
47  optional<variant> value;
48 };
49 
50 struct by_account_catalog_key;
51 struct by_account_catalog;
52 struct by_account;
53 struct by_catalog_key;
54 struct by_catalog;
55 
56 using account_storage_multi_idx_type = multi_index_container<
58  indexed_by<
59  ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
60  ordered_unique< tag<by_account_catalog_key>,
61  composite_key< account_storage_object,
62  member< account_storage_object, account_id_type, &account_storage_object::account >,
63  member< account_storage_object, string, &account_storage_object::catalog >,
64  member< account_storage_object, string, &account_storage_object::key >
65  >
66  >,
67  ordered_unique< tag<by_account_catalog>,
68  composite_key< account_storage_object,
69  member< account_storage_object, account_id_type, &account_storage_object::account >,
70  member< account_storage_object, string, &account_storage_object::catalog >,
71  member< object, object_id_type, &object::id >
72  >
73  >,
74  ordered_unique< tag<by_account>,
75  composite_key< account_storage_object,
76  member< account_storage_object, account_id_type, &account_storage_object::account >,
77  member< object, object_id_type, &object::id >
78  >
79  >,
80  ordered_unique< tag<by_catalog_key>,
81  composite_key< account_storage_object,
82  member< account_storage_object, string, &account_storage_object::catalog >,
83  member< account_storage_object, string, &account_storage_object::key >,
84  member< object, object_id_type, &object::id >
85  >
86  >,
87  ordered_unique< tag<by_catalog>,
88  composite_key< account_storage_object,
89  member< account_storage_object, string, &account_storage_object::catalog >,
90  member< object, object_id_type, &object::id >
91  >
92  >
93  >
94 >;
95 
97 
99 
100 } } //graphene::custom_operations
101 
103  (account)(catalog)(key)(value))
graphene::custom_operations::CUSTOM_OPERATIONS_SPACE_ID
constexpr uint8_t CUSTOM_OPERATIONS_SPACE_ID
Definition: custom_objects.hpp:33
database.hpp
graphene::custom_operations::account_storage_object::value
optional< variant > value
Definition: custom_objects.hpp:47
graphene::custom_operations::account_storage_object::key
string key
Definition: custom_objects.hpp:46
graphene::custom_operations::CUSTOM_OPERATIONS_MAX_KEY_SIZE
constexpr uint16_t CUSTOM_OPERATIONS_MAX_KEY_SIZE
Definition: custom_objects.hpp:35
graphene::db::abstract_object
Definition: object.hpp:107
graphene::custom_operations::account_storage_object
Definition: custom_objects.hpp:41
FC_REFLECT_DERIVED
#define FC_REFLECT_DERIVED(TYPE, INHERITS, MEMBERS)
Specializes fc::reflector for TYPE where type inherits other reflected classes.
Definition: reflect.hpp:305
graphene::custom_operations::custom_operations_object_types::account_map
@ account_map
graphene::custom_operations::account_storage_object::catalog
string catalog
Definition: custom_objects.hpp:45
graphene::custom_operations::account_storage_object::account
account_id_type account
Definition: custom_objects.hpp:44
graphene::custom_operations::custom_operations_object_types
custom_operations_object_types
Definition: custom_objects.hpp:37
FC_REFLECT_ENUM
FC_REFLECT_ENUM(graphene::net::core_message_type_enum,(trx_message_type)(block_message_type)(core_message_type_first)(item_ids_inventory_message_type)(blockchain_item_ids_inventory_message_type)(fetch_blockchain_item_ids_message_type)(fetch_items_message_type)(item_not_available_message_type)(hello_message_type)(connection_accepted_message_type)(connection_rejected_message_type)(address_request_message_type)(address_message_type)(closing_connection_message_type)(current_time_request_message_type)(current_time_reply_message_type)(check_firewall_message_type)(check_firewall_reply_message_type)(get_current_connections_request_message_type)(get_current_connections_reply_message_type)(core_message_type_last))(different_chain)(already_connected)(connected_to_self)(not_accepting_connections)(blocked)(invalid_hello_message)(client_too_old))(inbound)(outbound))(firewalled)(not_firewalled))(unable_to_connect)(connection_successful)) namespace std
Definition: core_messages.hpp:404
graphene::db::object_id
Definition: object_id.hpp:103
graphene::custom_operations::account_storage_multi_idx_type
multi_index_container< account_storage_object, indexed_by< ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >, ordered_unique< tag< by_account_catalog_key >, composite_key< account_storage_object, member< account_storage_object, account_id_type, &account_storage_object::account >, member< account_storage_object, string, &account_storage_object::catalog >, member< account_storage_object, string, &account_storage_object::key > > >, ordered_unique< tag< by_account_catalog >, composite_key< account_storage_object, member< account_storage_object, account_id_type, &account_storage_object::account >, member< account_storage_object, string, &account_storage_object::catalog >, member< object, object_id_type, &object::id > > >, ordered_unique< tag< by_account >, composite_key< account_storage_object, member< account_storage_object, account_id_type, &account_storage_object::account >, member< object, object_id_type, &object::id > > >, ordered_unique< tag< by_catalog_key >, composite_key< account_storage_object, member< account_storage_object, string, &account_storage_object::catalog >, member< account_storage_object, string, &account_storage_object::key >, member< object, object_id_type, &object::id > > >, ordered_unique< tag< by_catalog >, composite_key< account_storage_object, member< account_storage_object, string, &account_storage_object::catalog >, member< object, object_id_type, &object::id > > > > > account_storage_multi_idx_type
Definition: custom_objects.hpp:94
graphene::db::generic_index
Definition: generic_index.hpp:43
graphene
Definition: api.cpp:48
graphene::db::object
base for all database objects
Definition: object.hpp:61