-
Notifications
You must be signed in to change notification settings - Fork 43
/
block.go
257 lines (223 loc) · 5.81 KB
/
block.go
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
// Auto-generated to Go types using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
// Input file: ../client/protocol/avdl/keybase1/block.avdl
package keybase1
import (
"fmt"
)
type BlockStatus int
const (
BlockStatus_UNKNOWN BlockStatus = 0
BlockStatus_LIVE BlockStatus = 1
BlockStatus_ARCHIVED BlockStatus = 2
)
func (o BlockStatus) DeepCopy() BlockStatus { return o }
var BlockStatusMap = map[string]BlockStatus{
"UNKNOWN": 0,
"LIVE": 1,
"ARCHIVED": 2,
}
var BlockStatusRevMap = map[BlockStatus]string{
0: "UNKNOWN",
1: "LIVE",
2: "ARCHIVED",
}
func (e BlockStatus) String() string {
if v, ok := BlockStatusRevMap[e]; ok {
return v
}
return fmt.Sprintf("%v", int(e))
}
type GetBlockRes struct {
BlockKey string `codec:"blockKey" json:"blockKey"`
Buf []byte `codec:"buf" json:"buf"`
Size int `codec:"size" json:"size"`
Status BlockStatus `codec:"status" json:"status"`
}
func (o GetBlockRes) DeepCopy() GetBlockRes {
return GetBlockRes{
BlockKey: o.BlockKey,
Buf: (func(x []byte) []byte {
if x == nil {
return nil
}
return append([]byte{}, x...)
})(o.Buf),
Size: o.Size,
Status: o.Status.DeepCopy(),
}
}
type GetBlockSizesRes struct {
Sizes []int `codec:"sizes" json:"sizes"`
Statuses []BlockStatus `codec:"statuses" json:"statuses"`
}
func (o GetBlockSizesRes) DeepCopy() GetBlockSizesRes {
return GetBlockSizesRes{
Sizes: (func(x []int) []int {
if x == nil {
return nil
}
ret := make([]int, len(x))
for i, v := range x {
vCopy := v
ret[i] = vCopy
}
return ret
})(o.Sizes),
Statuses: (func(x []BlockStatus) []BlockStatus {
if x == nil {
return nil
}
ret := make([]BlockStatus, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Statuses),
}
}
type BlockRefNonce [8]byte
func (o BlockRefNonce) DeepCopy() BlockRefNonce {
var ret BlockRefNonce
copy(ret[:], o[:])
return ret
}
type BlockReference struct {
Bid BlockIdCombo `codec:"bid" json:"bid"`
Nonce BlockRefNonce `codec:"nonce" json:"nonce"`
ChargedTo UserOrTeamID `codec:"chargedTo" json:"chargedTo"`
}
func (o BlockReference) DeepCopy() BlockReference {
return BlockReference{
Bid: o.Bid.DeepCopy(),
Nonce: o.Nonce.DeepCopy(),
ChargedTo: o.ChargedTo.DeepCopy(),
}
}
type BlockReferenceCount struct {
Ref BlockReference `codec:"ref" json:"ref"`
LiveCount int `codec:"liveCount" json:"liveCount"`
}
func (o BlockReferenceCount) DeepCopy() BlockReferenceCount {
return BlockReferenceCount{
Ref: o.Ref.DeepCopy(),
LiveCount: o.LiveCount,
}
}
type DowngradeReferenceRes struct {
Completed []BlockReferenceCount `codec:"completed" json:"completed"`
Failed BlockReference `codec:"failed" json:"failed"`
}
func (o DowngradeReferenceRes) DeepCopy() DowngradeReferenceRes {
return DowngradeReferenceRes{
Completed: (func(x []BlockReferenceCount) []BlockReferenceCount {
if x == nil {
return nil
}
ret := make([]BlockReferenceCount, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Completed),
Failed: o.Failed.DeepCopy(),
}
}
type BlockIdCount struct {
Id BlockIdCombo `codec:"id" json:"id"`
LiveCount int `codec:"liveCount" json:"liveCount"`
}
func (o BlockIdCount) DeepCopy() BlockIdCount {
return BlockIdCount{
Id: o.Id.DeepCopy(),
LiveCount: o.LiveCount,
}
}
type ReferenceCountRes struct {
Counts []BlockIdCount `codec:"counts" json:"counts"`
}
func (o ReferenceCountRes) DeepCopy() ReferenceCountRes {
return ReferenceCountRes{
Counts: (func(x []BlockIdCount) []BlockIdCount {
if x == nil {
return nil
}
ret := make([]BlockIdCount, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Counts),
}
}
type BlockPingResponse struct {
}
func (o BlockPingResponse) DeepCopy() BlockPingResponse {
return BlockPingResponse{}
}
type UsageStatRecord struct {
Write int64 `codec:"write" json:"write"`
Archive int64 `codec:"archive" json:"archive"`
Read int64 `codec:"read" json:"read"`
MdWrite int64 `codec:"mdWrite" json:"mdWrite"`
GitWrite int64 `codec:"gitWrite" json:"gitWrite"`
GitArchive int64 `codec:"gitArchive" json:"gitArchive"`
}
func (o UsageStatRecord) DeepCopy() UsageStatRecord {
return UsageStatRecord{
Write: o.Write,
Archive: o.Archive,
Read: o.Read,
MdWrite: o.MdWrite,
GitWrite: o.GitWrite,
GitArchive: o.GitArchive,
}
}
type UsageStat struct {
Bytes UsageStatRecord `codec:"bytes" json:"bytes"`
Blocks UsageStatRecord `codec:"blocks" json:"blocks"`
Mtime Time `codec:"mtime" json:"mtime"`
}
func (o UsageStat) DeepCopy() UsageStat {
return UsageStat{
Bytes: o.Bytes.DeepCopy(),
Blocks: o.Blocks.DeepCopy(),
Mtime: o.Mtime.DeepCopy(),
}
}
type FolderUsageStat struct {
FolderID string `codec:"folderID" json:"folderID"`
Stats UsageStat `codec:"stats" json:"stats"`
}
func (o FolderUsageStat) DeepCopy() FolderUsageStat {
return FolderUsageStat{
FolderID: o.FolderID,
Stats: o.Stats.DeepCopy(),
}
}
type BlockQuotaInfo struct {
Folders []FolderUsageStat `codec:"folders" json:"folders"`
Total UsageStat `codec:"total" json:"total"`
Limit int64 `codec:"limit" json:"limit"`
GitLimit int64 `codec:"gitLimit" json:"gitLimit"`
}
func (o BlockQuotaInfo) DeepCopy() BlockQuotaInfo {
return BlockQuotaInfo{
Folders: (func(x []FolderUsageStat) []FolderUsageStat {
if x == nil {
return nil
}
ret := make([]FolderUsageStat, len(x))
for i, v := range x {
vCopy := v.DeepCopy()
ret[i] = vCopy
}
return ret
})(o.Folders),
Total: o.Total.DeepCopy(),
Limit: o.Limit,
GitLimit: o.GitLimit,
}
}