-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathbprpc.go
More file actions
189 lines (160 loc) · 4.89 KB
/
bprpc.go
File metadata and controls
189 lines (160 loc) · 4.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*
* Copyright 2018 The CovenantSQL Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package types
import (
"github.com/CovenantSQL/CovenantSQL/blockproducer/interfaces"
pi "github.com/CovenantSQL/CovenantSQL/blockproducer/interfaces"
"github.com/CovenantSQL/CovenantSQL/crypto/hash"
"github.com/CovenantSQL/CovenantSQL/proto"
)
// AdviseNewBlockReq defines a request of the AdviseNewBlock RPC method.
type AdviseNewBlockReq struct {
proto.Envelope
Block *BPBlock
}
// AdviseNewBlockResp defines a response of the AdviseNewBlock RPC method.
type AdviseNewBlockResp struct {
proto.Envelope
}
// FetchBlockReq defines a request of the FetchBlock RPC method.
type FetchBlockReq struct {
proto.Envelope
Height uint32
}
// FetchBlockResp defines a response of the FetchBlock RPC method.
type FetchBlockResp struct {
proto.Envelope
Height uint32
Count uint32
Block *BPBlock
}
// FetchLastIrreversibleBlockReq defines a request of the FetchLastIrreversibleBlock RPC method.
type FetchLastIrreversibleBlockReq struct {
proto.Envelope
Address proto.AccountAddress
}
// FetchLastIrreversibleBlockResp defines a response of the FetchLastIrreversibleBlock RPC method.
type FetchLastIrreversibleBlockResp struct {
proto.Envelope
Count uint32
Height uint32
Block *BPBlock
SQLChains []*SQLChainProfile
}
// FetchBlockByCountReq define a request of the FetchBlockByCount RPC method.
type FetchBlockByCountReq struct {
proto.Envelope
Count uint32
}
// FetchTxBillingReq defines a request of the FetchTxBilling RPC method.
type FetchTxBillingReq struct {
proto.Envelope
}
// FetchTxBillingResp defines a response of the FetchTxBilling RPC method.
type FetchTxBillingResp struct {
proto.Envelope
}
// NextAccountNonceReq defines a request of the NextAccountNonce RPC method.
type NextAccountNonceReq struct {
proto.Envelope
Addr proto.AccountAddress
}
// NextAccountNonceResp defines a response of the NextAccountNonce RPC method.
type NextAccountNonceResp struct {
proto.Envelope
Addr proto.AccountAddress
Nonce interfaces.AccountNonce
}
// AddTxReq defines a request of the AddTx RPC method.
type AddTxReq struct {
proto.Envelope
TTL uint32 // defines the broadcast TTL on BP network.
Tx interfaces.Transaction
}
// AddTxResp defines a response of the AddTx RPC method.
type AddTxResp struct {
proto.Envelope
}
// SubReq defines a request of the Sub RPC method.
type SubReq struct {
proto.Envelope
Topic string
Callback string
}
// SubResp defines a response of the Sub RPC method.
type SubResp struct {
proto.Envelope
Result string
}
// OrderMakerReq defines a request of the order maker in database market.
type OrderMakerReq struct {
proto.Envelope
}
// OrderTakerReq defines a request of the order taker in database market.
type OrderTakerReq struct {
proto.Envelope
DBMeta ResourceMeta
}
// OrderTakerResp defines a response of the order taker in database market.
type OrderTakerResp struct {
proto.Envelope
databaseID proto.DatabaseID
}
// QueryAccountTokenBalanceReq defines a request of the QueryAccountTokenBalance RPC method.
type QueryAccountTokenBalanceReq struct {
proto.Envelope
Addr proto.AccountAddress
TokenType TokenType
}
// QueryAccountTokenBalanceResp defines a request of the QueryAccountTokenBalance RPC method.
type QueryAccountTokenBalanceResp struct {
proto.Envelope
Addr proto.AccountAddress
OK bool
Balance uint64
}
// QuerySQLChainProfileReq defines a request of the QuerySQLChainProfile RPC method.
type QuerySQLChainProfileReq struct {
proto.Envelope
DBID proto.DatabaseID
}
// QuerySQLChainProfileResp defines a response of the QuerySQLChainProfile RPC method.
type QuerySQLChainProfileResp struct {
proto.Envelope
Profile SQLChainProfile
}
// QueryTxStateReq defines a request of the QueryTxState RPC method.
type QueryTxStateReq struct {
proto.Envelope
Hash hash.Hash
}
// QueryTxStateResp defines a response of the QueryTxState RPC method.
type QueryTxStateResp struct {
proto.Envelope
Hash hash.Hash
State pi.TransactionState
}
// QueryAccountSQLChainProfilesReq defines a request of QueryAccountSQLChainProfiles RPC method.
type QueryAccountSQLChainProfilesReq struct {
proto.Envelope
Addr proto.AccountAddress
}
// QueryAccountSQLChainProfilesResp defines a response of QueryAccountSQLChainProfiles RPC method.
type QueryAccountSQLChainProfilesResp struct {
proto.Envelope
Addr proto.AccountAddress
Profiles []*SQLChainProfile
}