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
af4f3531
Commit
af4f3531
authored
Aug 01, 2019
by
liuyuhang
Committed by
33cn
Aug 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add db table to poard
parent
a624910f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
246 additions
and
230 deletions
+246
-230
board.go
plugin/dapp/autonomy/executor/board.go
+69
-30
board_test.go
plugin/dapp/autonomy/executor/board_test.go
+4
-2
boardtable.go
plugin/dapp/autonomy/executor/boardtable.go
+73
-0
project.go
plugin/dapp/autonomy/executor/project.go
+27
-27
project_test.go
plugin/dapp/autonomy/executor/project_test.go
+2
-2
rule.go
plugin/dapp/autonomy/executor/rule.go
+27
-27
rule_test.go
plugin/dapp/autonomy/executor/rule_test.go
+2
-2
board.proto
plugin/dapp/autonomy/proto/board.proto
+6
-5
project.proto
plugin/dapp/autonomy/proto/project.proto
+6
-5
rule.proto
plugin/dapp/autonomy/proto/rule.proto
+6
-5
autonomy.pb.go
plugin/dapp/autonomy/types/autonomy.pb.go
+0
-0
board.pb.go
plugin/dapp/autonomy/types/board.pb.go
+0
-0
lcommon.pb.go
plugin/dapp/autonomy/types/lcommon.pb.go
+24
-125
project.pb.go
plugin/dapp/autonomy/types/project.pb.go
+0
-0
rule.pb.go
plugin/dapp/autonomy/types/rule.pb.go
+0
-0
No files found.
plugin/dapp/autonomy/executor/board.go
View file @
af4f3531
...
@@ -14,7 +14,7 @@ import (
...
@@ -14,7 +14,7 @@ import (
func
(
a
*
Autonomy
)
execLocalBoard
(
receiptData
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
func
(
a
*
Autonomy
)
execLocalBoard
(
receiptData
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
dbSet
:=
&
types
.
LocalDBSet
{}
dbSet
:=
&
types
.
LocalDBSet
{}
var
set
[]
*
types
.
KeyValue
table
:=
NewBoardTable
(
a
.
GetLocalDB
())
for
_
,
log
:=
range
receiptData
.
Logs
{
for
_
,
log
:=
range
receiptData
.
Logs
{
switch
log
.
Ty
{
switch
log
.
Ty
{
case
auty
.
TyLogPropBoard
,
case
auty
.
TyLogPropBoard
,
...
@@ -27,14 +27,23 @@ func (a *Autonomy) execLocalBoard(receiptData *types.ReceiptData) (*types.LocalD
...
@@ -27,14 +27,23 @@ func (a *Autonomy) execLocalBoard(receiptData *types.ReceiptData) (*types.LocalD
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
kv
:=
saveBoardHeightIndex
(
&
receipt
)
set
=
append
(
set
,
kv
...
)
err
=
table
.
Replace
(
receipt
.
Current
)
if
err
!=
nil
{
return
nil
,
err
}
}
}
default
:
default
:
break
break
}
}
}
}
dbSet
.
KV
=
append
(
dbSet
.
KV
,
set
...
)
kvs
,
err
:=
table
.
Save
()
if
err
!=
nil
{
return
nil
,
err
}
dbSet
.
KV
=
append
(
dbSet
.
KV
,
kvs
...
)
return
dbSet
,
nil
return
dbSet
,
nil
}
}
...
@@ -56,27 +65,41 @@ func saveBoardHeightIndex(res *auty.ReceiptProposalBoard) (kvs []*types.KeyValue
...
@@ -56,27 +65,41 @@ func saveBoardHeightIndex(res *auty.ReceiptProposalBoard) (kvs []*types.KeyValue
func
(
a
*
Autonomy
)
execDelLocalBoard
(
receiptData
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
func
(
a
*
Autonomy
)
execDelLocalBoard
(
receiptData
*
types
.
ReceiptData
)
(
*
types
.
LocalDBSet
,
error
)
{
dbSet
:=
&
types
.
LocalDBSet
{}
dbSet
:=
&
types
.
LocalDBSet
{}
var
set
[]
*
types
.
KeyValue
table
:=
NewBoardTable
(
a
.
GetLocalDB
())
for
_
,
log
:=
range
receiptData
.
Logs
{
for
_
,
log
:=
range
receiptData
.
Logs
{
var
receipt
auty
.
ReceiptProposalBoard
err
:=
types
.
Decode
(
log
.
Log
,
&
receipt
)
if
err
!=
nil
{
return
nil
,
err
}
switch
log
.
Ty
{
switch
log
.
Ty
{
case
auty
.
TyLogPropBoard
,
case
auty
.
TyLogPropBoard
:
auty
.
TyLogRvkPropBoard
,
{
heightIndex
:=
dapp
.
HeightIndexStr
(
receipt
.
Current
.
Height
,
int64
(
receipt
.
Current
.
Index
))
err
=
table
.
Del
([]
byte
(
heightIndex
))
if
err
!=
nil
{
return
nil
,
err
}
}
case
auty
.
TyLogRvkPropBoard
,
auty
.
TyLogVotePropBoard
,
auty
.
TyLogVotePropBoard
,
auty
.
TyLogTmintPropBoard
:
auty
.
TyLogTmintPropBoard
:
{
{
var
receipt
auty
.
ReceiptProposalBoard
err
=
table
.
Replace
(
receipt
.
Prev
)
err
:=
types
.
Decode
(
log
.
Log
,
&
receipt
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
kv
:=
delBoardHeightIndex
(
&
receipt
)
set
=
append
(
set
,
kv
...
)
}
}
default
:
default
:
break
break
}
}
}
}
dbSet
.
KV
=
append
(
dbSet
.
KV
,
set
...
)
kvs
,
err
:=
table
.
Save
()
if
err
!=
nil
{
return
nil
,
err
}
dbSet
.
KV
=
append
(
dbSet
.
KV
,
kvs
...
)
return
dbSet
,
nil
return
dbSet
,
nil
}
}
...
@@ -117,38 +140,54 @@ func (a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Mes
...
@@ -117,38 +140,54 @@ func (a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Mes
if
req
==
nil
{
if
req
==
nil
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
var
key
[]
byte
var
values
[][]
byte
var
err
error
localDb
:=
a
.
GetLocalDB
()
localDb
:=
a
.
GetLocalDB
()
if
req
.
GetIndex
()
==
-
1
{
query
:=
NewBoardTable
(
localDb
)
.
GetQuery
(
localDb
)
key
=
nil
var
primary
[]
byte
}
else
{
//翻页查找指定的txhash列表
if
req
.
Height
>
0
{
heightstr
:=
genHeightIndexStr
(
req
.
GetIndex
())
primary
=
[]
byte
(
dapp
.
HeightIndexStr
(
req
.
Height
,
int64
(
req
.
Index
)))
key
=
calcBoardKey4StatusHeight
(
req
.
Status
,
heightstr
)
}
}
indexName
:=
""
prefix
:=
calcBoardKey4StatusHeight
(
req
.
Status
,
""
)
if
req
.
Status
>
0
&&
req
.
Addr
!=
""
{
values
,
err
=
localDb
.
List
(
prefix
,
key
,
req
.
Count
,
req
.
GetDirection
())
indexName
=
"addr_status"
}
else
if
req
.
Status
>
0
{
indexName
=
"status"
}
else
if
req
.
Addr
!=
""
{
indexName
=
"addr"
}
cur
:=
&
BoardRow
{
AutonomyProposalBoard
:
&
auty
.
AutonomyProposalBoard
{},
}
cur
.
Address
=
req
.
Addr
cur
.
Status
=
req
.
Status
cur
.
Height
=
req
.
Height
cur
.
Index
=
req
.
Index
prefix
,
err
:=
cur
.
Get
(
indexName
)
rows
,
err
:=
query
.
ListIndex
(
indexName
,
prefix
,
primary
,
req
.
Count
,
req
.
Direction
)
if
err
!=
nil
{
if
err
!=
nil
{
alog
.
Error
(
"query List failed"
,
"indexName"
,
indexName
,
"prefix"
,
"prefix"
,
"key"
,
string
(
primary
),
"err"
,
err
)
return
nil
,
err
return
nil
,
err
}
}
if
len
(
value
s
)
==
0
{
if
len
(
row
s
)
==
0
{
return
nil
,
types
.
ErrNotFound
return
nil
,
types
.
ErrNotFound
}
}
var
rep
auty
.
ReplyQueryProposalBoard
var
rep
auty
.
ReplyQueryProposalBoard
for
_
,
value
:=
range
value
s
{
for
_
,
row
:=
range
row
s
{
prop
:=
&
auty
.
AutonomyProposalBoard
{}
r
,
ok
:=
row
.
Data
.
(
*
auty
.
AutonomyProposalBoard
)
err
=
types
.
Decode
(
value
,
prop
)
if
!
ok
{
if
err
!=
nil
{
alog
.
Error
(
"listProposalBoard"
,
"err"
,
"bad row type"
)
return
nil
,
err
return
nil
,
types
.
ErrDecode
}
}
rep
.
PropBoards
=
append
(
rep
.
PropBoards
,
prop
)
rep
.
PropBoards
=
append
(
rep
.
PropBoards
,
r
)
}
}
return
&
rep
,
nil
return
&
rep
,
nil
}
}
func
genHeightIndexStr
(
index
int64
)
string
{
func
genHeightIndexStr
(
index
int64
)
string
{
return
fmt
.
Sprintf
(
"%018d"
,
index
)
return
fmt
.
Sprintf
(
"%018d"
,
index
)
}
}
plugin/dapp/autonomy/executor/board_test.go
View file @
af4f3531
...
@@ -15,7 +15,9 @@ import (
...
@@ -15,7 +15,9 @@ import (
)
)
func
TestExecLocalBoard
(
t
*
testing
.
T
)
{
func
TestExecLocalBoard
(
t
*
testing
.
T
)
{
_
,
_
,
kvdb
:=
util
.
CreateTestDB
()
au
:=
&
Autonomy
{}
au
:=
&
Autonomy
{}
au
.
SetLocalDB
(
kvdb
)
//TyLogPropBoard
//TyLogPropBoard
cur
:=
&
auty
.
AutonomyProposalBoard
{
cur
:=
&
auty
.
AutonomyProposalBoard
{
PropBoard
:
&
auty
.
ProposalBoard
{},
PropBoard
:
&
auty
.
ProposalBoard
{},
...
@@ -247,12 +249,12 @@ func TestListProposalBoard(t *testing.T) {
...
@@ -247,12 +249,12 @@ func TestListProposalBoard(t *testing.T) {
require
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
require
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
require
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
require
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
//
//
Index
:=
height
*
types
.
MaxTxsPerBlock
+
int64
(
index
)
req
=
&
auty
.
ReqQueryProposalBoard
{
req
=
&
auty
.
ReqQueryProposalBoard
{
Status
:
auty
.
AutonomyStatusProposalBoard
,
Status
:
auty
.
AutonomyStatusProposalBoard
,
Count
:
10
,
Count
:
10
,
Direction
:
0
,
Direction
:
0
,
Index
:
Index
,
Height
:
height
,
Index
:
index
,
}
}
rsp
,
err
=
au
.
listProposalBoard
(
req
)
rsp
,
err
=
au
.
listProposalBoard
(
req
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
...
...
plugin/dapp/autonomy/executor/boardtable.go
0 → 100644
View file @
af4f3531
package
executor
import
(
"fmt"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/db/table"
"github.com/33cn/chain33/types"
auty
"github.com/33cn/plugin/plugin/dapp/autonomy/types"
"github.com/33cn/chain33/system/dapp"
)
/*
table struct
data: autonomy board
index: status, addr
*/
var
opt
=
&
table
.
Option
{
Prefix
:
"LODB-autonomy"
,
Name
:
"board"
,
Primary
:
"heightindex"
,
Index
:
[]
string
{
"addr"
,
"status"
,
"addr_status"
},
}
//NewTable 新建表
func
NewBoardTable
(
kvdb
db
.
KV
)
*
table
.
Table
{
rowmeta
:=
NewBoardRow
()
table
,
err
:=
table
.
NewTable
(
rowmeta
,
kvdb
,
opt
)
if
err
!=
nil
{
panic
(
err
)
}
return
table
}
//BoardRow table meta 结构
type
BoardRow
struct
{
*
auty
.
AutonomyProposalBoard
}
//NewBoardRow 新建一个meta 结构
func
NewBoardRow
()
*
BoardRow
{
return
&
BoardRow
{
AutonomyProposalBoard
:
&
auty
.
AutonomyProposalBoard
{}}
}
//CreateRow 新建数据行(注意index 数据一定也要保存到数据中,不能就保存heightindex)
func
(
r
*
BoardRow
)
CreateRow
()
*
table
.
Row
{
return
&
table
.
Row
{
Data
:
&
auty
.
AutonomyProposalBoard
{}}
}
//SetPayload 设置数据
func
(
r
*
BoardRow
)
SetPayload
(
data
types
.
Message
)
error
{
if
d
,
ok
:=
data
.
(
*
auty
.
AutonomyProposalBoard
);
ok
{
r
.
AutonomyProposalBoard
=
d
return
nil
}
return
types
.
ErrTypeAsset
}
//Get 按照indexName 查询 indexValue
func
(
r
*
BoardRow
)
Get
(
key
string
)
([]
byte
,
error
)
{
if
key
==
"heightindex"
{
return
[]
byte
(
dapp
.
HeightIndexStr
(
r
.
Height
,
int64
(
r
.
Index
))),
nil
}
else
if
key
==
"status"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%2d"
,
r
.
Status
)),
nil
}
else
if
key
==
"addr"
{
return
[]
byte
(
r
.
Address
),
nil
}
else
if
key
==
"addr_status"
{
return
[]
byte
(
fmt
.
Sprintf
(
"%s:%2d"
,
r
.
Address
,
r
.
Status
)),
nil
}
return
nil
,
types
.
ErrNotFound
}
plugin/dapp/autonomy/executor/project.go
View file @
af4f3531
...
@@ -117,34 +117,34 @@ func (a *Autonomy) listProposalProject(req *auty.ReqQueryProposalProject) (types
...
@@ -117,34 +117,34 @@ func (a *Autonomy) listProposalProject(req *auty.ReqQueryProposalProject) (types
if
req
==
nil
{
if
req
==
nil
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
var
key
[]
byte
//
var key []byte
var
values
[][]
byte
//
var values [][]byte
var
err
error
//
var err error
//
localDb
:=
a
.
GetLocalDB
()
//
localDb := a.GetLocalDB()
if
req
.
GetIndex
()
==
-
1
{
//
if req.GetIndex() == -1 {
key
=
nil
//
key = nil
}
else
{
//翻页查找指定的txhash列表
//
} else { //翻页查找指定的txhash列表
heightstr
:=
genHeightIndexStr
(
req
.
GetIndex
())
//
heightstr := genHeightIndexStr(req.GetIndex())
key
=
calcProjectKey4StatusHeight
(
req
.
Status
,
heightstr
)
//
key = calcProjectKey4StatusHeight(req.Status, heightstr)
}
//
}
prefix
:=
calcProjectKey4StatusHeight
(
req
.
Status
,
""
)
//
prefix := calcProjectKey4StatusHeight(req.Status, "")
values
,
err
=
localDb
.
List
(
prefix
,
key
,
req
.
Count
,
req
.
GetDirection
())
//
values, err = localDb.List(prefix, key, req.Count, req.GetDirection())
if
err
!=
nil
{
//
if err != nil {
return
nil
,
err
//
return nil, err
}
//
}
if
len
(
values
)
==
0
{
//
if len(values) == 0 {
return
nil
,
types
.
ErrNotFound
//
return nil, types.ErrNotFound
}
//
}
var
rep
auty
.
ReplyQueryProposalProject
var
rep
auty
.
ReplyQueryProposalProject
for
_
,
value
:=
range
values
{
//
for _, value := range values {
prop
:=
&
auty
.
AutonomyProposalProject
{}
//
prop := &auty.AutonomyProposalProject{}
err
=
types
.
Decode
(
value
,
prop
)
//
err = types.Decode(value, prop)
if
err
!=
nil
{
//
if err != nil {
return
nil
,
err
//
return nil, err
}
//
}
rep
.
PropProjects
=
append
(
rep
.
PropProjects
,
prop
)
//
rep.PropProjects = append(rep.PropProjects, prop)
}
//
}
return
&
rep
,
nil
return
&
rep
,
nil
}
}
plugin/dapp/autonomy/executor/project_test.go
View file @
af4f3531
...
@@ -253,12 +253,12 @@ func TestListProposalProject(t *testing.T) {
...
@@ -253,12 +253,12 @@ func TestListProposalProject(t *testing.T) {
require
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
require
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
require
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
require
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
//
//
Index
:=
height
*
types
.
MaxTxsPerBlock
+
int64
(
index
)
req
=
&
auty
.
ReqQueryProposalProject
{
req
=
&
auty
.
ReqQueryProposalProject
{
Status
:
auty
.
AutonomyStatusProposalProject
,
Status
:
auty
.
AutonomyStatusProposalProject
,
Count
:
10
,
Count
:
10
,
Direction
:
0
,
Direction
:
0
,
Index
:
Index
,
Height
:
height
,
Index
:
index
,
}
}
rsp
,
err
=
au
.
listProposalProject
(
req
)
rsp
,
err
=
au
.
listProposalProject
(
req
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
...
...
plugin/dapp/autonomy/executor/rule.go
View file @
af4f3531
...
@@ -115,35 +115,35 @@ func (a *Autonomy) listProposalRule(req *auty.ReqQueryProposalRule) (types.Messa
...
@@ -115,35 +115,35 @@ func (a *Autonomy) listProposalRule(req *auty.ReqQueryProposalRule) (types.Messa
if
req
==
nil
{
if
req
==
nil
{
return
nil
,
types
.
ErrInvalidParam
return
nil
,
types
.
ErrInvalidParam
}
}
var
key
[]
byte
//
var key []byte
var
values
[][]
byte
//
var values [][]byte
var
err
error
//
var err error
//
localDb
:=
a
.
GetLocalDB
()
//
localDb := a.GetLocalDB()
if
req
.
GetIndex
()
==
-
1
{
//
if req.GetIndex() == -1 {
key
=
nil
//
key = nil
}
else
{
//翻页查找指定的txhash列表
//
} else { //翻页查找指定的txhash列表
heightstr
:=
genHeightIndexStr
(
req
.
GetIndex
())
//
heightstr := genHeightIndexStr(req.GetIndex())
key
=
calcRuleKey4StatusHeight
(
req
.
Status
,
heightstr
)
//
key = calcRuleKey4StatusHeight(req.Status, heightstr)
}
//
}
prefix
:=
calcRuleKey4StatusHeight
(
req
.
Status
,
""
)
//
prefix := calcRuleKey4StatusHeight(req.Status, "")
values
,
err
=
localDb
.
List
(
prefix
,
key
,
req
.
Count
,
req
.
GetDirection
())
//
values, err = localDb.List(prefix, key, req.Count, req.GetDirection())
if
err
!=
nil
{
//
if err != nil {
return
nil
,
err
//
return nil, err
}
//
}
if
len
(
values
)
==
0
{
//
if len(values) == 0 {
return
nil
,
types
.
ErrNotFound
//
return nil, types.ErrNotFound
}
//
}
var
rep
auty
.
ReplyQueryProposalRule
var
rep
auty
.
ReplyQueryProposalRule
for
_
,
value
:=
range
values
{
//
for _, value := range values {
prop
:=
&
auty
.
AutonomyProposalRule
{}
//
prop := &auty.AutonomyProposalRule{}
err
=
types
.
Decode
(
value
,
prop
)
//
err = types.Decode(value, prop)
if
err
!=
nil
{
//
if err != nil {
return
nil
,
err
//
return nil, err
}
//
}
rep
.
PropRules
=
append
(
rep
.
PropRules
,
prop
)
//
rep.PropRules = append(rep.PropRules, prop)
}
//
}
return
&
rep
,
nil
return
&
rep
,
nil
}
}
...
...
plugin/dapp/autonomy/executor/rule_test.go
View file @
af4f3531
...
@@ -247,12 +247,12 @@ func TestListProposalRule(t *testing.T) {
...
@@ -247,12 +247,12 @@ func TestListProposalRule(t *testing.T) {
require
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
require
.
Equal
(
t
,
height
,
testcase2
[
2
]
.
height
)
require
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
require
.
Equal
(
t
,
index
,
int32
(
testcase2
[
2
]
.
index
))
//
//
Index
:=
height
*
types
.
MaxTxsPerBlock
+
int64
(
index
)
req
=
&
auty
.
ReqQueryProposalRule
{
req
=
&
auty
.
ReqQueryProposalRule
{
Status
:
auty
.
AutonomyStatusProposalRule
,
Status
:
auty
.
AutonomyStatusProposalRule
,
Count
:
10
,
Count
:
10
,
Direction
:
0
,
Direction
:
0
,
Index
:
Index
,
Height
:
height
,
Index
:
index
,
}
}
rsp
,
err
=
au
.
listProposalRule
(
req
)
rsp
,
err
=
au
.
listProposalRule
(
req
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
...
...
plugin/dapp/autonomy/proto/board.proto
View file @
af4f3531
...
@@ -65,11 +65,12 @@ message LocalProposalBoard {
...
@@ -65,11 +65,12 @@ message LocalProposalBoard {
// query
// query
message
ReqQueryProposalBoard
{
message
ReqQueryProposalBoard
{
//优先根据status查询
int32
count
=
1
;
int32
status
=
1
;
int32
direction
=
2
;
int32
count
=
2
;
int64
height
=
3
;
int32
direction
=
3
;
int32
index
=
4
;
int64
index
=
4
;
int32
status
=
5
;
string
addr
=
6
;
}
}
message
ReplyQueryProposalBoard
{
message
ReplyQueryProposalBoard
{
...
...
plugin/dapp/autonomy/proto/project.proto
View file @
af4f3531
...
@@ -82,11 +82,12 @@ message LocalProposalProject {
...
@@ -82,11 +82,12 @@ message LocalProposalProject {
// query
// query
message
ReqQueryProposalProject
{
message
ReqQueryProposalProject
{
//优先根据status查询
int32
count
=
1
;
int32
status
=
1
;
int32
direction
=
2
;
int32
count
=
2
;
int64
height
=
3
;
int32
direction
=
3
;
int32
index
=
4
;
int64
index
=
4
;
int32
status
=
5
;
string
addr
=
6
;
}
}
message
ReplyQueryProposalProject
{
message
ReplyQueryProposalProject
{
...
...
plugin/dapp/autonomy/proto/rule.proto
View file @
af4f3531
...
@@ -61,11 +61,12 @@ message LocalProposalRule {
...
@@ -61,11 +61,12 @@ message LocalProposalRule {
// query
// query
message
ReqQueryProposalRule
{
message
ReqQueryProposalRule
{
//优先根据status查询
int32
count
=
1
;
int32
status
=
1
;
int32
direction
=
2
;
int32
count
=
2
;
int64
height
=
3
;
int32
direction
=
3
;
int32
index
=
4
;
int64
index
=
4
;
int32
status
=
5
;
string
addr
=
6
;
}
}
message
ReplyQueryProposalRule
{
message
ReplyQueryProposalRule
{
...
...
plugin/dapp/autonomy/types/autonomy.pb.go
View file @
af4f3531
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/types/board.pb.go
View file @
af4f3531
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/types/lcommon.pb.go
View file @
af4f3531
...
@@ -3,62 +3,30 @@
...
@@ -3,62 +3,30 @@
package
types
package
types
import
(
import
proto
"github.com/golang/protobuf/proto"
fmt
"fmt"
import
fmt
"fmt"
math
"math"
import
math
"math"
proto
"github.com/golang/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.
// Reference imports to suppress errors if they are not otherwise used.
var
_
=
proto
.
Marshal
var
_
=
proto
.
Marshal
var
_
=
fmt
.
Errorf
var
_
=
fmt
.
Errorf
var
_
=
math
.
Inf
var
_
=
math
.
Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const
_
=
proto
.
ProtoPackageIsVersion2
// please upgrade the proto package
type
VoteResult
struct
{
type
VoteResult
struct
{
// 总票数
// 总票数
TotalVotes
int32
`protobuf:"varint,1,opt,name=totalVotes
,proto3
" json:"totalVotes,omitempty"`
TotalVotes
int32
`protobuf:"varint,1,opt,name=totalVotes" json:"totalVotes,omitempty"`
// 赞成票
// 赞成票
ApproveVotes
int32
`protobuf:"varint,2,opt,name=approveVotes
,proto3
" json:"approveVotes,omitempty"`
ApproveVotes
int32
`protobuf:"varint,2,opt,name=approveVotes" json:"approveVotes,omitempty"`
// 反对票
// 反对票
OpposeVotes
int32
`protobuf:"varint,3,opt,name=opposeVotes
,proto3
" json:"opposeVotes,omitempty"`
OpposeVotes
int32
`protobuf:"varint,3,opt,name=opposeVotes" json:"opposeVotes,omitempty"`
// 是否通过
// 是否通过
Pass
bool
`protobuf:"varint,4,opt,name=pass,proto3" json:"pass,omitempty"`
Pass
bool
`protobuf:"varint,4,opt,name=pass" json:"pass,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
}
func
(
m
*
VoteResult
)
Reset
()
{
*
m
=
VoteResult
{}
}
func
(
m
*
VoteResult
)
Reset
()
{
*
m
=
VoteResult
{}
}
func
(
m
*
VoteResult
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
VoteResult
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
VoteResult
)
ProtoMessage
()
{}
func
(
*
VoteResult
)
ProtoMessage
()
{}
func
(
*
VoteResult
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
VoteResult
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor2
,
[]
int
{
0
}
}
return
fileDescriptor_d916a933dd8220ff
,
[]
int
{
0
}
}
func
(
m
*
VoteResult
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_VoteResult
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
VoteResult
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_VoteResult
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
VoteResult
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_VoteResult
.
Merge
(
m
,
src
)
}
func
(
m
*
VoteResult
)
XXX_Size
()
int
{
return
xxx_messageInfo_VoteResult
.
Size
(
m
)
}
func
(
m
*
VoteResult
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_VoteResult
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_VoteResult
proto
.
InternalMessageInfo
func
(
m
*
VoteResult
)
GetTotalVotes
()
int32
{
func
(
m
*
VoteResult
)
GetTotalVotes
()
int32
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -90,42 +58,19 @@ func (m *VoteResult) GetPass() bool {
...
@@ -90,42 +58,19 @@ func (m *VoteResult) GetPass() bool {
type
PublicVote
struct
{
type
PublicVote
struct
{
// 是否需要公示
// 是否需要公示
Publicity
bool
`protobuf:"varint,1,opt,name=publicity
,proto3
" json:"publicity,omitempty"`
Publicity
bool
`protobuf:"varint,1,opt,name=publicity" json:"publicity,omitempty"`
// 总票数
// 总票数
TotalVotes
int32
`protobuf:"varint,2,opt,name=totalVotes
,proto3
" json:"totalVotes,omitempty"`
TotalVotes
int32
`protobuf:"varint,2,opt,name=totalVotes" json:"totalVotes,omitempty"`
// 全体持票人反对票
// 全体持票人反对票
OpposeVotes
int32
`protobuf:"varint,3,opt,name=opposeVotes
,proto3
" json:"opposeVotes,omitempty"`
OpposeVotes
int32
`protobuf:"varint,3,opt,name=opposeVotes" json:"opposeVotes,omitempty"`
// 是否通过
// 是否通过
PubPass
bool
`protobuf:"varint,4,opt,name=pubPass,proto3" json:"pubPass,omitempty"`
PubPass
bool
`protobuf:"varint,4,opt,name=pubPass" json:"pubPass,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
}
func
(
m
*
PublicVote
)
Reset
()
{
*
m
=
PublicVote
{}
}
func
(
m
*
PublicVote
)
Reset
()
{
*
m
=
PublicVote
{}
}
func
(
m
*
PublicVote
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
PublicVote
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
PublicVote
)
ProtoMessage
()
{}
func
(
*
PublicVote
)
ProtoMessage
()
{}
func
(
*
PublicVote
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
PublicVote
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor2
,
[]
int
{
1
}
}
return
fileDescriptor_d916a933dd8220ff
,
[]
int
{
1
}
}
func
(
m
*
PublicVote
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_PublicVote
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
PublicVote
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_PublicVote
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
PublicVote
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_PublicVote
.
Merge
(
m
,
src
)
}
func
(
m
*
PublicVote
)
XXX_Size
()
int
{
return
xxx_messageInfo_PublicVote
.
Size
(
m
)
}
func
(
m
*
PublicVote
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_PublicVote
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_PublicVote
proto
.
InternalMessageInfo
func
(
m
*
PublicVote
)
GetPublicity
()
bool
{
func
(
m
*
PublicVote
)
GetPublicity
()
bool
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -156,36 +101,13 @@ func (m *PublicVote) GetPubPass() bool {
...
@@ -156,36 +101,13 @@ func (m *PublicVote) GetPubPass() bool {
}
}
type
VotesRecord
struct
{
type
VotesRecord
struct
{
Address
[]
string
`protobuf:"bytes,1,rep,name=address,proto3" json:"address,omitempty"`
Address
[]
string
`protobuf:"bytes,1,rep,name=address" json:"address,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
}
func
(
m
*
VotesRecord
)
Reset
()
{
*
m
=
VotesRecord
{}
}
func
(
m
*
VotesRecord
)
Reset
()
{
*
m
=
VotesRecord
{}
}
func
(
m
*
VotesRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
VotesRecord
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
VotesRecord
)
ProtoMessage
()
{}
func
(
*
VotesRecord
)
ProtoMessage
()
{}
func
(
*
VotesRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
VotesRecord
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor2
,
[]
int
{
2
}
}
return
fileDescriptor_d916a933dd8220ff
,
[]
int
{
2
}
}
func
(
m
*
VotesRecord
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_VotesRecord
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
VotesRecord
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_VotesRecord
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
VotesRecord
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_VotesRecord
.
Merge
(
m
,
src
)
}
func
(
m
*
VotesRecord
)
XXX_Size
()
int
{
return
xxx_messageInfo_VotesRecord
.
Size
(
m
)
}
func
(
m
*
VotesRecord
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_VotesRecord
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_VotesRecord
proto
.
InternalMessageInfo
func
(
m
*
VotesRecord
)
GetAddress
()
[]
string
{
func
(
m
*
VotesRecord
)
GetAddress
()
[]
string
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -196,46 +118,23 @@ func (m *VotesRecord) GetAddress() []string {
...
@@ -196,46 +118,23 @@ func (m *VotesRecord) GetAddress() []string {
type
RuleConfig
struct
{
type
RuleConfig
struct
{
// 董事会成员参与率,以%为单位,只保留整数部分
// 董事会成员参与率,以%为单位,只保留整数部分
BoardAttendRatio
int32
`protobuf:"varint,1,opt,name=boardAttendRatio
,proto3
" json:"boardAttendRatio,omitempty"`
BoardAttendRatio
int32
`protobuf:"varint,1,opt,name=boardAttendRatio" json:"boardAttendRatio,omitempty"`
// 董事会成员赞成率
// 董事会成员赞成率
BoardApproveRatio
int32
`protobuf:"varint,2,opt,name=boardApproveRatio
,proto3
" json:"boardApproveRatio,omitempty"`
BoardApproveRatio
int32
`protobuf:"varint,2,opt,name=boardApproveRatio" json:"boardApproveRatio,omitempty"`
// 全体持票人否决率
// 全体持票人否决率
PubOpposeRatio
int32
`protobuf:"varint,3,opt,name=pubOpposeRatio
,proto3
" json:"pubOpposeRatio,omitempty"`
PubOpposeRatio
int32
`protobuf:"varint,3,opt,name=pubOpposeRatio" json:"pubOpposeRatio,omitempty"`
// 提案金额
// 提案金额
ProposalAmount
int64
`protobuf:"varint,4,opt,name=proposalAmount
,proto3
" json:"proposalAmount,omitempty"`
ProposalAmount
int64
`protobuf:"varint,4,opt,name=proposalAmount" json:"proposalAmount,omitempty"`
// 重大项目公示金额阈值
// 重大项目公示金额阈值
LargeProjectAmount
int64
`protobuf:"varint,5,opt,name=largeProjectAmount
,proto3
" json:"largeProjectAmount,omitempty"`
LargeProjectAmount
int64
`protobuf:"varint,5,opt,name=largeProjectAmount" json:"largeProjectAmount,omitempty"`
// 重大项目公示时间(以区块数为单位)
// 重大项目公示时间(以区块数为单位)
PublicPeriod
int32
`protobuf:"varint,6,opt,name=publicPeriod,proto3" json:"publicPeriod,omitempty"`
PublicPeriod
int32
`protobuf:"varint,6,opt,name=publicPeriod" json:"publicPeriod,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
}
func
(
m
*
RuleConfig
)
Reset
()
{
*
m
=
RuleConfig
{}
}
func
(
m
*
RuleConfig
)
Reset
()
{
*
m
=
RuleConfig
{}
}
func
(
m
*
RuleConfig
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
m
*
RuleConfig
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
RuleConfig
)
ProtoMessage
()
{}
func
(
*
RuleConfig
)
ProtoMessage
()
{}
func
(
*
RuleConfig
)
Descriptor
()
([]
byte
,
[]
int
)
{
func
(
*
RuleConfig
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor2
,
[]
int
{
3
}
}
return
fileDescriptor_d916a933dd8220ff
,
[]
int
{
3
}
}
func
(
m
*
RuleConfig
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_RuleConfig
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
RuleConfig
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_RuleConfig
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
RuleConfig
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_RuleConfig
.
Merge
(
m
,
src
)
}
func
(
m
*
RuleConfig
)
XXX_Size
()
int
{
return
xxx_messageInfo_RuleConfig
.
Size
(
m
)
}
func
(
m
*
RuleConfig
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_RuleConfig
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_RuleConfig
proto
.
InternalMessageInfo
func
(
m
*
RuleConfig
)
GetBoardAttendRatio
()
int32
{
func
(
m
*
RuleConfig
)
GetBoardAttendRatio
()
int32
{
if
m
!=
nil
{
if
m
!=
nil
{
...
@@ -286,9 +185,9 @@ func init() {
...
@@ -286,9 +185,9 @@ func init() {
proto
.
RegisterType
((
*
RuleConfig
)(
nil
),
"types.RuleConfig"
)
proto
.
RegisterType
((
*
RuleConfig
)(
nil
),
"types.RuleConfig"
)
}
}
func
init
()
{
proto
.
RegisterFile
(
"lcommon.proto"
,
fileDescriptor
_d916a933dd8220ff
)
}
func
init
()
{
proto
.
RegisterFile
(
"lcommon.proto"
,
fileDescriptor
2
)
}
var
fileDescriptor
_d916a933dd8220ff
=
[]
byte
{
var
fileDescriptor
2
=
[]
byte
{
// 314 bytes of a gzipped FileDescriptorProto
// 314 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x84
,
0x92
,
0x3d
,
0x4e
,
0xf3
,
0x40
,
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0x84
,
0x92
,
0x3d
,
0x4e
,
0xf3
,
0x40
,
0x10
,
0x86
,
0xe5
,
0xfc
,
0x7d
,
0xc9
,
0xe4
,
0x03
,
0xc1
,
0x54
,
0x2e
,
0x10
,
0x8a
,
0x5c
,
0x40
,
0x84
,
0x10
,
0x86
,
0xe5
,
0xfc
,
0x7d
,
0xc9
,
0xe4
,
0x03
,
0xc1
,
0x54
,
0x2e
,
0x10
,
0x8a
,
0x5c
,
0x40
,
0x84
,
...
...
plugin/dapp/autonomy/types/project.pb.go
View file @
af4f3531
This diff is collapsed.
Click to expand it.
plugin/dapp/autonomy/types/rule.pb.go
View file @
af4f3531
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