Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
txn_test_gen_plugin.cpp File Reference
#include <sysio/txn_test_gen_plugin/txn_test_gen_plugin.hpp>
#include <sysio/chain_plugin/chain_plugin.hpp>
#include <sysio/chain/wast_to_wasm.hpp>
#include <sysio/chain/thread_utils.hpp>
#include <fc/variant.hpp>
#include <fc/io/json.hpp>
#include <fc/exception/exception.hpp>
#include <fc/reflect/variant.hpp>
#include <boost/asio/high_resolution_timer.hpp>
#include <boost/algorithm/clamp.hpp>
#include <Inline/BasicTypes.h>
#include <IR/Module.h>
#include <IR/Validate.h>
#include <WAST/WAST.h>
#include <WASM/WASM.h>
#include <Runtime/Runtime.h>
#include <contracts.hpp>
Include dependency graph for txn_test_gen_plugin.cpp:

Go to the source code of this file.

Classes

struct  sysio::detail::txn_test_gen_empty
 
struct  sysio::detail::txn_test_gen_status
 
struct  sysio::txn_test_gen_plugin_impl
 

Namespaces

namespace  sysio
 
namespace  sysio::detail
 

Macros

#define CALL(api_name, api_handle, call_name, INVOKE, http_response_code)
 
#define INVOKE_V_R_R_R(api_handle, call_name, in_param0, in_param1, in_param2)
 
#define INVOKE_V_R_R(api_handle, call_name, in_param0, in_param1)
 
#define INVOKE_V_V(api_handle, call_name)
 
#define CALL_ASYNC(api_name, api_handle, call_name, INVOKE, http_response_code)
 
#define INVOKE_ASYNC_R_R(api_handle, call_name, in_param0, in_param1)
 

Functions

 FC_REFLECT (sysio::detail::txn_test_gen_empty,)
 
 FC_REFLECT (sysio::detail::txn_test_gen_status,(status))
 

Macro Definition Documentation

◆ CALL

