Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
e78a46ce
Commit
e78a46ce
authored
Oct 13, 2021
by
harrylee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update broker
parent
6e5ca49f
Pipeline
#8128
failed with stages
in 0 seconds
Changes
7
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
21 deletions
+59
-21
brokerdb.go
plugin/dapp/broker/executor/brokerdb.go
+0
-0
exec.go
plugin/dapp/broker/executor/exec.go
+3
-3
kv.go
plugin/dapp/broker/executor/kv.go
+7
-3
query.go
plugin/dapp/broker/executor/query.go
+18
-10
broker.proto
plugin/dapp/broker/proto/broker.proto
+27
-5
broker.go
plugin/dapp/broker/types/broker.go
+4
-0
broker.pb.go
plugin/dapp/broker/types/broker.pb.go
+0
-0
No files found.
plugin/dapp/broker/executor/brokerdb.go
View file @
e78a46ce
This diff is collapsed.
Click to expand it.
plugin/dapp/broker/executor/exec.go
View file @
e78a46ce
...
@@ -10,9 +10,9 @@ import (
...
@@ -10,9 +10,9 @@ import (
* 关键数据上链(statedb)并生成交易回执(log)
* 关键数据上链(statedb)并生成交易回执(log)
*/
*/
func
(
b
*
broker
)
Exec_Init
()(
*
types
.
Receipt
,
error
){
func
(
b
*
broker
)
Exec_Init
(
payload
*
brokertypes
.
Init
,
tx
*
types
.
Transaction
,
index
int
)(
*
types
.
Receipt
,
error
){
return
nil
,
nil
db
:=
newBrokerDB
(
b
,
tx
,
index
)
return
db
.
initBroker
(
payload
)
}
}
func
(
b
*
broker
)
Exec_Register
(
payload
*
brokertypes
.
Register
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
func
(
b
*
broker
)
Exec_Register
(
payload
*
brokertypes
.
Register
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
...
...
plugin/dapp/broker/executor/kv.go
View file @
e78a46ce
...
@@ -19,14 +19,18 @@ const (
...
@@ -19,14 +19,18 @@ const (
callbackMeta
=
"callback-meta"
callbackMeta
=
"callback-meta"
dstRollbackMeta
=
"dst-rollback-meta"
dstRollbackMeta
=
"dst-rollback-meta"
whiteList
=
"white-list"
whiteList
=
"white-list"
adminList
=
"admin-list"
//
adminList = "admin-list"
passed
=
"1"
passed
=
"1"
rejected
=
"2"
rejected
=
"2"
delimiter
=
"&"
delimiter
=
"&"
bxhID
=
"bxh-id"
bxhID
=
"bxh-id"
appchainID
=
"appchain-id"
//appchainID = "appchain-id"
brokerAdmin
=
"broker-admin"
)
)
//跨链协议版本信息
func
BxhIDKey
()[]
byte
{
return
[]
byte
(
KeyPrefixStateDB
+
bxhID
)
}
//状态数据库中存储innermeta信息
//状态数据库中存储innermeta信息
func
calInnerMetaKey
()
[]
byte
{
func
calInnerMetaKey
()
[]
byte
{
key
:=
fmt
.
Sprintf
(
"%s"
+
":%s"
,
KeyPrefixStateDB
,
innerMeta
)
key
:=
fmt
.
Sprintf
(
"%s"
+
":%s"
,
KeyPrefixStateDB
,
innerMeta
)
...
...
plugin/dapp/broker/executor/query.go
View file @
e78a46ce
...
@@ -3,24 +3,33 @@ package executor
...
@@ -3,24 +3,33 @@ package executor
import
(
import
(
brokertypes
"github.com/33cn/plugin/plugin/dapp/broker/types"
brokertypes
"github.com/33cn/plugin/plugin/dapp/broker/types"
)
)
//获取innterMeta
//获取innterMeta
func
(
b
*
broker
)
Query_QueryInnerMeta
(
query
*
brokertypes
.
QueryInnerMeta
)(
*
brokertypes
.
Meta
,
error
)
{
func
(
b
*
broker
)
Query_QueryInnerMeta
(
query
*
brokertypes
.
QueryInnerMeta
)
(
*
brokertypes
.
Meta
,
error
)
{
return
getInnerMeta
(
b
.
GetStateDB
())
return
getInnerMeta
(
b
.
GetStateDB
())
}
}
//获取outterMeta
//获取outterMeta
func
(
b
*
broker
)
Query_QueryOutterMeta
(
query
*
brokertypes
.
QueryOutterMeta
)(
*
brokertypes
.
Meta
,
error
)
{
func
(
b
*
broker
)
Query_QueryOutterMeta
(
query
*
brokertypes
.
QueryOutterMeta
)
(
*
brokertypes
.
Meta
,
error
)
{
return
getOutterMeta
(
b
.
GetStateDB
())
return
getOutterMeta
(
b
.
GetStateDB
())
}
}
//获取inMessage
//获取inMessage
func
(
b
*
broker
)
Query_QueryInMessage
(
query
*
brokertypes
.
QueryInMessage
)(
*
brokertypes
.
Response
,
error
)
{
func
(
b
*
broker
)
Query_QueryInMessage
(
query
*
brokertypes
.
QueryInMessage
)
(
*
brokertypes
.
Response
,
error
)
{
return
getInMessage
(
b
.
GetStateDB
(),
query
)
return
getInMessage
(
b
.
GetStateDB
(),
query
)
}
}
//获取outMessage
//获取outMessage
func
(
b
*
broker
)
Query_QueryOutMessage
(
query
*
brokertypes
.
QueryOutMessage
)(
*
brokertypes
.
Response
,
error
)
{
func
(
b
*
broker
)
Query_QueryOutMessage
(
query
*
brokertypes
.
QueryOutMessage
)
(
*
brokertypes
.
Response
,
error
)
{
return
getOutMessage
(
b
.
GetStateDB
(),
query
)
return
getOutMessage
(
b
.
GetStateDB
(),
query
)
}
}
//获取监听列表
//获取监听列表
func
(
b
*
broker
)
Query_PollingEvent
(
query
*
brokertypes
.
PollingEvent
)(
*
brokertypes
.
InterChainEventList
,
error
){
func
(
b
*
broker
)
Query_PollingEvent
(
query
*
brokertypes
.
PollingEvent
)
(
*
brokertypes
.
InterChainEventList
,
error
)
{
return
pollInterEvent
(
b
.
GetStateDB
(),
query
.
Meta
)
return
pollInterEvent
(
b
.
GetStateDB
(),
query
.
Meta
)
}
}
\ No newline at end of file
//get bitxhub and chainID
func
(
b
*
broker
)
Query_GetBrokerInfo
(
query
*
brokertypes
.
QueryNilParam
)
(
*
brokertypes
.
BrokerInfo
,
error
)
{
return
getBrokerInfo
(
b
.
GetStateDB
())
}
plugin/dapp/broker/proto/broker.proto
View file @
e78a46ce
...
@@ -3,13 +3,23 @@ package types;
...
@@ -3,13 +3,23 @@ package types;
option
go_package
=
"../types"
;
option
go_package
=
"../types"
;
message
BrokerAction
{
message
BrokerAction
{
oneof
value
{
oneof
value
{
Register
register
=
1
;
Init
init
=
1
;
Audit
audit
=
2
;
Register
register
=
2
;
InterchainEvent
emitInterchainEvent
=
3
;
Audit
audit
=
3
;
UpdateIndex
updateIndex
=
4
;
InterchainEvent
emitInterchainEvent
=
4
;
UpdateIndex
updateIndex
=
5
;
}
}
int32
ty
=
5
;
int32
ty
=
6
;
}
//broker初始化信息
message
Init
{
string
bxhId
=
1
;
string
appChainId
=
2
;
}
}
// 业务合约注册模型: 0表示正在审核,1表示审核通过,2表示审核失败
// 业务合约注册模型: 0表示正在审核,1表示审核通过,2表示审核失败
message
Register
{
message
Register
{
//业务合约名称
//业务合约名称
...
@@ -101,6 +111,10 @@ message InterChainEventList{
...
@@ -101,6 +111,10 @@ message InterChainEventList{
// repeated InterchainEvent list = 1;
// repeated InterchainEvent list = 1;
// string primaryKey = 2;
// string primaryKey = 2;
//}
//}
message
QueryNilParam
{
}
message
QueryOutterMeta
{
message
QueryOutterMeta
{
}
}
...
@@ -119,6 +133,14 @@ message QueryOutMessage{
...
@@ -119,6 +133,14 @@ message QueryOutMessage{
uint64
sequenceNum
=
2
;
uint64
sequenceNum
=
2
;
}
}
message
BrokerInfo
{
//跨链协议版本ID
string
bxhId
=
1
;
//应用链ID
string
appChainId
=
2
;
}
message
Meta
{
message
Meta
{
map
<
string
,
uint64
>
meta
=
1
;
map
<
string
,
uint64
>
meta
=
1
;
}
}
...
...
plugin/dapp/broker/types/broker.go
View file @
e78a46ce
...
@@ -14,11 +14,13 @@ import (
...
@@ -14,11 +14,13 @@ import (
// action类型id和name,这些常量可以自定义修改
// action类型id和name,这些常量可以自定义修改
const
(
const
(
TyUnknowAction
=
iota
+
100
TyUnknowAction
=
iota
+
100
TyInitAction
TyRegisterAction
TyRegisterAction
TyAuditAction
TyAuditAction
TyUpdateIndexAction
TyUpdateIndexAction
TyEmitInterchainEventAction
TyEmitInterchainEventAction
NameInitAction
=
"Init"
NameRegisterAction
=
"Register"
NameRegisterAction
=
"Register"
NameAuditAction
=
"Audit"
NameAuditAction
=
"Audit"
NameUpdateIndexAction
=
"UpdateIndex"
NameUpdateIndexAction
=
"UpdateIndex"
...
@@ -69,6 +71,7 @@ const (
...
@@ -69,6 +71,7 @@ const (
// log类型id值
// log类型id值
const
(
const
(
TyUnknownLog
=
iota
+
100
TyUnknownLog
=
iota
+
100
TyInitLog
TyRegisterLog
TyRegisterLog
TyAuditLog
TyAuditLog
TyUpdateIndexLog
TyUpdateIndexLog
...
@@ -80,6 +83,7 @@ var (
...
@@ -80,6 +83,7 @@ var (
BrokerX
=
"broker"
BrokerX
=
"broker"
//定义actionMap
//定义actionMap
actionMap
=
map
[
string
]
int32
{
actionMap
=
map
[
string
]
int32
{
NameInitAction
:
TyInitAction
,
NameRegisterAction
:
TyRegisterAction
,
NameRegisterAction
:
TyRegisterAction
,
NameAuditAction
:
TyAuditAction
,
NameAuditAction
:
TyAuditAction
,
NameUpdateIndexAction
:
TyUpdateIndexAction
,
NameUpdateIndexAction
:
TyUpdateIndexAction
,
...
...
plugin/dapp/broker/types/broker.pb.go
View file @
e78a46ce
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment