Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
deep_mind.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <fc/log/logger.hpp>
4
6
7namespace sysio::chain {
8
9class account_ram_correction_object;
10class generated_transaction_object;
11class table_id_object;
12struct key_value_object;
13class permission_object;
14struct block_state;
15struct protocol_feature;
16struct signed_transaction;
17struct packed_transaction;
18struct transaction_trace;
19struct ram_trace;
20namespace resource_limits {
21 class resource_limits_config_object;
22 class resource_limits_state_object;
23 struct resource_limits_object;
24 struct resource_usage_object;
25}
26
27#define RAM_EVENT_ID( FORMAT, ... ) \
28 fc::format_string( FORMAT, fc::mutable_variant_object()__VA_ARGS__ )
29
30struct ram_trace {
31public:
32 ram_trace(std::string&& event_id, const char* family, const char* operation, const char* legacy_tag)
33 :event_id(std::move(event_id)),family(family),operation(operation),legacy_tag(legacy_tag)
34 {}
35
36 std::string event_id = "generic";
37 const char* family = "generic";
38 const char* operation = "generic";
39 const char* legacy_tag = "generic";
40
42 {}
43};
44
46{
47public:
49 bool zero_elapsed = false; // if true, the elapsed field of transaction and action traces is always set to 0 (for reproducibility)
50 };
51
53
54 void update_logger(const std::string& logger_name);
56
57 void on_startup(chainbase::database& db, uint32_t head_block_num);
58 void on_start_block(uint32_t block_num);
59 void on_accepted_block(const std::shared_ptr<block_state>& bsp);
60 void on_switch_forks(const block_id_type& old_head, const block_id_type& new_head);
61 void on_onerror(const signed_transaction& etrx);
62 void on_onblock(const signed_transaction& trx);
64 void on_end_transaction();
65 void on_applied_transaction(uint32_t block_num, const std::shared_ptr<transaction_trace>& trace);
67 void on_preactivate_feature(const protocol_feature& feature);
68 void on_activate_feature(const protocol_feature& feature);
69 void on_input_action();
70 void on_end_action();
72 void on_send_inline();
77 void on_fail_deferred();
78 void on_create_table(const table_id_object& tid);
79 void on_remove_table(const table_id_object& tid);
80 void on_db_store_i64(const table_id_object& tid, const key_value_object& kvo);
81 void on_db_update_i64(const table_id_object& tid, const key_value_object& kvo, account_name payer, const char* buffer, std::size_t buffer_size);
82 void on_db_remove_i64(const table_id_object& tid, const key_value_object& kvo);
89 // The trace is consumed by the next ram_event or ram_correction
90 void on_ram_trace(std::string&& event_id, const char* family, const char* operation, const char* legacy_tag);
91 void on_ram_event(account_name account, uint64_t new_usage, int64_t delta);
93 void on_modify_permission(const permission_object& old_permission, const permission_object& new_permission);
94 void on_remove_permission(const permission_object& permission);
95private:
96 uint32_t _action_id = 0;
97 ram_trace _ram_trace;
98 deep_mind_config _config;
99 fc::logger _logger;
100};
101
102}
const mie::Vuint & p
Definition bn.cpp:27
void on_cancel_deferred(operation_qualifier qual, const generated_transaction_object &gto)
void on_activate_feature(const protocol_feature &feature)
void on_modify_permission(const permission_object &old_permission, const permission_object &new_permission)
void on_newaccount_resource_limits(const resource_limits::resource_limits_object &limits, const resource_limits::resource_usage_object &usage)
void on_startup(chainbase::database &db, uint32_t head_block_num)
Definition deep_mind.cpp:48
void on_preactivate_feature(const protocol_feature &feature)
void on_create_deferred(operation_qualifier qual, const generated_transaction_object &gto, const packed_transaction &packed_trx)
void on_db_remove_i64(const table_id_object &tid, const key_value_object &kvo)
void on_update_resource_limits_state(const resource_limits::resource_limits_state_object &state)
void on_accepted_block(const std::shared_ptr< block_state > &bsp)
Definition deep_mind.cpp:74
void on_update_resource_limits_config(const resource_limits::resource_limits_config_object &config)
void update_config(deep_mind_config config)
Definition deep_mind.cpp:29
void on_onerror(const signed_transaction &etrx)
Definition deep_mind.cpp:92
void on_db_store_i64(const table_id_object &tid, const key_value_object &kvo)
void on_switch_forks(const block_id_type &old_head, const block_id_type &new_head)
Definition deep_mind.cpp:84
void on_remove_table(const table_id_object &tid)
void on_update_account_usage(const resource_limits::resource_usage_object &usage)
void on_start_block(uint32_t block_num)
Definition deep_mind.cpp:69
void on_send_deferred(operation_qualifier qual, const generated_transaction_object &gto)
void on_db_update_i64(const table_id_object &tid, const key_value_object &kvo, account_name payer, const char *buffer, std::size_t buffer_size)
void update_logger(const std::string &logger_name)
Definition deep_mind.cpp:34
void on_create_permission(const permission_object &p)
void on_add_ram_correction(const account_ram_correction_object &rco, uint64_t delta)
void on_set_account_limits(const resource_limits::resource_limits_object &limits)
void on_create_table(const table_id_object &tid)
void on_onblock(const signed_transaction &trx)
void on_remove_permission(const permission_object &permission)
void on_ram_event(account_name account, uint64_t new_usage, int64_t delta)
void on_ram_trace(std::string &&event_id, const char *family, const char *operation, const char *legacy_tag)
void on_init_resource_limits(const resource_limits::resource_limits_config_object &config, const resource_limits::resource_limits_state_object &state)
void on_applied_transaction(uint32_t block_num, const std::shared_ptr< transaction_trace > &trace)
The table_id_object class tracks the mapping of (scope, code, table) to an opaque identifier.
Definition name.hpp:106
const fc::string logger_name("net_plugin_impl")
signed __int64 int64_t
Definition stdint.h:135
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
const char * legacy_tag
Definition deep_mind.hpp:39
ram_trace(std::string &&event_id, const char *family, const char *operation, const char *legacy_tag)
Definition deep_mind.hpp:32