-
Notifications
You must be signed in to change notification settings - Fork 1
/
worker.capnp.go
382 lines (311 loc) · 12.3 KB
/
worker.capnp.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
374
375
376
377
378
379
380
381
382
// Code generated by capnpc-go. DO NOT EDIT.
package worker
import (
capnp "capnproto.org/go/capnp/v3"
text "capnproto.org/go/capnp/v3/encoding/text"
fc "capnproto.org/go/capnp/v3/flowcontrol"
schemas "capnproto.org/go/capnp/v3/schemas"
server "capnproto.org/go/capnp/v3/server"
context "context"
)
type Worker capnp.Client
// Worker_TypeID is the unique identifier for the type Worker.
const Worker_TypeID = 0xc4ef214b3fa3e0f9
func (c Worker) Assign(ctx context.Context, params func(Worker_assign_Params) error) (Worker_assign_Results_Future, capnp.ReleaseFunc) {
s := capnp.Send{
Method: capnp.Method{
InterfaceID: 0xc4ef214b3fa3e0f9,
MethodID: 0,
InterfaceName: "worker.capnp:Worker",
MethodName: "assign",
},
}
if params != nil {
s.ArgsSize = capnp.ObjectSize{DataSize: 16, PointerCount: 1}
s.PlaceArgs = func(s capnp.Struct) error { return params(Worker_assign_Params(s)) }
}
ans, release := capnp.Client(c).SendCall(ctx, s)
return Worker_assign_Results_Future{Future: ans.Future()}, release
}
func (c Worker) WaitStreaming() error {
return capnp.Client(c).WaitStreaming()
}
// String returns a string that identifies this capability for debugging
// purposes. Its format should not be depended on: in particular, it
// should not be used to compare clients. Use IsSame to compare clients
// for equality.
func (c Worker) String() string {
return "Worker(" + capnp.Client(c).String() + ")"
}
// AddRef creates a new Client that refers to the same capability as c.
// If c is nil or has resolved to null, then AddRef returns nil.
func (c Worker) AddRef() Worker {
return Worker(capnp.Client(c).AddRef())
}
// Release releases a capability reference. If this is the last
// reference to the capability, then the underlying resources associated
// with the capability will be released.
//
// Release will panic if c has already been released, but not if c is
// nil or resolved to null.
func (c Worker) Release() {
capnp.Client(c).Release()
}
// Resolve blocks until the capability is fully resolved or the Context
// expires.
func (c Worker) Resolve(ctx context.Context) error {
return capnp.Client(c).Resolve(ctx)
}
func (c Worker) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
return capnp.Client(c).EncodeAsPtr(seg)
}
func (Worker) DecodeFromPtr(p capnp.Ptr) Worker {
return Worker(capnp.Client{}.DecodeFromPtr(p))
}
// IsValid reports whether c is a valid reference to a capability.
// A reference is invalid if it is nil, has resolved to null, or has
// been released.
func (c Worker) IsValid() bool {
return capnp.Client(c).IsValid()
}
// IsSame reports whether c and other refer to a capability created by the
// same call to NewClient. This can return false negatives if c or other
// are not fully resolved: use Resolve if this is an issue. If either
// c or other are released, then IsSame panics.
func (c Worker) IsSame(other Worker) bool {
return capnp.Client(c).IsSame(capnp.Client(other))
}
// Update the flowcontrol.FlowLimiter used to manage flow control for
// this client. This affects all future calls, but not calls already
// waiting to send. Passing nil sets the value to flowcontrol.NopLimiter,
// which is also the default.
func (c Worker) SetFlowLimiter(lim fc.FlowLimiter) {
capnp.Client(c).SetFlowLimiter(lim)
}
// Get the current flowcontrol.FlowLimiter used to manage flow control
// for this client.
func (c Worker) GetFlowLimiter() fc.FlowLimiter {
return capnp.Client(c).GetFlowLimiter()
}
// A Worker_Server is a Worker with a local implementation.
type Worker_Server interface {
Assign(context.Context, Worker_assign) error
}
// Worker_NewServer creates a new Server from an implementation of Worker_Server.
func Worker_NewServer(s Worker_Server) *server.Server {
c, _ := s.(server.Shutdowner)
return server.New(Worker_Methods(nil, s), s, c)
}
// Worker_ServerToClient creates a new Client from an implementation of Worker_Server.
// The caller is responsible for calling Release on the returned Client.
func Worker_ServerToClient(s Worker_Server) Worker {
return Worker(capnp.NewClient(Worker_NewServer(s)))
}
// Worker_Methods appends Methods to a slice that invoke the methods on s.
// This can be used to create a more complicated Server.
func Worker_Methods(methods []server.Method, s Worker_Server) []server.Method {
if cap(methods) == 0 {
methods = make([]server.Method, 0, 1)
}
methods = append(methods, server.Method{
Method: capnp.Method{
InterfaceID: 0xc4ef214b3fa3e0f9,
MethodID: 0,
InterfaceName: "worker.capnp:Worker",
MethodName: "assign",
},
Impl: func(ctx context.Context, call *server.Call) error {
return s.Assign(ctx, Worker_assign{call})
},
})
return methods
}
// Worker_assign holds the state for a server call to Worker.assign.
// See server.Call for documentation.
type Worker_assign struct {
*server.Call
}
// Args returns the call's arguments.
func (c Worker_assign) Args() Worker_assign_Params {
return Worker_assign_Params(c.Call.Args())
}
// AllocResults allocates the results struct.
func (c Worker_assign) AllocResults() (Worker_assign_Results, error) {
r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1})
return Worker_assign_Results(r), err
}
// Worker_List is a list of Worker.
type Worker_List = capnp.CapList[Worker]
// NewWorker creates a new list of Worker.
func NewWorker_List(s *capnp.Segment, sz int32) (Worker_List, error) {
l, err := capnp.NewPointerList(s, sz)
return capnp.CapList[Worker](l), err
}
type Worker_assign_Params capnp.Struct
// Worker_assign_Params_TypeID is the unique identifier for the type Worker_assign_Params.
const Worker_assign_Params_TypeID = 0x8612f7506f622fbd
func NewWorker_assign_Params(s *capnp.Segment) (Worker_assign_Params, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 1})
return Worker_assign_Params(st), err
}
func NewRootWorker_assign_Params(s *capnp.Segment) (Worker_assign_Params, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 1})
return Worker_assign_Params(st), err
}
func ReadRootWorker_assign_Params(msg *capnp.Message) (Worker_assign_Params, error) {
root, err := msg.Root()
return Worker_assign_Params(root.Struct()), err
}
func (s Worker_assign_Params) String() string {
str, _ := text.Marshal(0x8612f7506f622fbd, capnp.Struct(s))
return str
}
func (s Worker_assign_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
return capnp.Struct(s).EncodeAsPtr(seg)
}
func (Worker_assign_Params) DecodeFromPtr(p capnp.Ptr) Worker_assign_Params {
return Worker_assign_Params(capnp.Struct{}.DecodeFromPtr(p))
}
func (s Worker_assign_Params) ToPtr() capnp.Ptr {
return capnp.Struct(s).ToPtr()
}
func (s Worker_assign_Params) IsValid() bool {
return capnp.Struct(s).IsValid()
}
func (s Worker_assign_Params) Message() *capnp.Message {
return capnp.Struct(s).Message()
}
func (s Worker_assign_Params) Segment() *capnp.Segment {
return capnp.Struct(s).Segment()
}
func (s Worker_assign_Params) Wasm() ([]byte, error) {
p, err := capnp.Struct(s).Ptr(0)
return []byte(p.Data()), err
}
func (s Worker_assign_Params) HasWasm() bool {
return capnp.Struct(s).HasPtr(0)
}
func (s Worker_assign_Params) SetWasm(v []byte) error {
return capnp.Struct(s).SetData(0, v)
}
func (s Worker_assign_Params) Input() int64 {
return int64(capnp.Struct(s).Uint64(0))
}
func (s Worker_assign_Params) SetInput(v int64) {
capnp.Struct(s).SetUint64(0, uint64(v))
}
func (s Worker_assign_Params) Difficulty() int64 {
return int64(capnp.Struct(s).Uint64(8))
}
func (s Worker_assign_Params) SetDifficulty(v int64) {
capnp.Struct(s).SetUint64(8, uint64(v))
}
// Worker_assign_Params_List is a list of Worker_assign_Params.
type Worker_assign_Params_List = capnp.StructList[Worker_assign_Params]
// NewWorker_assign_Params creates a new list of Worker_assign_Params.
func NewWorker_assign_Params_List(s *capnp.Segment, sz int32) (Worker_assign_Params_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 1}, sz)
return capnp.StructList[Worker_assign_Params](l), err
}
// Worker_assign_Params_Future is a wrapper for a Worker_assign_Params promised by a client call.
type Worker_assign_Params_Future struct{ *capnp.Future }
func (f Worker_assign_Params_Future) Struct() (Worker_assign_Params, error) {
p, err := f.Future.Ptr()
return Worker_assign_Params(p.Struct()), err
}
type Worker_assign_Results capnp.Struct
// Worker_assign_Results_TypeID is the unique identifier for the type Worker_assign_Results.
const Worker_assign_Results_TypeID = 0xb2ad9e8e7b416561
func NewWorker_assign_Results(s *capnp.Segment) (Worker_assign_Results, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
return Worker_assign_Results(st), err
}
func NewRootWorker_assign_Results(s *capnp.Segment) (Worker_assign_Results, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
return Worker_assign_Results(st), err
}
func ReadRootWorker_assign_Results(msg *capnp.Message) (Worker_assign_Results, error) {
root, err := msg.Root()
return Worker_assign_Results(root.Struct()), err
}
func (s Worker_assign_Results) String() string {
str, _ := text.Marshal(0xb2ad9e8e7b416561, capnp.Struct(s))
return str
}
func (s Worker_assign_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
return capnp.Struct(s).EncodeAsPtr(seg)
}
func (Worker_assign_Results) DecodeFromPtr(p capnp.Ptr) Worker_assign_Results {
return Worker_assign_Results(capnp.Struct{}.DecodeFromPtr(p))
}
func (s Worker_assign_Results) ToPtr() capnp.Ptr {
return capnp.Struct(s).ToPtr()
}
func (s Worker_assign_Results) IsValid() bool {
return capnp.Struct(s).IsValid()
}
func (s Worker_assign_Results) Message() *capnp.Message {
return capnp.Struct(s).Message()
}
func (s Worker_assign_Results) Segment() *capnp.Segment {
return capnp.Struct(s).Segment()
}
func (s Worker_assign_Results) Result() (string, error) {
p, err := capnp.Struct(s).Ptr(0)
return p.Text(), err
}
func (s Worker_assign_Results) HasResult() bool {
return capnp.Struct(s).HasPtr(0)
}
func (s Worker_assign_Results) ResultBytes() ([]byte, error) {
p, err := capnp.Struct(s).Ptr(0)
return p.TextBytes(), err
}
func (s Worker_assign_Results) SetResult(v string) error {
return capnp.Struct(s).SetText(0, v)
}
// Worker_assign_Results_List is a list of Worker_assign_Results.
type Worker_assign_Results_List = capnp.StructList[Worker_assign_Results]
// NewWorker_assign_Results creates a new list of Worker_assign_Results.
func NewWorker_assign_Results_List(s *capnp.Segment, sz int32) (Worker_assign_Results_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)
return capnp.StructList[Worker_assign_Results](l), err
}
// Worker_assign_Results_Future is a wrapper for a Worker_assign_Results promised by a client call.
type Worker_assign_Results_Future struct{ *capnp.Future }
func (f Worker_assign_Results_Future) Struct() (Worker_assign_Results, error) {
p, err := f.Future.Ptr()
return Worker_assign_Results(p.Struct()), err
}
const schema_95c0f3edf8dd266c = "x\xda|\x90\xbfK\xe4@\x1c\xc5\xdf\x9bI.Wl" +
"\xb8\x9bM\xae9\xee8\x0e\xee,D\x14\xb5\xdb&+" +
"(\"\xae\x90\xb1Q\xec\xe2\x9a\x95\xb0?I\xb2,b" +
"oigk\xa1\xad\"\xd8\x0b\x0a6\xfe\x11\x82\xad\xc5" +
"\"b\xa1V\x91\xb8\xecbe9o>\xbc\xef\x87\xf7" +
"\xfd\xa4lL\xdbm\x01\xa1\x7f\x99_\xb2\x8b\xa9\xcd\xb6" +
"\xff\\\xdc\x83v)\x00\x93\x160\xfb\x9bE\x82\xce\x7f" +
"\x9e\x81Y\x10\xce\xed\xee\x1f\x9e\x9eC\xb9\x1c\x02W\xfc" +
"\x99\x037\xf4\xc0\xec\xf5\xee\xd8[\xfe\xfbp\x0de\xcb" +
"\xac1v\xfb\xd2\x7f\xba<\x00\xe8\xdc\xf3\xc8y\xccy" +
"\xa7\xcfE\xe7\x87\xb00\x91\xf5\xdaq=\x8c'\xab2" +
"\xe8\xb4:\xa5\xb5\xc1+H\x92h\xbb\xf5\xcf\x0f\xe2\xa0" +
"\xc9D\x17\xa4\x01\x18\x04\xd4\xc28\xa0\xcb\x92\xba\"H" +
"\xba\xcc\xb3\xa5\x19@\xcfKj_P\x09\xbek\xab\x95" +
"\x0d@W$\xf5\xba\xe0\xb7^\x904iC\xd0\x06\xff" +
"D\xadN7\xa5\x09A\x13\xcc\xb6\xa2Z-\xaav\x1b" +
"\x90\xe9\xce(\xfc\xcci5L\xba\x0d\x99&\xda\x18I" +
"\xd9%@\x7f\x95\xd4\xae\xa0\x17\xe7\xff)\x0b\x10,|" +
"\xa8\xe2\xb0\xca\xaa\x87\xb1OjC\x9a\xc0hm\x0eG" +
"U\xaa\x04\xa1L\xcb\x1b\x9c+\xd3'\xdf\x02\x00\x00\xff" +
"\xffWUf\xf2"
func RegisterSchema(reg *schemas.Registry) {
reg.Register(&schemas.Schema{
String: schema_95c0f3edf8dd266c,
Nodes: []uint64{
0x8612f7506f622fbd,
0xb2ad9e8e7b416561,
0xc4ef214b3fa3e0f9,
},
Compressed: true,
})
}