Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
708e5740
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
708e5740
编写于
9月 26, 2018
作者:
T
Todd Fleming
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
state_history_plugin
上级
a8784aa8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
129 addition
and
7 deletion
+129
-7
plugins/state_history_plugin/include/eosio/state_history_plugin/state_history_plugin.hpp
...clude/eosio/state_history_plugin/state_history_plugin.hpp
+2
-1
plugins/state_history_plugin/state_history_plugin.cpp
plugins/state_history_plugin/state_history_plugin.cpp
+127
-6
未找到文件。
plugins/state_history_plugin/include/eosio/state_history_plugin/state_history_plugin.hpp
浏览文件 @
708e5740
...
...
@@ -18,6 +18,7 @@ using std::shared_ptr;
typedef
shared_ptr
<
class
state_history_plugin_impl
>
impl_ptr
;
struct
table_delta
{
fc
::
unsigned_int
struct_version
=
0
;
std
::
string
name
{};
std
::
vector
<
std
::
pair
<
uint64_t
,
bytes
>>
rows
{};
std
::
vector
<
uint64_t
>
removed
{};
...
...
@@ -42,4 +43,4 @@ class state_history_plugin : public plugin<state_history_plugin> {
}
// namespace eosio
FC_REFLECT
(
eosio
::
table_delta
,
(
name
)(
rows
)(
removed
));
FC_REFLECT
(
eosio
::
table_delta
,
(
struct_version
)(
name
)(
rows
)(
removed
));
plugins/state_history_plugin/state_history_plugin.cpp
浏览文件 @
708e5740
...
...
@@ -3,7 +3,10 @@
#include <eosio/chain/controller.hpp>
#include <eosio/chain/generated_transaction_object.hpp>
#include <eosio/chain/global_property_object.hpp>
#include <eosio/chain/permission_link_object.hpp>
#include <eosio/chain/permission_object.hpp>
#include <eosio/chain/resource_limits.hpp>
#include <eosio/chain/resource_limits_private.hpp>
#include <eosio/chain/trace.hpp>
#include <eosio/chain/transaction_object.hpp>
#include <eosio/chain_plugin/chain_plugin.hpp>
...
...
@@ -311,6 +314,124 @@ static datastream<ST>& operator<<(datastream<ST>&
return
ds
;
}
template
<
typename
ST
>
static
datastream
<
ST
>&
operator
<<
(
datastream
<
ST
>&
ds
,
const
history_serial_wrapper
<
eosio
::
chain
::
permission_usage_object
>&
obj
)
{
ds
<<
fc
::
unsigned_int
(
0
);
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
id
.
_id
));
fc
::
raw
::
pack
(
ds
,
as_type
<
fc
::
time_point
>
(
obj
.
obj
.
last_used
));
return
ds
;
}
template
<
typename
ST
>
static
datastream
<
ST
>&
operator
<<
(
datastream
<
ST
>&
ds
,
const
history_serial_wrapper
<
eosio
::
chain
::
permission_link_object
>&
obj
)
{
ds
<<
fc
::
unsigned_int
(
0
);
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
id
.
_id
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
account
.
value
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
code
.
value
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
message_type
.
value
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
required_permission
.
value
));
return
ds
;
}
template
<
typename
ST
>
static
datastream
<
ST
>&
operator
<<
(
datastream
<
ST
>&
ds
,
const
history_serial_wrapper
<
eosio
::
chain
::
resource_limits
::
resource_limits_object
>&
obj
)
{
ds
<<
fc
::
unsigned_int
(
0
);
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
id
.
_id
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
owner
.
value
));
fc
::
raw
::
pack
(
ds
,
as_type
<
bool
>
(
obj
.
obj
.
pending
));
fc
::
raw
::
pack
(
ds
,
as_type
<
int64_t
>
(
obj
.
obj
.
net_weight
));
fc
::
raw
::
pack
(
ds
,
as_type
<
int64_t
>
(
obj
.
obj
.
cpu_weight
));
fc
::
raw
::
pack
(
ds
,
as_type
<
int64_t
>
(
obj
.
obj
.
ram_bytes
));
return
ds
;
}
template
<
typename
ST
>
static
datastream
<
ST
>&
operator
<<
(
datastream
<
ST
>&
ds
,
const
history_serial_wrapper
<
eosio
::
chain
::
resource_limits
::
usage_accumulator
>&
obj
)
{
ds
<<
fc
::
unsigned_int
(
0
);
fc
::
raw
::
pack
(
ds
,
as_type
<
uint32_t
>
(
obj
.
obj
.
last_ordinal
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
value_ex
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
consumed
));
return
ds
;
}
template
<
typename
ST
>
static
datastream
<
ST
>&
operator
<<
(
datastream
<
ST
>&
ds
,
const
history_serial_wrapper
<
eosio
::
chain
::
resource_limits
::
resource_usage_object
>&
obj
)
{
ds
<<
fc
::
unsigned_int
(
0
);
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
id
.
_id
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
owner
.
value
));
fc
::
raw
::
pack
(
ds
,
make_history_serial_wrapper
(
as_type
<
eosio
::
chain
::
resource_limits
::
usage_accumulator
>
(
obj
.
obj
.
net_usage
)));
fc
::
raw
::
pack
(
ds
,
make_history_serial_wrapper
(
as_type
<
eosio
::
chain
::
resource_limits
::
usage_accumulator
>
(
obj
.
obj
.
cpu_usage
)));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
ram_usage
));
return
ds
;
}
template
<
typename
ST
>
static
datastream
<
ST
>&
operator
<<
(
datastream
<
ST
>&
ds
,
const
history_serial_wrapper
<
eosio
::
chain
::
resource_limits
::
resource_limits_state_object
>&
obj
)
{
ds
<<
fc
::
unsigned_int
(
0
);
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
id
.
_id
));
fc
::
raw
::
pack
(
ds
,
make_history_serial_wrapper
(
as_type
<
eosio
::
chain
::
resource_limits
::
usage_accumulator
>
(
obj
.
obj
.
average_block_net_usage
)));
fc
::
raw
::
pack
(
ds
,
make_history_serial_wrapper
(
as_type
<
eosio
::
chain
::
resource_limits
::
usage_accumulator
>
(
obj
.
obj
.
average_block_cpu_usage
)));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
pending_net_usage
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
pending_cpu_usage
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
total_net_weight
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
total_cpu_weight
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
total_ram_bytes
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
virtual_net_limit
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
virtual_cpu_limit
));
return
ds
;
}
template
<
typename
ST
>
static
datastream
<
ST
>&
operator
<<
(
datastream
<
ST
>&
ds
,
const
history_serial_wrapper
<
eosio
::
chain
::
resource_limits
::
ratio
>&
obj
)
{
ds
<<
fc
::
unsigned_int
(
0
);
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
numerator
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
denominator
));
return
ds
;
}
template
<
typename
ST
>
static
datastream
<
ST
>&
operator
<<
(
datastream
<
ST
>&
ds
,
const
history_serial_wrapper
<
eosio
::
chain
::
resource_limits
::
elastic_limit_parameters
>&
obj
)
{
ds
<<
fc
::
unsigned_int
(
0
);
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
target
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
max
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint32_t
>
(
obj
.
obj
.
periods
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint32_t
>
(
obj
.
obj
.
max_multiplier
));
fc
::
raw
::
pack
(
ds
,
make_history_serial_wrapper
(
as_type
<
eosio
::
chain
::
resource_limits
::
ratio
>
(
obj
.
obj
.
contract_rate
)));
fc
::
raw
::
pack
(
ds
,
make_history_serial_wrapper
(
as_type
<
eosio
::
chain
::
resource_limits
::
ratio
>
(
obj
.
obj
.
expand_rate
)));
return
ds
;
}
template
<
typename
ST
>
static
datastream
<
ST
>&
operator
<<
(
datastream
<
ST
>&
ds
,
const
history_serial_wrapper
<
eosio
::
chain
::
resource_limits
::
resource_limits_config_object
>&
obj
)
{
ds
<<
fc
::
unsigned_int
(
0
);
fc
::
raw
::
pack
(
ds
,
as_type
<
uint64_t
>
(
obj
.
obj
.
id
.
_id
));
fc
::
raw
::
pack
(
ds
,
make_history_serial_wrapper
(
as_type
<
eosio
::
chain
::
resource_limits
::
elastic_limit_parameters
>
(
obj
.
obj
.
cpu_limit_parameters
)));
fc
::
raw
::
pack
(
ds
,
make_history_serial_wrapper
(
as_type
<
eosio
::
chain
::
resource_limits
::
elastic_limit_parameters
>
(
obj
.
obj
.
net_limit_parameters
)));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint32_t
>
(
obj
.
obj
.
account_cpu_usage_average_window
));
fc
::
raw
::
pack
(
ds
,
as_type
<
uint32_t
>
(
obj
.
obj
.
account_net_usage_average_window
));
return
ds
;
};
}
// namespace fc
namespace
eosio
{
...
...
@@ -357,13 +478,13 @@ static void for_each_table(chainbase::database& db, F f) {
f
(
"generated_transaction_multi_index"
,
db
.
get_index
<
generated_transaction_multi_index
>
());
f
(
"permission_index"
,
db
.
get_index
<
permission_index
>
());
//
f("permission_usage_index", db.get_index<permission_usage_index>());
//
f("permission_link_index", db.get_index<permission_link_index>());
f
(
"permission_usage_index"
,
db
.
get_index
<
permission_usage_index
>
());
f
(
"permission_link_index"
,
db
.
get_index
<
permission_link_index
>
());
// f("resource_limits_index", db.get_index<
resource_limits_index>());
// f("resource_usage_index", db.get_index<
resource_usage_index>());
// f("resource_limits_state_index", db.get_index<
resource_limits_state_index>());
// f("resource_limits_config_index", db.get_index<
resource_limits_config_index>());
f
(
"resource_limits_index"
,
db
.
get_index
<
resource_limits
::
resource_limits_index
>
());
f
(
"resource_usage_index"
,
db
.
get_index
<
resource_limits
::
resource_usage_index
>
());
f
(
"resource_limits_state_index"
,
db
.
get_index
<
resource_limits
::
resource_limits_state_index
>
());
f
(
"resource_limits_config_index"
,
db
.
get_index
<
resource_limits
::
resource_limits_config_index
>
());
}
class
state_history_plugin_impl
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录