#define CALL ( api_name,
api_handle,
call_name,
INVOKE,
http_response_code )
Value:
{std::string("/v1/" #api_name "/" #call_name), \
[this](string, string body, url_response_callback cb) mutable { \
try { \
if (body.empty()) body = "{}"; \
INVOKE \
cb(http_response_code, fc::variant(result)); \
} catch (...) { \
http_plugin::handle_exception(#api_name, #call_name, body, cb); \
} \
}}
std::string string
Definition string.hpp:10

Definition at line 42 of file txn_test_gen_plugin.cpp.

42#define CALL(api_name, api_handle, call_name, INVOKE, http_response_code) \
43{std::string("/v1/" #api_name "/" #call_name), \
44 [this](string, string body, url_response_callback cb) mutable { \
45 try { \
46 if (body.empty()) body = "{}"; \
47 INVOKE \
48 cb(http_response_code, fc::variant(result)); \
49 } catch (...) { \
50 http_plugin::handle_exception(#api_name, #call_name, body, cb); \
51 } \
52 }}

◆ CALL_ASYNC

#define CALL_ASYNC ( api_name,
api_handle,
call_name,
INVOKE,
http_response_code )
Value:
{std::string("/v1/" #api_name "/" #call_name), \
[this](string, string body, url_response_callback cb) mutable { \
if (body.empty()) body = "{}"; \
/*plugin processes many transactions, report only first to avoid http_plugin having to deal with multiple responses*/ \
auto times_called = std::make_shared<std::atomic<size_t>>(0);\
auto result_handler = [times_called{std::move(times_called)}, cb, body](const fc::exception_ptr& e) mutable {\
if( ++(*times_called) > 1 ) return;\
if (e) {\
try {\
e->dynamic_rethrow_exception();\
} catch (...) {\
http_plugin::handle_exception(#api_name, #call_name, body, cb);\
}\
} else {\
cb(http_response_code, fc::variant(sysio::detail::txn_test_gen_empty())); \
}\
};\
INVOKE \
}\
}

Definition at line 68 of file txn_test_gen_plugin.cpp.

68#define CALL_ASYNC(api_name, api_handle, call_name, INVOKE, http_response_code) \
69{std::string("/v1/" #api_name "/" #call_name), \
70 [this](string, string body, url_response_callback cb) mutable { \
71 if (body.empty()) body = "{}"; \
72 /*plugin processes many transactions, report only first to avoid http_plugin having to deal with multiple responses*/ \
73 auto times_called = std::make_shared<std::atomic<size_t>>(0);\
74 auto result_handler = [times_called{std::move(times_called)}, cb, body](const fc::exception_ptr& e) mutable {\
75 if( ++(*times_called) > 1 ) return;\
76 if (e) {\
77 try {\
78 e->dynamic_rethrow_exception();\
79 } catch (...) {\
80 http_plugin::handle_exception(#api_name, #call_name, body, cb);\
81 }\
82 } else {\
83 cb(http_response_code, fc::variant(sysio::detail::txn_test_gen_empty())); \
84 }\
85 };\
86 INVOKE \
87 }\
88}

◆ INVOKE_ASYNC_R_R

#define INVOKE_ASYNC_R_R ( api_handle,
call_name,
in_param0,
in_param1 )
Value:
const auto& vs = fc::json::json::from_string(body).as<fc::variants>(); \
api_handle->call_name(vs.at(0).as<in_param0>(), vs.at(1).as<in_param1>(), result_handler);
std::vector< fc::variant > variants
Definition variant.hpp:173

Definition at line 90 of file txn_test_gen_plugin.cpp.

90#define INVOKE_ASYNC_R_R(api_handle, call_name, in_param0, in_param1) \
91 const auto& vs = fc::json::json::from_string(body).as<fc::variants>(); \
92 api_handle->call_name(vs.at(0).as<in_param0>(), vs.at(1).as<in_param1>(), result_handler);

◆ INVOKE_V_R_R

#define INVOKE_V_R_R ( api_handle,
call_name,
in_param0,
in_param1 )
Value:
const auto& vs = fc::json::json::from_string(body).as<fc::variants>(); \
api_handle->call_name(vs.at(0).as<in_param0>(), vs.at(1).as<in_param1>()); \

Definition at line 59 of file txn_test_gen_plugin.cpp.

59#define INVOKE_V_R_R(api_handle, call_name, in_param0, in_param1) \
60 const auto& vs = fc::json::json::from_string(body).as<fc::variants>(); \
61 api_handle->call_name(vs.at(0).as<in_param0>(), vs.at(1).as<in_param1>()); \
62 sysio::detail::txn_test_gen_empty result;

◆ INVOKE_V_R_R_R

#define INVOKE_V_R_R_R ( api_handle,
call_name,
in_param0,
in_param1,
in_param2 )
Value:
const auto& vs = fc::json::json::from_string(body).as<fc::variants>(); \
auto status = api_handle->call_name(vs.at(0).as<in_param0>(), vs.at(1).as<in_param1>(), vs.at(2).as<in_param2>()); \

Definition at line 54 of file txn_test_gen_plugin.cpp.

54#define INVOKE_V_R_R_R(api_handle, call_name, in_param0, in_param1, in_param2) \
55 const auto& vs = fc::json::json::from_string(body).as<fc::variants>(); \
56 auto status = api_handle->call_name(vs.at(0).as<in_param0>(), vs.at(1).as<in_param1>(), vs.at(2).as<in_param2>()); \
57 sysio::detail::txn_test_gen_status result = { status };

◆ INVOKE_V_V

#define INVOKE_V_V ( api_handle,
call_name )
Value:
api_handle->call_name(); \

Definition at line 64 of file txn_test_gen_plugin.cpp.

64#define INVOKE_V_V(api_handle, call_name) \
65 api_handle->call_name(); \
66 sysio::detail::txn_test_gen_empty result;

Function Documentation

◆ FC_REFLECT() [1/2]

◆ FC_REFLECT() [2/2]

FC_REFLECT ( sysio::detail::txn_test_gen_status ,
(status)  )