Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
generated_transaction_object.hpp
Go to the documentation of this file.
1#pragma once
4
6#include <fc/uint128.hpp>
7
8#include <boost/multi_index/hashed_index.hpp>
9#include <boost/multi_index/mem_fun.hpp>
10
12
13namespace sysio { namespace chain {
14 using boost::multi_index_container;
15 using namespace boost::multi_index;
22 class generated_transaction_object : public chainbase::object<generated_transaction_object_type, generated_transaction_object>
23 {
25
26 id_type id;
27 transaction_id_type trx_id; //< trx_id should not be changed within a chainbase modifier lambda
28 account_name sender; //< sender should not be changed within a chainbase modifier lambda
29 uint128_t sender_id = 0;
30 account_name payer;
31 time_point delay_until;
32 time_point expiration;
33 time_point published;
34 shared_blob packed_trx;
35
36 uint32_t set( const transaction& trx ) {
37 auto trxsize = fc::raw::pack_size( trx );
38 packed_trx.resize_and_fill( trxsize, [&trx](char* data, std::size_t size) {
39 fc::datastream<char*> ds( data, size );
40 fc::raw::pack( ds, trx );
41 });
42 return trxsize;
43 }
44 };
45
46 struct by_trx_id;
47 struct by_expiration;
48 struct by_delay;
49 struct by_status;
50 struct by_sender_id;
51
54 indexed_by<
55 ordered_unique< tag<by_id>, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, generated_transaction_object::id_type, id)>,
56 ordered_unique< tag<by_trx_id>, BOOST_MULTI_INDEX_MEMBER( generated_transaction_object, transaction_id_type, trx_id)>,
57 ordered_unique< tag<by_expiration>,
58 composite_key< generated_transaction_object,
59 BOOST_MULTI_INDEX_MEMBER( generated_transaction_object, time_point, expiration),
61 >
62 >,
63 ordered_unique< tag<by_delay>,
64 composite_key< generated_transaction_object,
65 BOOST_MULTI_INDEX_MEMBER( generated_transaction_object, time_point, delay_until),
67 >
68 >,
69 ordered_unique< tag<by_sender_id>,
70 composite_key< generated_transaction_object,
71 BOOST_MULTI_INDEX_MEMBER( generated_transaction_object, account_name, sender),
72 BOOST_MULTI_INDEX_MEMBER( generated_transaction_object, uint128_t, sender_id)
73 >
74 >
75 >
76 >;
77
105
106 namespace config {
107 template<>
109 static const uint64_t overhead = overhead_per_row_per_index_ram_bytes * 5;
110 static const uint64_t value = 96 + 4 + overhead;
111 };
112 }
113} } // sysio::chain
114
116
117FC_REFLECT(sysio::chain::generated_transaction_object, (trx_id)(sender)(sender_id)(payer)(delay_until)(expiration)(published)(packed_trx))
#define OBJECT_CTOR(...)
Definition types.hpp:39
#define CHAINBASE_SET_INDEX_TYPE(OBJECT_TYPE, INDEX_TYPE)
void resize_and_fill(std::size_t new_size, F &&f)
time_point expiration
this generated transaction will not be applied until the specified time
time_point published
this generated transaction will not be applied after this time
generated_transaction(generated_transaction &&gt)=default
generated_transaction(const generated_transaction &gt)=default
generated_transaction(const generated_transaction_object &gto)
boost::multi_index_container< Object, Args..., chainbase::node_allocator< Object > > shared_multi_index_container
void pack(Stream &s, const std::deque< T > &value)
Definition raw.hpp:531
size_t pack_size(const T &v)
Definition raw.hpp:671
unsigned __int128 uint128_t
Definition types.hpp:242
chainbase::shared_multi_index_container< generated_transaction_object, indexed_by< ordered_unique< tag< by_id >, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, generated_transaction_object::id_type, id)>, ordered_unique< tag< by_trx_id >, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, transaction_id_type, trx_id)>, ordered_unique< tag< by_expiration >, composite_key< generated_transaction_object, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, time_point, expiration), > >, ordered_unique< tag< by_delay >, composite_key< generated_transaction_object, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, time_point, delay_until), > >, ordered_unique< tag< by_sender_id >, composite_key< generated_transaction_object, BOOST_MULTI_INDEX_MEMBER(generated_transaction_object, account_name, sender), > > > > generated_transaction_multi_index
#define value
Definition pkcs11.h:157
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition reflect.hpp:311
unsigned int uint32_t
Definition stdint.h:126
unsigned __int64 uint64_t
Definition stdint.h:136
Immutable except for fc::from_variant.
Definition name.hpp:43
bool set