Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
7e19d137
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,发现更多精彩内容 >>
提交
7e19d137
编写于
2月 01, 2018
作者:
K
Khaled Al-Hassanieh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added bta_index, reversed scope-code order
上级
895aac08
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
236 addition
and
220 deletion
+236
-220
contracts/eosiolib/db.h
contracts/eosiolib/db.h
+49
-49
contracts/eosiolib/db.hpp
contracts/eosiolib/db.hpp
+93
-93
contracts/eosiolib/table.hpp
contracts/eosiolib/table.hpp
+3
-3
libraries/chain/apply_context.cpp
libraries/chain/apply_context.cpp
+5
-5
libraries/chain/contracts/eosio_contract.cpp
libraries/chain/contracts/eosio_contract.cpp
+10
-10
libraries/chain/include/eosio/chain/apply_context.hpp
libraries/chain/include/eosio/chain/apply_context.hpp
+8
-8
libraries/chain/include/eosio/chain/contracts/contract_table_objects.hpp
.../include/eosio/chain/contracts/contract_table_objects.hpp
+34
-17
libraries/chain/wasm_interface.cpp
libraries/chain/wasm_interface.cpp
+27
-28
libraries/testing/tester.cpp
libraries/testing/tester.cpp
+1
-1
plugins/chain_plugin/chain_plugin.cpp
plugins/chain_plugin/chain_plugin.cpp
+1
-1
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
.../chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
+5
-5
未找到文件。
contracts/eosiolib/db.h
浏览文件 @
7e19d137
...
...
@@ -154,7 +154,7 @@ int32_t update_i64( account_name scope, table_name table, account_name bta, cons
*
* @return the number of bytes read or -1 if key was not found
*/
int32_t
load_i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
int32_t
load_i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -165,7 +165,7 @@ int32_t load_i64( account_name scope, account_name code, table_name table, void*
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
front_i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
int32_t
front_i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -176,7 +176,7 @@ int32_t front_i64( account_name scope, account_name code, table_name table, void
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
back_i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
int32_t
back_i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -187,7 +187,7 @@ int32_t back_i64( account_name scope, account_name code, table_name table, void*
*
* @return the number of bytes read or -1 if key was not found
*/
int32_t
next_i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
int32_t
next_i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -198,7 +198,7 @@ int32_t next_i64( account_name scope, account_name code, table_name table, void*
*
* @return the number of bytes read or -1 if key was not found
*/
int32_t
previous_i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
int32_t
previous_i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -209,7 +209,7 @@ int32_t previous_i64( account_name scope, account_name code, table_name table, v
*
* @return the number of bytes read or -1 if key was not found
*/
int32_t
lower_bound_i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
int32_t
lower_bound_i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -220,7 +220,7 @@ int32_t lower_bound_i64( account_name scope, account_name code, table_name table
*
* @return the number of bytes read or -1 if key was not found
*/
int32_t
upper_bound_i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
int32_t
upper_bound_i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
datalen
);
/**
* @param scope - the account socpe that will be read, must exist in the transaction scopes list
...
...
@@ -298,7 +298,7 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
*
* @return the number of bytes read or -1 if key was not found
*/
int32_t
load_str
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
int32_t
load_str
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -310,7 +310,7 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
* @param valuelen - maximum length of the record value to read
* @return the number of bytes read or -1 if key was not found
*/
int32_t
front_str
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
char
*
value
,
uint32_t
valuelen
);
int32_t
front_str
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
char
*
value
,
uint32_t
valuelen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -322,7 +322,7 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
* @param valuelen - maximum length of the record value to read
* @return the number of bytes read or -1 if key was not found
*/
int32_t
back_str
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
char
*
value
,
uint32_t
valuelen
);
int32_t
back_str
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
char
*
value
,
uint32_t
valuelen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -334,7 +334,7 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
* @param valuelen - maximum length of the record value to read
* @return the number of bytes read or -1 if key was not found
*/
int32_t
next_str
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
int32_t
next_str
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -346,7 +346,7 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
* @param valuelen - maximum length of the record value to read
* @return the number of bytes read or -1 if key was not found
*/
int32_t
previous_str
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
int32_t
previous_str
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -358,7 +358,7 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
* @param valuelen - maximum length of the record value to read
* @return the number of bytes read or -1 if key was not found
*/
int32_t
lower_bound_str
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
int32_t
lower_bound_str
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -370,7 +370,7 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
* @param valuelen - maximum length of the record value to read
* @return the number of bytes read or -1 if key was not found
*/
int32_t
upper_bound_str
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
int32_t
upper_bound_str
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
char
*
key
,
uint32_t
keylen
,
char
*
value
,
uint32_t
valuelen
);
/**
* @param key - location of the record key
...
...
@@ -488,7 +488,7 @@ int32_t update_str( account_name scope, table_name table, account_name bta, char
* @throw if called with an invalid precondition execution will be aborted
*
*/
int32_t
load_primary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
load_primary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -499,7 +499,7 @@ int32_t load_primary_i128i128( account_name scope, account_name code, table_name
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
front_primary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
front_primary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -510,7 +510,7 @@ int32_t front_primary_i128i128( account_name scope, account_name code, table_nam
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
back_primary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
back_primary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -521,7 +521,7 @@ int32_t back_primary_i128i128( account_name scope, account_name code, table_name
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
next_primary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
next_primary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -532,7 +532,7 @@ int32_t next_primary_i128i128( account_name scope, account_name code, table_name
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
previous_primary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
previous_primary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -543,7 +543,7 @@ int32_t previous_primary_i128i128( account_name scope, account_name code, table_
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
upper_bound_primary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
upper_bound_primary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -554,7 +554,7 @@ int32_t upper_bound_primary_i128i128( account_name scope, account_name code, tab
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
lower_bound_primary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
lower_bound_primary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -575,7 +575,7 @@ int32_t lower_bound_primary_i128i128( account_name scope, account_name code, tab
* @throw if called with an invalid precondition execution will be aborted
*
*/
int32_t
load_secondary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
load_secondary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -586,7 +586,7 @@ int32_t load_secondary_i128i128( account_name scope, account_name code, table_na
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
front_secondary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
front_secondary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -597,7 +597,7 @@ int32_t front_secondary_i128i128( account_name scope, account_name code, table_n
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
back_secondary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
back_secondary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -608,7 +608,7 @@ int32_t back_secondary_i128i128( account_name scope, account_name code, table_na
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
next_secondary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
next_secondary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -619,7 +619,7 @@ int32_t next_secondary_i128i128( account_name scope, account_name code, table_na
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
previous_secondary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
previous_secondary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -630,7 +630,7 @@ int32_t previous_secondary_i128i128( account_name scope, account_name code, tabl
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
upper_bound_secondary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
upper_bound_secondary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -641,7 +641,7 @@ int32_t upper_bound_secondary_i128i128( account_name scope, account_name code, t
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
lower_bound_secondary_i128i128
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
lower_bound_secondary_i128i128
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
...
...
@@ -762,7 +762,7 @@ int32_t update_i128i128( account_name scope, table_name table, account_name bta,
* @throw if called with an invalid precondition execution will be aborted
*
*/
int32_t
load_primary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
load_primary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -773,7 +773,7 @@ int32_t load_primary_i64i64i64( account_name scope, account_name code, table_nam
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
front_primary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
front_primary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -784,7 +784,7 @@ int32_t front_primary_i64i64i64( account_name scope, account_name code, table_na
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
back_primary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
back_primary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -795,7 +795,7 @@ int32_t back_primary_i64i64i64( account_name scope, account_name code, table_nam
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
next_primary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
next_primary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -806,7 +806,7 @@ int32_t next_primary_i64i64i64( account_name scope, account_name code, table_nam
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
previous_primary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
previous_primary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -817,7 +817,7 @@ int32_t previous_primary_i64i64i64( account_name scope, account_name code, table
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
upper_bound_primary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
upper_bound_primary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -828,7 +828,7 @@ int32_t upper_bound_primary_i64i64i64( account_name scope, account_name code, ta
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
lower_bound_primary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
lower_bound_primary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -848,7 +848,7 @@ int32_t lower_bound_primary_i64i64i64( account_name scope, account_name code, ta
* @throw if called with an invalid precondition execution will be aborted
*
*/
int32_t
load_secondary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
load_secondary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -859,7 +859,7 @@ int32_t load_secondary_i64i64i64( account_name scope, account_name code, table_n
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
front_secondary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
front_secondary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -870,7 +870,7 @@ int32_t front_secondary_i64i64i64( account_name scope, account_name code, table_
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
back_secondary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
back_secondary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -881,7 +881,7 @@ int32_t back_secondary_i64i64i64( account_name scope, account_name code, table_n
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
next_secondary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
next_secondary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -892,7 +892,7 @@ int32_t next_secondary_i64i64i64( account_name scope, account_name code, table_n
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
previous_secondary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
previous_secondary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -903,7 +903,7 @@ int32_t previous_secondary_i64i64i64( account_name scope, account_name code, tab
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
upper_bound_secondary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
upper_bound_secondary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -914,7 +914,7 @@ int32_t upper_bound_secondary_i64i64i64( account_name scope, account_name code,
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
lower_bound_secondary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
lower_bound_secondary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -934,7 +934,7 @@ int32_t lower_bound_secondary_i64i64i64( account_name scope, account_name code,
* @throw if called with an invalid precondition execution will be aborted
*
*/
int32_t
load_tertiary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
load_tertiary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -945,7 +945,7 @@ int32_t load_tertiary_i64i64i64( account_name scope, account_name code, table_na
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
front_tertiary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
front_tertiary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -956,7 +956,7 @@ int32_t front_tertiary_i64i64i64( account_name scope, account_name code, table_n
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
back_tertiary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
back_tertiary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -967,7 +967,7 @@ int32_t back_tertiary_i64i64i64( account_name scope, account_name code, table_na
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
next_tertiary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
next_tertiary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -978,7 +978,7 @@ int32_t next_tertiary_i64i64i64( account_name scope, account_name code, table_na
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
previous_tertiary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
previous_tertiary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -989,7 +989,7 @@ int32_t previous_tertiary_i64i64i64( account_name scope, account_name code, tabl
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
upper_bound_tertiary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
upper_bound_tertiary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
@@ -1000,7 +1000,7 @@ int32_t upper_bound_tertiary_i64i64i64( account_name scope, account_name code, t
*
* @return the number of bytes read or -1 if no record found
*/
int32_t
lower_bound_tertiary_i64i64i64
(
account_name
scope
,
account_name
cod
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
int32_t
lower_bound_tertiary_i64i64i64
(
account_name
code
,
account_name
scop
e
,
table_name
table
,
void
*
data
,
uint32_t
len
);
/**
* @param scope - the account scope that will be read, must exist in the transaction scopes list
...
...
contracts/eosiolib/db.hpp
浏览文件 @
7e19d137
...
...
@@ -27,60 +27,60 @@ struct table_impl{};
template
<
>
struct
table_impl
<
sizeof
(
uint128_t
),
sizeof
(
uint128_t
)
>
{
static
int32_t
front_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
front_primary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
front_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
front_primary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
back_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
back_primary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
back_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
back_primary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
load_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
load_primary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
load_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
load_primary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
next_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
next_primary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
next_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
next_primary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
previous_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
previous_primary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
previous_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
previous_primary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
upper_bound_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
upper_bound_primary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
upper_bound_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
upper_bound_primary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
lower_bound_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
lower_bound_primary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
lower_bound_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
lower_bound_primary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
front_secondary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
front_secondary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
front_secondary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
front_secondary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
back_secondary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
back_secondary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
back_secondary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
back_secondary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
load_secondary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
load_secondary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
load_secondary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
load_secondary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
next_secondary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
next_secondary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
next_secondary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
next_secondary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
previous_secondary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
previous_secondary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
previous_secondary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
previous_secondary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
upper_bound_secondary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
upper_bound_secondary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
upper_bound_secondary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
upper_bound_secondary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
lower_bound_secondary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
lower_bound_secondary_i128i128
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
lower_bound_secondary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
lower_bound_secondary_i128i128
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
remove
(
uint64_t
scope
,
uint64_t
table_n
,
account_name
bta
,
const
void
*
data
)
{
...
...
@@ -175,7 +175,7 @@ struct table_impl<sizeof(uint128_t),sizeof(uint128_t)> {
* @ingroup databaseCpp
* @{
*/
template
<
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
uint64_t
bta
,
typename
Record
,
typename
PrimaryType
,
typename
SecondaryType
=
void
>
template
<
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
uint64_t
bta
,
typename
Record
,
typename
PrimaryType
,
typename
SecondaryType
=
void
>
struct
table
{
private:
typedef
table_impl
<
sizeof
(
PrimaryType
),
sizeof
(
SecondaryType
)
>
impl
;
...
...
@@ -196,7 +196,7 @@ struct table {
* @return true if successful read.
*/
static
bool
front
(
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
front_primary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
front_primary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -206,7 +206,7 @@ struct table {
* @return true if successful read.
*/
static
bool
back
(
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
back_primary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
back_primary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -216,7 +216,7 @@ struct table {
* @return true if successful read.
*/
static
bool
next
(
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
next_primary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
next_primary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -226,7 +226,7 @@ struct table {
* @return true if successful read.
*/
static
bool
previous
(
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
previous_primary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
previous_primary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -238,7 +238,7 @@ struct table {
*/
static
bool
get
(
const
PrimaryType
&
p
,
Record
&
r
,
uint64_t
s
=
scope
)
{
*
reinterpret_cast
<
PrimaryType
*>
(
&
r
)
=
p
;
return
impl
::
load_primary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
load_primary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -249,7 +249,7 @@ struct table {
* @return true if successful read.
*/
static
bool
lower_bound
(
const
PrimaryType
&
p
,
Record
&
r
)
{
return
impl
::
lower_bound_primary
(
scope
,
cod
e
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
lower_bound_primary
(
code
,
scop
e
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -260,7 +260,7 @@ struct table {
* @return true if successful read.
*/
static
bool
upper_bound
(
const
PrimaryType
&
p
,
Record
&
r
)
{
return
impl
::
upper_bound_primary
(
scope
,
cod
e
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
upper_bound_primary
(
code
,
scop
e
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -286,7 +286,7 @@ struct table {
* @return true if successful read.
*/
static
bool
front
(
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
front_secondary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
front_secondary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -296,7 +296,7 @@ struct table {
* @return true if successful read.
*/
static
bool
back
(
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
back_secondary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
back_secondary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -306,7 +306,7 @@ struct table {
* @return true if successful read.
*/
static
bool
next
(
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
next_secondary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
next_secondary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -316,7 +316,7 @@ struct table {
* @return true if successful read.
*/
static
bool
previous
(
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
previous_secondary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
previous_secondary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -327,7 +327,7 @@ struct table {
* @return true if successful read.
*/
static
bool
get
(
const
SecondaryType
&
p
,
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
load_secondary
(
s
,
code
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
load_secondary
(
code
,
s
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -339,7 +339,7 @@ struct table {
*/
static
bool
lower_bound
(
const
SecondaryType
&
p
,
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
lower_bound_secondary
(
s
,
code
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
lower_bound_secondary
(
code
,
s
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -350,7 +350,7 @@ struct table {
* @return true if successful read.
*/
static
bool
upper_bound
(
const
SecondaryType
&
p
,
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
upper_bound_secondary
(
s
,
code
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
upper_bound_secondary
(
code
,
s
,
table_n
,
&
p
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -376,7 +376,7 @@ struct table {
static
bool
get
(
const
PrimaryType
&
p
,
Record
&
r
,
uint64_t
s
=
scope
)
{
*
reinterpret_cast
<
PrimaryType
*>
(
&
r
)
=
p
;
return
impl
::
load_primary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
load_primary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -422,32 +422,32 @@ struct table {
template
<
>
struct
table_impl
<
sizeof
(
uint64_t
),
0
>
{
static
int32_t
front_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
front_i64
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
front_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
front_i64
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
back_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
back_i64
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
back_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
back_i64
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
load_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
load_i64
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
load_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
load_i64
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
next_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
next_i64
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
next_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
next_i64
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
previous_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
previous_i64
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
previous_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
previous_i64
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
lower_bound_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
lower_bound_i64
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
lower_bound_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
lower_bound_i64
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
upper_bound_primary
(
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
upper_bound_i64
(
scope
,
code
,
table_n
,
data
,
len
);
static
int32_t
upper_bound_primary
(
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
void
*
data
,
uint32_t
len
)
{
return
upper_bound_i64
(
code
,
scope
,
table_n
,
data
,
len
);
}
static
int32_t
remove
(
uint64_t
scope
,
uint64_t
table_n
,
account_name
bta
,
const
void
*
data
)
{
...
...
@@ -531,8 +531,8 @@ struct table_impl<sizeof(uint64_t),0> {
* @ingroup databaseCpp
* @{
*/
template
<
uint64_t
scope
,
uint64_t
cod
e
,
uint64_t
table_n
,
uint64_t
bta
,
typename
Record
,
typename
PrimaryType
>
struct
table
<
scope
,
cod
e
,
table_n
,
bta
,
Record
,
PrimaryType
,
void
>
{
template
<
uint64_t
code
,
uint64_t
scop
e
,
uint64_t
table_n
,
uint64_t
bta
,
typename
Record
,
typename
PrimaryType
>
struct
table
<
code
,
scop
e
,
table_n
,
bta
,
Record
,
PrimaryType
,
void
>
{
private:
typedef
table_impl
<
sizeof
(
PrimaryType
),
0
>
impl
;
static_assert
(
sizeof
(
PrimaryType
)
<=
sizeof
(
Record
),
"invalid template parameters"
);
...
...
@@ -549,7 +549,7 @@ struct table<scope,code,table_n,bta,Record,PrimaryType,void> {
* @return true if successfully retrieved the front of the table.
*/
static
bool
front
(
Record
&
r
)
{
return
impl
::
front_primary
(
scope
,
cod
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
front_primary
(
code
,
scop
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -558,7 +558,7 @@ struct table<scope,code,table_n,bta,Record,PrimaryType,void> {
* @return true if successfully retrieved the back of the table.
*/
static
bool
back
(
Record
&
r
)
{
return
impl
::
back_primary
(
scope
,
cod
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
back_primary
(
code
,
scop
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -567,7 +567,7 @@ struct table<scope,code,table_n,bta,Record,PrimaryType,void> {
* @return true if successfully retrieved the next record.
*/
static
bool
next
(
Record
&
r
)
{
return
impl
::
next_primary
(
scope
,
cod
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
next_primary
(
code
,
scop
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -576,7 +576,7 @@ struct table<scope,code,table_n,bta,Record,PrimaryType,void> {
* @return true if successfully retrieved the previous record.
*/
static
bool
previous
(
Record
&
r
)
{
return
impl
::
previous_primary
(
scope
,
cod
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
previous_primary
(
code
,
scop
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -587,7 +587,7 @@ struct table<scope,code,table_n,bta,Record,PrimaryType,void> {
*/
static
bool
get
(
const
PrimaryType
&
p
,
Record
&
r
,
uint64_t
s
=
scope
)
{
*
reinterpret_cast
<
PrimaryType
*>
(
&
r
)
=
p
;
return
impl
::
load_primary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
load_primary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -597,7 +597,7 @@ struct table<scope,code,table_n,bta,Record,PrimaryType,void> {
*/
static
bool
lower_bound
(
const
PrimaryType
&
p
,
Record
&
r
)
{
*
reinterpret_cast
<
PrimaryType
*>
(
&
r
)
=
p
;
return
impl
::
lower_bound_primary
(
scope
,
cod
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
lower_bound_primary
(
code
,
scop
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -607,7 +607,7 @@ struct table<scope,code,table_n,bta,Record,PrimaryType,void> {
*/
static
bool
upper_bound
(
const
PrimaryType
&
p
,
Record
&
r
)
{
*
reinterpret_cast
<
PrimaryType
*>
(
&
r
)
=
p
;
return
impl
::
upper_bound_primary
(
scope
,
cod
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
upper_bound_primary
(
code
,
scop
e
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -646,7 +646,7 @@ struct table<scope,code,table_n,bta,Record,PrimaryType,void> {
*/
static
bool
get
(
const
PrimaryType
&
p
,
Record
&
r
,
uint64_t
s
=
scope
)
{
*
reinterpret_cast
<
PrimaryType
*>
(
&
r
)
=
p
;
return
impl
::
load_primary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
load_primary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -657,7 +657,7 @@ struct table<scope,code,table_n,bta,Record,PrimaryType,void> {
* @return true if get succeeds.
*/
static
bool
get
(
Record
&
r
,
uint64_t
s
=
scope
)
{
return
impl
::
load_primary
(
s
,
code
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
return
impl
::
load_primary
(
code
,
s
,
table_n
,
&
r
,
sizeof
(
Record
)
)
==
sizeof
(
Record
);
}
/**
...
...
@@ -705,32 +705,32 @@ struct table_impl_obj<char*> {
return
update_str
(
scope
,
table_n
,
bta
,
key
,
keylen
,
data
,
datalen
);
}
static
int32_t
front
(
account_name
scope
,
account_name
cod
e
,
table_name
table_n
,
char
*
data
,
uint32_t
len
)
{
return
front_str
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
front
(
account_name
code
,
account_name
scop
e
,
table_name
table_n
,
char
*
data
,
uint32_t
len
)
{
return
front_str
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
back
(
account_name
scope
,
account_name
cod
e
,
table_name
table_n
,
char
*
data
,
uint32_t
len
)
{
return
back_str
(
scope
,
cod
e
,
table_n
,
data
,
len
);
static
int32_t
back
(
account_name
code
,
account_name
scop
e
,
table_name
table_n
,
char
*
data
,
uint32_t
len
)
{
return
back_str
(
code
,
scop
e
,
table_n
,
data
,
len
);
}
static
int32_t
load
(
account_name
scope
,
account_name
cod
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
load_str
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
static
int32_t
load
(
account_name
code
,
account_name
scop
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
load_str
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
}
static
int32_t
next
(
account_name
scope
,
account_name
cod
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
next_str
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
static
int32_t
next
(
account_name
code
,
account_name
scop
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
next_str
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
}
static
int32_t
previous
(
account_name
scope
,
account_name
cod
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
previous_str
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
static
int32_t
previous
(
account_name
code
,
account_name
scop
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
previous_str
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
}
static
int32_t
lower_bound
(
account_name
scope
,
account_name
cod
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
lower_bound_str
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
static
int32_t
lower_bound
(
account_name
code
,
account_name
scop
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
lower_bound_str
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
}
static
int32_t
upper_bound
(
account_name
scope
,
account_name
cod
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
upper_bound_str
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
static
int32_t
upper_bound
(
account_name
code
,
account_name
scop
e
,
table_name
table_n
,
char
*
key
,
uint32_t
keylen
,
char
*
data
,
uint32_t
datalen
)
{
return
upper_bound_str
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
data
,
datalen
);
}
static
int32_t
remove
(
account_name
scope
,
table_name
table_n
,
account_name
bta
,
char
*
key
,
uint32_t
keylen
)
{
...
...
@@ -751,7 +751,7 @@ struct table_impl_obj<char*> {
* @{
*/
template
<
account_name
scope
,
account_name
cod
e
,
table_name
table_n
,
account_name
bta
,
typename
PrimaryType
>
template
<
account_name
code
,
account_name
scop
e
,
table_name
table_n
,
account_name
bta
,
typename
PrimaryType
>
struct
var_table
{
private:
typedef
table_impl_obj
<
PrimaryType
>
impl
;
...
...
@@ -795,7 +795,7 @@ struct var_table {
* @return the number of bytes read or -1 if key was not found
*/
int32_t
front
(
char
*
record
,
uint32_t
len
)
{
return
impl
::
front
(
scope
,
cod
e
,
table_n
,
record
,
len
);
return
impl
::
front
(
code
,
scop
e
,
table_n
,
record
,
len
);
}
/**
...
...
@@ -808,7 +808,7 @@ struct var_table {
* @return the number of bytes read or -1 if key was not found
*/
int32_t
back
(
char
*
record
,
uint32_t
len
)
{
return
impl
::
back
(
scope
,
cod
e
,
table_n
,
record
,
len
);
return
impl
::
back
(
code
,
scop
e
,
table_n
,
record
,
len
);
}
/**
...
...
@@ -821,7 +821,7 @@ struct var_table {
* @return the number of bytes read or -1 if key was not found
*/
int32_t
load
(
primary
key
,
uint32_t
keylen
,
char
*
record
,
uint32_t
len
)
{
return
impl
::
load
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
record
,
len
);
return
impl
::
load
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
record
,
len
);
}
/**
...
...
@@ -834,7 +834,7 @@ struct var_table {
* @return the number of bytes read or -1 if key was not found
*/
int32_t
next
(
primary
key
,
uint32_t
keylen
,
char
*
record
,
uint32_t
len
)
{
return
impl
::
next
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
record
,
len
);
return
impl
::
next
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
record
,
len
);
}
/**
...
...
@@ -847,7 +847,7 @@ struct var_table {
* @return the number of bytes read or -1 if key was not found
*/
int32_t
previous
(
primary
key
,
uint32_t
keylen
,
char
*
record
,
uint32_t
len
)
{
return
impl
::
previous
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
record
,
len
);
return
impl
::
previous
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
record
,
len
);
}
/**
...
...
@@ -860,7 +860,7 @@ struct var_table {
* @return the number of bytes read or -1 if key was not found
*/
int32_t
lower_bound
(
primary
key
,
uint32_t
keylen
,
char
*
record
,
uint32_t
len
)
{
return
impl
::
lower_bound
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
record
,
len
);
return
impl
::
lower_bound
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
record
,
len
);
}
/**
...
...
@@ -873,7 +873,7 @@ struct var_table {
* @return the number of bytes read or -1 if key was not found
*/
int32_t
upper_bound
(
primary
key
,
uint32_t
keylen
,
char
*
record
,
uint32_t
len
)
{
return
impl
::
upper_bound
(
scope
,
cod
e
,
table_n
,
key
,
keylen
,
record
,
len
);
return
impl
::
upper_bound
(
code
,
scop
e
,
table_n
,
key
,
keylen
,
record
,
len
);
}
/**
...
...
@@ -895,7 +895,7 @@ struct var_table {
}
// namespace eosio
#define TABLE2(NAME,
SCOPE, COD
E, TABLE, TYPE, PRIMARY_NAME, PRIMARY_TYPE, SECONDARY_NAME, SECONDARY_TYPE) \
using NAME = eosio::table<N(
SCOPE),N(COD
E),N(TABLE),TYPE,PRIMARY_TYPE,SECONDARY_TYPE>; \
#define TABLE2(NAME,
CODE, SCOP
E, TABLE, TYPE, PRIMARY_NAME, PRIMARY_TYPE, SECONDARY_NAME, SECONDARY_TYPE) \
using NAME = eosio::table<N(
CODE),N(SCOP
E),N(TABLE),TYPE,PRIMARY_TYPE,SECONDARY_TYPE>; \
typedef NAME::primary_index PRIMARY_NAME; \
typedef NAME::secondary_index SECONDARY_NAME;
contracts/eosiolib/table.hpp
浏览文件 @
7e19d137
...
...
@@ -12,14 +12,14 @@ namespace eosio {
{
public:
static
bool
exists
(
uint64_t
key
,
scope_name
scope
=
DefaultScope
)
{
auto
read
=
load_i64
(
scope
,
DefaultS
cope
,
TableName
,
(
char
*
)
&
key
,
sizeof
(
key
)
);
auto
read
=
load_i64
(
DefaultScope
,
s
cope
,
TableName
,
(
char
*
)
&
key
,
sizeof
(
key
)
);
return
read
>
0
;
}
static
T
get
(
uint64_t
key
,
scope_name
scope
=
DefaultScope
)
{
char
temp
[
1024
];
*
reinterpret_cast
<
uint64_t
*>
(
temp
)
=
key
;
auto
read
=
load_i64
(
scope
,
DefaultS
cope
,
TableName
,
temp
,
sizeof
(
temp
)
);
auto
read
=
load_i64
(
DefaultScope
,
s
cope
,
TableName
,
temp
,
sizeof
(
temp
)
);
assert
(
read
>
0
,
"key does not exist"
);
datastream
<
const
char
*>
ds
(
temp
,
read
);
...
...
@@ -32,7 +32,7 @@ namespace eosio {
char
temp
[
1024
];
*
reinterpret_cast
<
uint64_t
*>
(
temp
)
=
key
;
auto
read
=
load_i64
(
scope
,
DefaultS
cope
,
TableName
,
temp
,
sizeof
(
temp
)
);
auto
read
=
load_i64
(
DefaultScope
,
s
cope
,
TableName
,
temp
,
sizeof
(
temp
)
);
if
(
read
<
0
)
{
set
(
def
,
scope
);
return
def
;
...
...
libraries/chain/apply_context.cpp
浏览文件 @
7e19d137
...
...
@@ -204,22 +204,22 @@ void apply_context::cancel_deferred( uint32_t sender_id ) {
results
.
canceled_deferred
.
emplace_back
(
receiver
,
sender_id
);
}
const
contracts
::
table_id_object
*
apply_context
::
find_table
(
name
scope
,
name
cod
e
,
name
table
)
{
const
contracts
::
table_id_object
*
apply_context
::
find_table
(
name
code
,
name
scop
e
,
name
table
)
{
require_read_lock
(
code
,
scope
);
return
db
.
find
<
table_id_object
,
contracts
::
by_
scope_code_table
>
(
boost
::
make_tuple
(
scope
,
cod
e
,
table
));
return
db
.
find
<
table_id_object
,
contracts
::
by_
code_scope_table
>
(
boost
::
make_tuple
(
code
,
scop
e
,
table
));
}
const
contracts
::
table_id_object
&
apply_context
::
find_or_create_table
(
name
scope
,
name
cod
e
,
name
table
)
{
const
contracts
::
table_id_object
&
apply_context
::
find_or_create_table
(
name
code
,
name
scop
e
,
name
table
)
{
require_read_lock
(
code
,
scope
);
const
auto
*
existing_tid
=
db
.
find
<
contracts
::
table_id_object
,
contracts
::
by_
scope_code_table
>
(
boost
::
make_tuple
(
scope
,
cod
e
,
table
));
const
auto
*
existing_tid
=
db
.
find
<
contracts
::
table_id_object
,
contracts
::
by_
code_scope_table
>
(
boost
::
make_tuple
(
code
,
scop
e
,
table
));
if
(
existing_tid
!=
nullptr
)
{
return
*
existing_tid
;
}
require_write_lock
(
scope
);
return
mutable_db
.
create
<
contracts
::
table_id_object
>
([
&
](
contracts
::
table_id_object
&
t_id
){
t_id
.
scope
=
scope
;
t_id
.
code
=
code
;
t_id
.
scope
=
scope
;
t_id
.
table
=
table
;
});
}
...
...
libraries/chain/contracts/eosio_contract.cpp
浏览文件 @
7e19d137
...
...
@@ -42,18 +42,18 @@ void intialize_eosio_tokens(chainbase::database& db, const account_name& system_
}
static
void
modify_eosio_balance
(
apply_context
&
context
,
const
account_name
&
account
,
share_type
amt
)
{
const
auto
&
t_id
=
context
.
find_or_create_table
(
account
,
config
::
system_account_name
,
N
(
currency
));
const
auto
&
t_id
=
context
.
find_or_create_table
(
config
::
system_account_name
,
account
,
N
(
currency
));
uint64_t
key
=
N
(
account
);
share_type
balance
=
0
;
context
.
front_record
<
key_value_index
,
by_scope_primary
>
(
t_id
,
&
key
,
(
char
*
)
&
balance
,
sizeof
(
balance
));
balance
+=
amt
;
context
.
store_record
<
key_value_object
>
(
t_id
,
&
key
,
(
const
char
*
)
&
balance
,
sizeof
(
balance
));
context
.
store_record
<
key_value_object
>
(
t_id
,
config
::
system_account_name
,
&
key
,
(
const
char
*
)
&
balance
,
sizeof
(
balance
));
}
share_type
get_eosio_balance
(
const
chainbase
::
database
&
db
,
const
account_name
&
account
)
{
const
auto
*
t_id
=
db
.
find
<
table_id_object
,
by_
scope_code_table
>
(
boost
::
make_tuple
(
account
,
config
::
system_account_name
,
N
(
currency
)));
const
auto
*
t_id
=
db
.
find
<
table_id_object
,
by_
code_scope_table
>
(
boost
::
make_tuple
(
config
::
system_account_name
,
account
,
N
(
currency
)));
if
(
!
t_id
)
{
return
share_type
(
0
);
}
...
...
@@ -568,7 +568,7 @@ static const abi_serializer& get_abi_serializer() {
}
static
optional
<
variant
>
get_pending_recovery
(
apply_context
&
context
,
account_name
account
)
{
const
auto
*
t_id
=
context
.
find_table
(
account
,
config
::
system_account_name
,
N
(
recovery
));
const
auto
*
t_id
=
context
.
find_table
(
config
::
system_account_name
,
account
,
N
(
recovery
));
if
(
t_id
)
{
uint64_t
key
=
account
;
int32_t
record_size
=
context
.
front_record
<
key_value_index
,
by_scope_primary
>
(
*
t_id
,
&
key
,
nullptr
,
0
);
...
...
@@ -589,13 +589,13 @@ static optional<variant> get_pending_recovery(apply_context& context, account_na
static
uint32_t
get_next_sender_id
(
apply_context
&
context
)
{
context
.
require_write_lock
(
config
::
eosio_auth_scope
);
const
auto
&
t_id
=
context
.
find_or_create_table
(
config
::
eosio_auth_scope
,
config
::
system_account_nam
e
,
N
(
deferred
.
seq
));
const
auto
&
t_id
=
context
.
find_or_create_table
(
config
::
system_account_name
,
config
::
eosio_auth_scop
e
,
N
(
deferred
.
seq
));
uint64_t
key
=
N
(
config
::
eosio_auth_scope
);
uint32_t
next_serial
=
0
;
context
.
front_record
<
key_value_index
,
by_scope_primary
>
(
t_id
,
&
key
,
(
char
*
)
&
next_serial
,
sizeof
(
uint32_t
));
uint32_t
result
=
next_serial
++
;
context
.
store_record
<
key_value_object
>
(
t_id
,
&
key
,
(
char
*
)
&
next_serial
,
sizeof
(
uint32_t
));
context
.
store_record
<
key_value_object
>
(
t_id
,
config
::
system_account_name
,
&
key
,
(
char
*
)
&
next_serial
,
sizeof
(
uint32_t
));
return
result
;
}
...
...
@@ -682,16 +682,16 @@ void apply_eosio_postrecovery(apply_context& context) {
context
.
execute_deferred
(
std
::
move
(
dtrx
));
const
auto
&
t_id
=
context
.
find_or_create_table
(
account
,
config
::
system_account_name
,
N
(
recovery
));
const
auto
&
t_id
=
context
.
find_or_create_table
(
config
::
system_account_name
,
account
,
N
(
recovery
));
auto
data
=
get_abi_serializer
().
variant_to_binary
(
"pending_recovery"
,
record_data
);
context
.
store_record
<
key_value_object
>
(
t_id
,
&
account
.
value
,
data
.
data
()
+
sizeof
(
uint64_t
),
data
.
size
()
-
sizeof
(
uint64_t
));
context
.
store_record
<
key_value_object
>
(
t_id
,
0
,
&
account
.
value
,
data
.
data
()
+
sizeof
(
uint64_t
),
data
.
size
()
-
sizeof
(
uint64_t
));
context
.
console_append_formatted
(
"Recovery Started for account ${account} : ${memo}
\n
"
,
mutable_variant_object
()(
"account"
,
account
)(
"memo"
,
recover_act
.
memo
));
}
static
void
remove_pending_recovery
(
apply_context
&
context
,
const
account_name
&
account
)
{
const
auto
&
t_id
=
context
.
find_or_create_table
(
account
,
config
::
system_account_name
,
N
(
recovery
));
context
.
remove_record
<
key_value_object
>
(
t_id
,
&
account
.
value
);
const
auto
&
t_id
=
context
.
find_or_create_table
(
config
::
system_account_name
,
account
,
N
(
recovery
));
context
.
remove_record
<
key_value_object
>
(
t_id
,
config
::
system_account_name
,
&
account
.
value
);
}
void
apply_eosio_passrecovery
(
apply_context
&
context
)
{
...
...
libraries/chain/include/eosio/chain/apply_context.hpp
浏览文件 @
7e19d137
...
...
@@ -32,17 +32,17 @@ class apply_context {
void
cancel_deferred
(
uint32_t
sender_id
);
using
table_id_object
=
contracts
::
table_id_object
;
const
table_id_object
*
find_table
(
name
scope
,
name
cod
e
,
name
table
);
const
table_id_object
&
find_or_create_table
(
name
scope
,
name
cod
e
,
name
table
);
const
table_id_object
*
find_table
(
name
code
,
name
scop
e
,
name
table
);
const
table_id_object
&
find_or_create_table
(
name
code
,
name
scop
e
,
name
table
);
template
<
typename
ObjectType
>
int32_t
store_record
(
const
table_id_object
&
t_id
,
const
typename
ObjectType
::
key_type
*
keys
,
const
char
*
value
,
size_t
valuelen
);
int32_t
store_record
(
const
table_id_object
&
t_id
,
const
account_name
&
bta
,
const
typename
ObjectType
::
key_type
*
keys
,
const
char
*
value
,
size_t
valuelen
);
template
<
typename
ObjectType
>
int32_t
update_record
(
const
table_id_object
&
t_id
,
const
typename
ObjectType
::
key_type
*
keys
,
const
char
*
value
,
size_t
valuelen
);
int32_t
update_record
(
const
table_id_object
&
t_id
,
const
account_name
&
bta
,
const
typename
ObjectType
::
key_type
*
keys
,
const
char
*
value
,
size_t
valuelen
);
template
<
typename
ObjectType
>
int32_t
remove_record
(
const
table_id_object
&
t_id
,
const
typename
ObjectType
::
key_type
*
keys
);
int32_t
remove_record
(
const
table_id_object
&
t_id
,
const
account_name
&
bta
,
const
typename
ObjectType
::
key_type
*
keys
);
template
<
typename
IndexType
,
typename
Scope
>
int32_t
load_record
(
const
table_id_object
&
t_id
,
typename
IndexType
::
value_type
::
key_type
*
keys
,
char
*
value
,
size_t
valuelen
);
...
...
@@ -391,7 +391,7 @@ using apply_handler = std::function<void(apply_context&)>;
template
<
typename
ObjectType
>
int32_t
apply_context
::
store_record
(
const
table_id_object
&
t_id
,
const
typename
ObjectType
::
key_type
*
keys
,
const
char
*
value
,
size_t
valuelen
)
{
int32_t
apply_context
::
store_record
(
const
table_id_object
&
t_id
,
const
account_name
&
bta
,
const
typename
ObjectType
::
key_type
*
keys
,
const
char
*
value
,
size_t
valuelen
)
{
require_write_lock
(
t_id
.
scope
);
auto
tuple
=
impl
::
exact_tuple
<
ObjectType
>::
get
(
t_id
,
keys
);
...
...
@@ -413,7 +413,7 @@ using apply_handler = std::function<void(apply_context&)>;
}
template
<
typename
ObjectType
>
int32_t
apply_context
::
update_record
(
const
table_id_object
&
t_id
,
const
typename
ObjectType
::
key_type
*
keys
,
const
char
*
value
,
size_t
valuelen
)
{
int32_t
apply_context
::
update_record
(
const
table_id_object
&
t_id
,
const
account_name
&
bta
,
const
typename
ObjectType
::
key_type
*
keys
,
const
char
*
value
,
size_t
valuelen
)
{
require_write_lock
(
t_id
.
scope
);
auto
tuple
=
impl
::
exact_tuple
<
ObjectType
>::
get
(
t_id
,
keys
);
...
...
@@ -434,7 +434,7 @@ using apply_handler = std::function<void(apply_context&)>;
}
template
<
typename
ObjectType
>
int32_t
apply_context
::
remove_record
(
const
table_id_object
&
t_id
,
const
typename
ObjectType
::
key_type
*
keys
)
{
int32_t
apply_context
::
remove_record
(
const
table_id_object
&
t_id
,
const
account_name
&
bta
,
const
typename
ObjectType
::
key_type
*
keys
)
{
require_write_lock
(
t_id
.
scope
);
auto
tuple
=
impl
::
exact_tuple
<
ObjectType
>::
get
(
t_id
,
keys
);
...
...
libraries/chain/include/eosio/chain/contracts/contract_table_objects.hpp
浏览文件 @
7e19d137
...
...
@@ -18,13 +18,12 @@ namespace eosio { namespace chain { namespace contracts {
OBJECT_CTOR
(
table_id_object
)
id_type
id
;
scope_name
scope
;
account_name
code
;
scope_name
scope
;
table_name
table
;
account_name
bta
;
};
struct
by_
scope_cod
e_table
;
struct
by_
code_scop
e_table
;
using
table_id_multi_index
=
chainbase
::
shared_multi_index_container
<
table_id_object
,
...
...
@@ -32,12 +31,11 @@ namespace eosio { namespace chain { namespace contracts {
ordered_unique
<
tag
<
by_id
>
,
member
<
table_id_object
,
table_id_object
::
id_type
,
&
table_id_object
::
id
>
>
,
ordered_unique
<
tag
<
by_
scope_cod
e_table
>
,
ordered_unique
<
tag
<
by_
code_scop
e_table
>
,
composite_key
<
table_id_object
,
member
<
table_id_object
,
scope_name
,
&
table_id_object
::
scope
>
,
member
<
table_id_object
,
account_name
,
&
table_id_object
::
code
>
,
member
<
table_id_object
,
table_name
,
&
table_id_object
::
tabl
e
>
,
member
<
table_id_object
,
account_name
,
&
table_id_object
::
bta
>
member
<
table_id_object
,
scope_name
,
&
table_id_object
::
scop
e
>
,
member
<
table_id_object
,
table_name
,
&
table_id_object
::
table
>
>
>
>
...
...
@@ -48,7 +46,18 @@ namespace eosio { namespace chain { namespace contracts {
struct
by_scope_primary
;
struct
by_scope_secondary
;
struct
by_scope_tertiary
;
struct
by_bta
;
template
<
typename
ObjectType
>
using
bta_index
=
ordered_unique
<
tag
<
by_bta
>
,
composite_key
<
ObjectType
,
member
<
ObjectType
,
typename
ObjectType
::
id_type
,
&
ObjectType
::
id
>
,
member
<
ObjectType
,
table_id
,
&
ObjectType
::
t_id
>
,
member
<
ObjectType
,
account_name
,
&
ObjectType
::
bta
>
>
,
composite_key_compare
<
std
::
less
<
typename
ObjectType
::
id_type
>
,
std
::
less
<
table_id
>
,
std
::
less
<
account_name
>
>
>
;
struct
key_value_object
:
public
chainbase
::
object
<
key_value_object_type
,
key_value_object
>
{
OBJECT_CTOR
(
key_value_object
,
(
value
))
...
...
@@ -58,6 +67,7 @@ namespace eosio { namespace chain { namespace contracts {
id_type
id
;
table_id
t_id
;
uint64_t
primary_key
;
account_name
bta
;
shared_string
value
;
};
...
...
@@ -71,7 +81,8 @@ namespace eosio { namespace chain { namespace contracts {
member
<
key_value_object
,
uint64_t
,
&
key_value_object
::
primary_key
>
>
,
composite_key_compare
<
std
::
less
<
table_id
>
,
std
::
less
<
uint64_t
>
>
>
>
,
bta_index
<
key_value_object
>
>
>
;
...
...
@@ -104,6 +115,7 @@ namespace eosio { namespace chain { namespace contracts {
id_type
id
;
table_id
t_id
;
shared_string
primary_key
;
account_name
bta
;
shared_string
value
;
};
...
...
@@ -117,7 +129,8 @@ namespace eosio { namespace chain { namespace contracts {
const_mem_fun
<
keystr_value_object
,
const
char
*
,
&
keystr_value_object
::
data
>
>
,
composite_key_compare
<
std
::
less
<
table_id
>
,
shared_string_less
>
>
>
,
bta_index
<
keystr_value_object
>
>
>
;
...
...
@@ -131,6 +144,7 @@ namespace eosio { namespace chain { namespace contracts {
table_id
t_id
;
uint128_t
primary_key
;
uint128_t
secondary_key
;
account_name
bta
;
shared_string
value
;
};
...
...
@@ -153,7 +167,8 @@ namespace eosio { namespace chain { namespace contracts {
member
<
key128x128_value_object
,
typename
key128x128_value_object
::
id_type
,
&
key128x128_value_object
::
id
>
>
,
composite_key_compare
<
std
::
less
<
table_id
>
,
std
::
less
<
uint128_t
>
,
std
::
less
<
typename
key128x128_value_object
::
id_type
>
>
>
>
,
bta_index
<
key128x128_value_object
>
>
>
;
...
...
@@ -168,6 +183,7 @@ namespace eosio { namespace chain { namespace contracts {
uint64_t
primary_key
;
uint64_t
secondary_key
;
uint64_t
tertiary_key
;
account_name
bta
;
shared_string
value
;
};
...
...
@@ -199,7 +215,8 @@ namespace eosio { namespace chain { namespace contracts {
member
<
key64x64x64_value_object
,
typename
key64x64x64_value_object
::
id_type
,
&
key64x64x64_value_object
::
id
>
>
,
composite_key_compare
<
std
::
less
<
table_id
>
,
std
::
less
<
uint64_t
>
,
std
::
less
<
typename
key64x64x64_value_object
::
id_type
>
>
>
>
,
bta_index
<
key64x64x64_value_object
>
>
>
;
...
...
@@ -212,8 +229,8 @@ CHAINBASE_SET_INDEX_TYPE(eosio::chain::contracts::keystr_value_object, eosio::ch
CHAINBASE_SET_INDEX_TYPE
(
eosio
::
chain
::
contracts
::
key128x128_value_object
,
eosio
::
chain
::
contracts
::
key128x128_value_index
)
CHAINBASE_SET_INDEX_TYPE
(
eosio
::
chain
::
contracts
::
key64x64x64_value_object
,
eosio
::
chain
::
contracts
::
key64x64x64_value_index
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
table_id_object
,
(
id
)(
scope
)(
cod
e
)(
table
)
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
key_value_object
,
(
id
)(
t_id
)(
primary_key
)(
value
)
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
keystr_value_object
,
(
id
)(
t_id
)(
primary_key
)(
value
)
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
key128x128_value_object
,
(
id
)(
t_id
)(
primary_key
)(
secondary_key
)(
value
)
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
key64x64x64_value_object
,
(
id
)(
t_id
)(
primary_key
)(
secondary_key
)(
tertiary_key
)(
value
)
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
table_id_object
,
(
id
)(
code
)(
scop
e
)(
table
)
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
key_value_object
,
(
id
)(
t_id
)(
primary_key
)(
bta
)(
value
)
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
keystr_value_object
,
(
id
)(
t_id
)(
primary_key
)(
bta
)(
value
)
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
key128x128_value_object
,
(
id
)(
t_id
)(
primary_key
)(
secondary_key
)(
bta
)(
value
)
)
FC_REFLECT
(
eosio
::
chain
::
contracts
::
key64x64x64_value_object
,
(
id
)(
t_id
)(
primary_key
)(
secondary_key
)(
tertiary_key
)(
bta
)(
value
)
)
libraries/chain/wasm_interface.cpp
浏览文件 @
7e19d137
...
...
@@ -543,36 +543,35 @@ class db_api : public context_aware_api {
using
KeyType
=
typename
ObjectType
::
key_type
;
static
constexpr
int
KeyCount
=
ObjectType
::
number_of_keys
;
using
KeyArrayType
=
KeyType
[
KeyCount
];
using
ContextMethodType
=
int
(
apply_context
::*
)(
const
table_id_object
&
,
const
KeyType
*
,
const
char
*
,
size_t
);
using
ContextMethodType
=
int
(
apply_context
::*
)(
const
table_id_object
&
,
const
account_name
&
,
const
KeyType
*
,
const
char
*
,
size_t
);
private:
int
call
(
ContextMethodType
method
,
const
scope_name
&
scope
,
const
name
&
table
,
array_ptr
<
const
char
>
data
,
size_t
data_len
)
{
const
auto
&
t_id
=
context
.
find_or_create_table
(
scope
,
context
.
receiver
,
table
);
int
call
(
ContextMethodType
method
,
const
scope_name
&
scope
,
const
name
&
table
,
a
ccount_name
bta
,
a
rray_ptr
<
const
char
>
data
,
size_t
data_len
)
{
const
auto
&
t_id
=
context
.
find_or_create_table
(
context
.
receiver
,
scope
,
table
);
FC_ASSERT
(
data_len
>=
KeyCount
*
sizeof
(
KeyType
),
"Data is not long enough to contain keys"
);
const
KeyType
*
keys
=
reinterpret_cast
<
const
KeyType
*>
((
const
char
*
)
data
);
const
char
*
record_data
=
((
const
char
*
)
data
)
+
sizeof
(
KeyArrayType
);
size_t
record_len
=
data_len
-
sizeof
(
KeyArrayType
);
return
(
context
.
*
(
method
))(
t_id
,
keys
,
record_data
,
record_len
)
+
sizeof
(
KeyArrayType
);
return
(
context
.
*
(
method
))(
t_id
,
bta
,
keys
,
record_data
,
record_len
)
+
sizeof
(
KeyArrayType
);
}
public:
using
context_aware_api
::
context_aware_api
;
int
store
(
const
scope_name
&
scope
,
const
name
&
table
,
const
scope
_name
&
bta
,
array_ptr
<
const
char
>
data
,
size_t
data_len
)
{
auto
res
=
call
(
&
apply_context
::
store_record
<
ObjectType
>
,
scope
,
table
,
data
,
data_len
);
int
store
(
const
scope_name
&
scope
,
const
name
&
table
,
const
account
_name
&
bta
,
array_ptr
<
const
char
>
data
,
size_t
data_len
)
{
auto
res
=
call
(
&
apply_context
::
store_record
<
ObjectType
>
,
scope
,
table
,
bta
,
data
,
data_len
);
//ilog("STORE [${scope},${code},${table}] => ${res} :: ${HEX}", ("scope",scope)("code",context.receiver)("table",table)("res",res)("HEX", fc::to_hex(data, data_len)));
return
res
;
}
int
update
(
const
scope_name
&
scope
,
const
name
&
table
,
const
scope
_name
&
bta
,
array_ptr
<
const
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
update_record
<
ObjectType
>
,
scope
,
table
,
data
,
data_len
);
int
update
(
const
scope_name
&
scope
,
const
name
&
table
,
const
account
_name
&
bta
,
array_ptr
<
const
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
update_record
<
ObjectType
>
,
scope
,
table
,
bta
,
data
,
data_len
);
}
int
remove
(
const
scope_name
&
scope
,
const
name
&
table
,
const
scope
_name
&
bta
,
const
KeyArrayType
&
keys
)
{
const
auto
&
t_id
=
context
.
find_or_create_table
(
scope
,
context
.
receiver
,
table
);
return
context
.
remove_record
<
ObjectType
>
(
t_id
,
keys
);
int
remove
(
const
scope_name
&
scope
,
const
name
&
table
,
const
account
_name
&
bta
,
const
KeyArrayType
&
keys
)
{
const
auto
&
t_id
=
context
.
find_or_create_table
(
context
.
receiver
,
scope
,
table
);
return
context
.
remove_record
<
ObjectType
>
(
t_id
,
bta
,
keys
);
}
};
...
...
@@ -584,8 +583,8 @@ class db_index_api : public context_aware_api {
using
ContextMethodType
=
int
(
apply_context
::*
)(
const
table_id_object
&
,
KeyType
*
,
char
*
,
size_t
);
int
call
(
ContextMethodType
method
,
const
scope_name
&
scope
,
const
account_name
&
cod
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
auto
maybe_t_id
=
context
.
find_table
(
scope
,
context
.
receiver
,
table
);
int
call
(
ContextMethodType
method
,
const
account_name
&
code
,
const
scope_name
&
scop
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
auto
maybe_t_id
=
context
.
find_table
(
context
.
receiver
,
scope
,
table
);
if
(
maybe_t_id
==
nullptr
)
{
return
-
1
;
}
...
...
@@ -607,34 +606,34 @@ class db_index_api : public context_aware_api {
public:
using
context_aware_api
::
context_aware_api
;
int
load
(
const
scope_name
&
scope
,
const
account_name
&
cod
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
auto
res
=
call
(
&
apply_context
::
load_record
<
IndexType
,
Scope
>
,
scope
,
cod
e
,
table
,
data
,
data_len
);
int
load
(
const
account_name
&
code
,
const
scope_name
&
scop
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
auto
res
=
call
(
&
apply_context
::
load_record
<
IndexType
,
Scope
>
,
code
,
scop
e
,
table
,
data
,
data_len
);
//ilog("LOAD [${scope},${code},${table}] => ${res} :: ${HEX}", ("scope",scope)("code",code)("table",table)("res",res)("HEX", fc::to_hex(data, data_len)));
return
res
;
}
int
front
(
const
scope_name
&
scope
,
const
account_name
&
cod
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
front_record
<
IndexType
,
Scope
>
,
scope
,
cod
e
,
table
,
data
,
data_len
);
int
front
(
const
account_name
&
code
,
const
scope_name
&
scop
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
front_record
<
IndexType
,
Scope
>
,
code
,
scop
e
,
table
,
data
,
data_len
);
}
int
back
(
const
scope_name
&
scope
,
const
account_name
&
cod
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
back_record
<
IndexType
,
Scope
>
,
scope
,
cod
e
,
table
,
data
,
data_len
);
int
back
(
const
account_name
&
code
,
const
scope_name
&
scop
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
back_record
<
IndexType
,
Scope
>
,
code
,
scop
e
,
table
,
data
,
data_len
);
}
int
next
(
const
scope_name
&
scope
,
const
account_name
&
cod
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
next_record
<
IndexType
,
Scope
>
,
scope
,
cod
e
,
table
,
data
,
data_len
);
int
next
(
const
account_name
&
code
,
const
scope_name
&
scop
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
next_record
<
IndexType
,
Scope
>
,
code
,
scop
e
,
table
,
data
,
data_len
);
}
int
previous
(
const
scope_name
&
scope
,
const
account_name
&
cod
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
previous_record
<
IndexType
,
Scope
>
,
scope
,
cod
e
,
table
,
data
,
data_len
);
int
previous
(
const
account_name
&
code
,
const
scope_name
&
scop
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
previous_record
<
IndexType
,
Scope
>
,
code
,
scop
e
,
table
,
data
,
data_len
);
}
int
lower_bound
(
const
scope_name
&
scope
,
const
account_name
&
cod
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
lower_bound_record
<
IndexType
,
Scope
>
,
scope
,
cod
e
,
table
,
data
,
data_len
);
int
lower_bound
(
const
account_name
&
code
,
const
scope_name
&
scop
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
lower_bound_record
<
IndexType
,
Scope
>
,
code
,
scop
e
,
table
,
data
,
data_len
);
}
int
upper_bound
(
const
scope_name
&
scope
,
const
account_name
&
cod
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
upper_bound_record
<
IndexType
,
Scope
>
,
scope
,
cod
e
,
table
,
data
,
data_len
);
int
upper_bound
(
const
account_name
&
code
,
const
scope_name
&
scop
e
,
const
name
&
table
,
array_ptr
<
char
>
data
,
size_t
data_len
)
{
return
call
(
&
apply_context
::
upper_bound_record
<
IndexType
,
Scope
>
,
code
,
scop
e
,
table
,
data
,
data_len
);
}
};
...
...
libraries/testing/tester.cpp
浏览文件 @
7e19d137
...
...
@@ -255,7 +255,7 @@ namespace eosio { namespace testing {
const
asset_symbol
&
symbol
,
const
account_name
&
account
)
const
{
const
auto
&
db
=
control
->
get_database
();
const
auto
*
tbl
=
db
.
find
<
contracts
::
table_id_object
,
contracts
::
by_
scope_code_table
>
(
boost
::
make_tuple
(
account
,
code
,
N
(
account
)));
const
auto
*
tbl
=
db
.
find
<
contracts
::
table_id_object
,
contracts
::
by_
code_scope_table
>
(
boost
::
make_tuple
(
code
,
account
,
N
(
account
)));
share_type
result
=
0
;
// the balance is implied to be 0 if either the table or row does not exist
...
...
plugins/chain_plugin/chain_plugin.cpp
浏览文件 @
7e19d137
...
...
@@ -333,7 +333,7 @@ read_only::get_table_rows_result read_only::get_table_rows( const read_only::get
vector
<
asset
>
read_only
::
get_currency_balance
(
const
read_only
::
get_currency_balance_params
&
p
)
const
{
vector
<
asset
>
results
;
walk_table
<
contracts
::
key_value_index
,
contracts
::
by_scope_primary
>
(
p
.
account
,
p
.
code
,
N
(
account
),
[
&
](
const
contracts
::
key_value_object
&
obj
){
walk_table
<
contracts
::
key_value_index
,
contracts
::
by_scope_primary
>
(
p
.
code
,
p
.
account
,
N
(
account
),
[
&
](
const
contracts
::
key_value_object
&
obj
){
share_type
balance
;
fc
::
datastream
<
const
char
*>
ds
(
obj
.
value
.
data
(),
obj
.
value
.
size
());
fc
::
raw
::
unpack
(
ds
,
balance
);
...
...
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
浏览文件 @
7e19d137
...
...
@@ -164,8 +164,8 @@ public:
struct
get_table_rows_params
{
bool
json
=
false
;
name
scope
;
name
code
;
name
scope
;
name
table
;
// string table_type;
string
table_key
;
...
...
@@ -230,10 +230,10 @@ public:
}
template
<
typename
IndexType
,
typename
Scope
,
typename
Function
>
void
walk_table
(
const
name
&
scope
,
const
name
&
cod
e
,
const
name
&
table
,
Function
f
)
const
void
walk_table
(
const
name
&
code
,
const
name
&
scop
e
,
const
name
&
table
,
Function
f
)
const
{
const
auto
&
d
=
db
.
get_database
();
const
auto
*
t_id
=
d
.
find
<
chain
::
contracts
::
table_id_object
,
chain
::
contracts
::
by_
scope_code_table
>
(
boost
::
make_tuple
(
scope
,
cod
e
,
table
));
const
auto
*
t_id
=
d
.
find
<
chain
::
contracts
::
table_id_object
,
chain
::
contracts
::
by_
code_scope_table
>
(
boost
::
make_tuple
(
code
,
scop
e
,
table
));
if
(
t_id
!=
nullptr
)
{
const
auto
&
idx
=
d
.
get_index
<
IndexType
,
Scope
>
();
decltype
(
t_id
->
id
)
next_tid
(
t_id
->
id
.
_id
+
1
);
...
...
@@ -255,7 +255,7 @@ public:
abi_serializer
abis
;
abis
.
set_abi
(
abi
);
const
auto
*
t_id
=
d
.
find
<
chain
::
contracts
::
table_id_object
,
chain
::
contracts
::
by_
scope_code_table
>
(
boost
::
make_tuple
(
p
.
scope
,
p
.
cod
e
,
p
.
table
));
const
auto
*
t_id
=
d
.
find
<
chain
::
contracts
::
table_id_object
,
chain
::
contracts
::
by_
code_scope_table
>
(
boost
::
make_tuple
(
p
.
code
,
p
.
scop
e
,
p
.
table
));
if
(
t_id
!=
nullptr
)
{
const
auto
&
idx
=
d
.
get_index
<
IndexType
,
Scope
>
();
decltype
(
t_id
->
id
)
next_tid
(
t_id
->
id
.
_id
+
1
);
...
...
@@ -376,7 +376,7 @@ FC_REFLECT(eosio::chain_apis::read_only::get_block_params, (block_num_or_id))
FC_REFLECT_DERIVED
(
eosio
::
chain_apis
::
read_only
::
get_block_results
,
(
eosio
::
chain
::
signed_block
),
(
id
)(
block_num
)(
ref_block_prefix
)
);
FC_REFLECT
(
eosio
::
chain_apis
::
read_write
::
push_transaction_results
,
(
transaction_id
)(
processed
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_table_rows_params
,
(
json
)(
scope
)(
cod
e
)(
table
)(
table_key
)(
lower_bound
)(
upper_bound
)(
limit
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_table_rows_params
,
(
json
)(
code
)(
scop
e
)(
table
)(
table_key
)(
lower_bound
)(
upper_bound
)(
limit
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_table_rows_result
,
(
rows
)(
more
)
);
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_currency_balance_params
,
(
code
)(
account
)(
symbol
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录