-
Notifications
You must be signed in to change notification settings - Fork 6
/
server.vdl.go
373 lines (347 loc) · 8.47 KB
/
server.vdl.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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file was auto-generated by the vanadium vdl tool.
// Package: server
package server
import (
"v.io/v23/security/access"
"v.io/v23/services/syncbase"
"v.io/v23/vdl"
)
var _ = __VDLInit() // Must be first; see __VDLInit comments for details.
//////////////////////////////////////////////////
// Type definitions
// ServiceData represents the persistent state of a Service.
type ServiceData struct {
Version uint64 // covers the fields below
Perms access.Permissions
}
func (ServiceData) VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/syncbase/server.ServiceData"`
}) {
}
func (x ServiceData) VDLIsZero() bool {
if x.Version != 0 {
return false
}
if len(x.Perms) != 0 {
return false
}
return true
}
func (x ServiceData) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(__VDLType_struct_1); err != nil {
return err
}
if x.Version != 0 {
if err := enc.NextFieldValueUint(0, vdl.Uint64Type, x.Version); err != nil {
return err
}
}
if len(x.Perms) != 0 {
if err := enc.NextField(1); err != nil {
return err
}
if err := x.Perms.VDLWrite(enc); err != nil {
return err
}
}
if err := enc.NextField(-1); err != nil {
return err
}
return enc.FinishValue()
}
func (x *ServiceData) VDLRead(dec vdl.Decoder) error {
*x = ServiceData{}
if err := dec.StartValue(__VDLType_struct_1); err != nil {
return err
}
decType := dec.Type()
for {
index, err := dec.NextField()
switch {
case err != nil:
return err
case index == -1:
return dec.FinishValue()
}
if decType != __VDLType_struct_1 {
index = __VDLType_struct_1.FieldIndexByName(decType.Field(index).Name)
if index == -1 {
if err := dec.SkipValue(); err != nil {
return err
}
continue
}
}
switch index {
case 0:
switch value, err := dec.ReadValueUint(64); {
case err != nil:
return err
default:
x.Version = value
}
case 1:
if err := x.Perms.VDLRead(dec); err != nil {
return err
}
}
}
}
// DbInfo contains information about a single Database, stored in the
// service-level storage engine.
type DbInfo struct {
Id syncbase.Id
// Select fields from DatabaseOptions, needed in order to open storage engine
// on restart.
RootDir string // interpreted by storage engine
Engine string // name of storage engine, e.g. "leveldb"
}
func (DbInfo) VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/syncbase/server.DbInfo"`
}) {
}
func (x DbInfo) VDLIsZero() bool {
return x == DbInfo{}
}
func (x DbInfo) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(__VDLType_struct_3); err != nil {
return err
}
if x.Id != (syncbase.Id{}) {
if err := enc.NextField(0); err != nil {
return err
}
if err := x.Id.VDLWrite(enc); err != nil {
return err
}
}
if x.RootDir != "" {
if err := enc.NextFieldValueString(1, vdl.StringType, x.RootDir); err != nil {
return err
}
}
if x.Engine != "" {
if err := enc.NextFieldValueString(2, vdl.StringType, x.Engine); err != nil {
return err
}
}
if err := enc.NextField(-1); err != nil {
return err
}
return enc.FinishValue()
}
func (x *DbInfo) VDLRead(dec vdl.Decoder) error {
*x = DbInfo{}
if err := dec.StartValue(__VDLType_struct_3); err != nil {
return err
}
decType := dec.Type()
for {
index, err := dec.NextField()
switch {
case err != nil:
return err
case index == -1:
return dec.FinishValue()
}
if decType != __VDLType_struct_3 {
index = __VDLType_struct_3.FieldIndexByName(decType.Field(index).Name)
if index == -1 {
if err := dec.SkipValue(); err != nil {
return err
}
continue
}
}
switch index {
case 0:
if err := x.Id.VDLRead(dec); err != nil {
return err
}
case 1:
switch value, err := dec.ReadValueString(); {
case err != nil:
return err
default:
x.RootDir = value
}
case 2:
switch value, err := dec.ReadValueString(); {
case err != nil:
return err
default:
x.Engine = value
}
}
}
}
// DatabaseData represents the persistent state of a Database, stored in the
// per-database storage engine.
type DatabaseData struct {
Id syncbase.Id
Version uint64 // covers the Perms field below
Perms access.Permissions
SchemaMetadata *syncbase.SchemaMetadata
}
func (DatabaseData) VDLReflect(struct {
Name string `vdl:"v.io/x/ref/services/syncbase/server.DatabaseData"`
}) {
}
func (x DatabaseData) VDLIsZero() bool {
if x.Id != (syncbase.Id{}) {
return false
}
if x.Version != 0 {
return false
}
if len(x.Perms) != 0 {
return false
}
if x.SchemaMetadata != nil {
return false
}
return true
}
func (x DatabaseData) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(__VDLType_struct_5); err != nil {
return err
}
if x.Id != (syncbase.Id{}) {
if err := enc.NextField(0); err != nil {
return err
}
if err := x.Id.VDLWrite(enc); err != nil {
return err
}
}
if x.Version != 0 {
if err := enc.NextFieldValueUint(1, vdl.Uint64Type, x.Version); err != nil {
return err
}
}
if len(x.Perms) != 0 {
if err := enc.NextField(2); err != nil {
return err
}
if err := x.Perms.VDLWrite(enc); err != nil {
return err
}
}
if x.SchemaMetadata != nil {
if err := enc.NextField(3); err != nil {
return err
}
enc.SetNextStartValueIsOptional()
if err := x.SchemaMetadata.VDLWrite(enc); err != nil {
return err
}
}
if err := enc.NextField(-1); err != nil {
return err
}
return enc.FinishValue()
}
func (x *DatabaseData) VDLRead(dec vdl.Decoder) error {
*x = DatabaseData{}
if err := dec.StartValue(__VDLType_struct_5); err != nil {
return err
}
decType := dec.Type()
for {
index, err := dec.NextField()
switch {
case err != nil:
return err
case index == -1:
return dec.FinishValue()
}
if decType != __VDLType_struct_5 {
index = __VDLType_struct_5.FieldIndexByName(decType.Field(index).Name)
if index == -1 {
if err := dec.SkipValue(); err != nil {
return err
}
continue
}
}
switch index {
case 0:
if err := x.Id.VDLRead(dec); err != nil {
return err
}
case 1:
switch value, err := dec.ReadValueUint(64); {
case err != nil:
return err
default:
x.Version = value
}
case 2:
if err := x.Perms.VDLRead(dec); err != nil {
return err
}
case 3:
if err := dec.StartValue(__VDLType_optional_6); err != nil {
return err
}
if dec.IsNil() {
x.SchemaMetadata = nil
if err := dec.FinishValue(); err != nil {
return err
}
} else {
x.SchemaMetadata = new(syncbase.SchemaMetadata)
dec.IgnoreNextStartValue()
if err := x.SchemaMetadata.VDLRead(dec); err != nil {
return err
}
}
}
}
}
// Hold type definitions in package-level variables, for better performance.
var (
__VDLType_struct_1 *vdl.Type
__VDLType_map_2 *vdl.Type
__VDLType_struct_3 *vdl.Type
__VDLType_struct_4 *vdl.Type
__VDLType_struct_5 *vdl.Type
__VDLType_optional_6 *vdl.Type
__VDLType_struct_7 *vdl.Type
)
var __VDLInitCalled bool
// __VDLInit performs vdl initialization. It is safe to call multiple times.
// If you have an init ordering issue, just insert the following line verbatim
// into your source files in this package, right after the "package foo" clause:
//
// var _ = __VDLInit()
//
// The purpose of this function is to ensure that vdl initialization occurs in
// the right order, and very early in the init sequence. In particular, vdl
// registration and package variable initialization needs to occur before
// functions like vdl.TypeOf will work properly.
//
// This function returns a dummy value, so that it can be used to initialize the
// first var in the file, to take advantage of Go's defined init order.
func __VDLInit() struct{} {
if __VDLInitCalled {
return struct{}{}
}
__VDLInitCalled = true
// Register types.
vdl.Register((*ServiceData)(nil))
vdl.Register((*DbInfo)(nil))
vdl.Register((*DatabaseData)(nil))
// Initialize type definitions.
__VDLType_struct_1 = vdl.TypeOf((*ServiceData)(nil)).Elem()
__VDLType_map_2 = vdl.TypeOf((*access.Permissions)(nil))
__VDLType_struct_3 = vdl.TypeOf((*DbInfo)(nil)).Elem()
__VDLType_struct_4 = vdl.TypeOf((*syncbase.Id)(nil)).Elem()
__VDLType_struct_5 = vdl.TypeOf((*DatabaseData)(nil)).Elem()
__VDLType_optional_6 = vdl.TypeOf((*syncbase.SchemaMetadata)(nil))
__VDLType_struct_7 = vdl.TypeOf((*syncbase.SchemaMetadata)(nil)).Elem()
return struct{}{}
}