-
Notifications
You must be signed in to change notification settings - Fork 0
/
echo.capnp.go
357 lines (291 loc) · 11.1 KB
/
echo.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
// Code generated by capnpc-go. DO NOT EDIT.
package lb
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 Echo capnp.Client
// Echo_TypeID is the unique identifier for the type Echo.
const Echo_TypeID = 0xe49731bba3f92391
func (c Echo) Echo(ctx context.Context, params func(Echo_echo_Params) error) (Echo_echo_Results_Future, capnp.ReleaseFunc) {
s := capnp.Send{
Method: capnp.Method{
InterfaceID: 0xe49731bba3f92391,
MethodID: 0,
InterfaceName: "echo.capnp:Echo",
MethodName: "echo",
},
}
if params != nil {
s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1}
s.PlaceArgs = func(s capnp.Struct) error { return params(Echo_echo_Params(s)) }
}
ans, release := capnp.Client(c).SendCall(ctx, s)
return Echo_echo_Results_Future{Future: ans.Future()}, release
}
func (c Echo) 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 Echo) String() string {
return "Echo(" + 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 Echo) AddRef() Echo {
return Echo(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 Echo) Release() {
capnp.Client(c).Release()
}
// Resolve blocks until the capability is fully resolved or the Context
// expires.
func (c Echo) Resolve(ctx context.Context) error {
return capnp.Client(c).Resolve(ctx)
}
func (c Echo) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
return capnp.Client(c).EncodeAsPtr(seg)
}
func (Echo) DecodeFromPtr(p capnp.Ptr) Echo {
return Echo(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 Echo) 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 Echo) IsSame(other Echo) 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 Echo) SetFlowLimiter(lim fc.FlowLimiter) {
capnp.Client(c).SetFlowLimiter(lim)
}
// Get the current flowcontrol.FlowLimiter used to manage flow control
// for this client.
func (c Echo) GetFlowLimiter() fc.FlowLimiter {
return capnp.Client(c).GetFlowLimiter()
}
// A Echo_Server is a Echo with a local implementation.
type Echo_Server interface {
Echo(context.Context, Echo_echo) error
}
// Echo_NewServer creates a new Server from an implementation of Echo_Server.
func Echo_NewServer(s Echo_Server) *server.Server {
c, _ := s.(server.Shutdowner)
return server.New(Echo_Methods(nil, s), s, c)
}
// Echo_ServerToClient creates a new Client from an implementation of Echo_Server.
// The caller is responsible for calling Release on the returned Client.
func Echo_ServerToClient(s Echo_Server) Echo {
return Echo(capnp.NewClient(Echo_NewServer(s)))
}
// Echo_Methods appends Methods to a slice that invoke the methods on s.
// This can be used to create a more complicated Server.
func Echo_Methods(methods []server.Method, s Echo_Server) []server.Method {
if cap(methods) == 0 {
methods = make([]server.Method, 0, 1)
}
methods = append(methods, server.Method{
Method: capnp.Method{
InterfaceID: 0xe49731bba3f92391,
MethodID: 0,
InterfaceName: "echo.capnp:Echo",
MethodName: "echo",
},
Impl: func(ctx context.Context, call *server.Call) error {
return s.Echo(ctx, Echo_echo{call})
},
})
return methods
}
// Echo_echo holds the state for a server call to Echo.echo.
// See server.Call for documentation.
type Echo_echo struct {
*server.Call
}
// Args returns the call's arguments.
func (c Echo_echo) Args() Echo_echo_Params {
return Echo_echo_Params(c.Call.Args())
}
// AllocResults allocates the results struct.
func (c Echo_echo) AllocResults() (Echo_echo_Results, error) {
r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1})
return Echo_echo_Results(r), err
}
// Echo_List is a list of Echo.
type Echo_List = capnp.CapList[Echo]
// NewEcho creates a new list of Echo.
func NewEcho_List(s *capnp.Segment, sz int32) (Echo_List, error) {
l, err := capnp.NewPointerList(s, sz)
return capnp.CapList[Echo](l), err
}
type Echo_echo_Params capnp.Struct
// Echo_echo_Params_TypeID is the unique identifier for the type Echo_echo_Params.
const Echo_echo_Params_TypeID = 0xeed2c21449ba16ff
func NewEcho_echo_Params(s *capnp.Segment) (Echo_echo_Params, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
return Echo_echo_Params(st), err
}
func NewRootEcho_echo_Params(s *capnp.Segment) (Echo_echo_Params, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
return Echo_echo_Params(st), err
}
func ReadRootEcho_echo_Params(msg *capnp.Message) (Echo_echo_Params, error) {
root, err := msg.Root()
return Echo_echo_Params(root.Struct()), err
}
func (s Echo_echo_Params) String() string {
str, _ := text.Marshal(0xeed2c21449ba16ff, capnp.Struct(s))
return str
}
func (s Echo_echo_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
return capnp.Struct(s).EncodeAsPtr(seg)
}
func (Echo_echo_Params) DecodeFromPtr(p capnp.Ptr) Echo_echo_Params {
return Echo_echo_Params(capnp.Struct{}.DecodeFromPtr(p))
}
func (s Echo_echo_Params) ToPtr() capnp.Ptr {
return capnp.Struct(s).ToPtr()
}
func (s Echo_echo_Params) IsValid() bool {
return capnp.Struct(s).IsValid()
}
func (s Echo_echo_Params) Message() *capnp.Message {
return capnp.Struct(s).Message()
}
func (s Echo_echo_Params) Segment() *capnp.Segment {
return capnp.Struct(s).Segment()
}
func (s Echo_echo_Params) Payload() ([]byte, error) {
p, err := capnp.Struct(s).Ptr(0)
return []byte(p.Data()), err
}
func (s Echo_echo_Params) HasPayload() bool {
return capnp.Struct(s).HasPtr(0)
}
func (s Echo_echo_Params) SetPayload(v []byte) error {
return capnp.Struct(s).SetData(0, v)
}
// Echo_echo_Params_List is a list of Echo_echo_Params.
type Echo_echo_Params_List = capnp.StructList[Echo_echo_Params]
// NewEcho_echo_Params creates a new list of Echo_echo_Params.
func NewEcho_echo_Params_List(s *capnp.Segment, sz int32) (Echo_echo_Params_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)
return capnp.StructList[Echo_echo_Params](l), err
}
// Echo_echo_Params_Future is a wrapper for a Echo_echo_Params promised by a client call.
type Echo_echo_Params_Future struct{ *capnp.Future }
func (f Echo_echo_Params_Future) Struct() (Echo_echo_Params, error) {
p, err := f.Future.Ptr()
return Echo_echo_Params(p.Struct()), err
}
type Echo_echo_Results capnp.Struct
// Echo_echo_Results_TypeID is the unique identifier for the type Echo_echo_Results.
const Echo_echo_Results_TypeID = 0xade20218703ef27d
func NewEcho_echo_Results(s *capnp.Segment) (Echo_echo_Results, error) {
st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
return Echo_echo_Results(st), err
}
func NewRootEcho_echo_Results(s *capnp.Segment) (Echo_echo_Results, error) {
st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1})
return Echo_echo_Results(st), err
}
func ReadRootEcho_echo_Results(msg *capnp.Message) (Echo_echo_Results, error) {
root, err := msg.Root()
return Echo_echo_Results(root.Struct()), err
}
func (s Echo_echo_Results) String() string {
str, _ := text.Marshal(0xade20218703ef27d, capnp.Struct(s))
return str
}
func (s Echo_echo_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr {
return capnp.Struct(s).EncodeAsPtr(seg)
}
func (Echo_echo_Results) DecodeFromPtr(p capnp.Ptr) Echo_echo_Results {
return Echo_echo_Results(capnp.Struct{}.DecodeFromPtr(p))
}
func (s Echo_echo_Results) ToPtr() capnp.Ptr {
return capnp.Struct(s).ToPtr()
}
func (s Echo_echo_Results) IsValid() bool {
return capnp.Struct(s).IsValid()
}
func (s Echo_echo_Results) Message() *capnp.Message {
return capnp.Struct(s).Message()
}
func (s Echo_echo_Results) Segment() *capnp.Segment {
return capnp.Struct(s).Segment()
}
func (s Echo_echo_Results) Response() ([]byte, error) {
p, err := capnp.Struct(s).Ptr(0)
return []byte(p.Data()), err
}
func (s Echo_echo_Results) HasResponse() bool {
return capnp.Struct(s).HasPtr(0)
}
func (s Echo_echo_Results) SetResponse(v []byte) error {
return capnp.Struct(s).SetData(0, v)
}
// Echo_echo_Results_List is a list of Echo_echo_Results.
type Echo_echo_Results_List = capnp.StructList[Echo_echo_Results]
// NewEcho_echo_Results creates a new list of Echo_echo_Results.
func NewEcho_echo_Results_List(s *capnp.Segment, sz int32) (Echo_echo_Results_List, error) {
l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz)
return capnp.StructList[Echo_echo_Results](l), err
}
// Echo_echo_Results_Future is a wrapper for a Echo_echo_Results promised by a client call.
type Echo_echo_Results_Future struct{ *capnp.Future }
func (f Echo_echo_Results_Future) Struct() (Echo_echo_Results, error) {
p, err := f.Future.Ptr()
return Echo_echo_Results(p.Struct()), err
}
const schema_8d728f3bbdc2c9fe = "x\xda\x12\xe8v`1\xe4\xcdgb`\x0a\x94ae" +
"\xfb_\xfb\xc9\xae@\x82\xe9\xd1Z\x06A\x01F\x06\x06" +
"VFv\x06\x06aY\xc6W\x0c\x8c\xc2\x8a\x8c\xf6\x0c" +
"\x8c\xff'*\xff\\\xbc\xdbp\xfa\x13\x06An\xe6\xff" +
"\xffN\x1e\xdak\xdd_\xd4\xcb\xc0\xc0(\xec\xca\xd8$" +
"\xec\x09V\xee\xca\xe8.\x9c\x0bb\xfd\xff/\xb6\xcbS" +
"\xe4\xd0\xa5w\xc8\x86\x852>b`\x14\x8ed\xb4g" +
"\xd0\xfd\x9f\x9a\x9c\x91\xaf\x97\x9cX\xc0\x94W`\xe5\x0a" +
"b\x83\x04T\x82R\x8b\xf9KsJ\x8a\x03Y\x98Y" +
"\x18\x18X\x18\x19\x18\x04y\xbd\x18\x18\x02y\x98\x19\x03" +
"%\x98\x18\xff\x17\xa5\x16\x17\xe4\xe7\x15\xa72000" +
"\xf2201\xf220\xc2Mb\x84\x9a\xc4\x10\xc0\xc8" +
"\x18\xc8\xc2\xcc\x8a\xe4\x08F\x98\xd7\x04\x05\xb5\x18\x98\x04" +
"Y\xd9\xf9A\x9a\x1c\x18\x03\x18\x19q8$ \xb1\x88" +
"=1\x17\xc5\x1dN\x0c\x0c\x81\x1c\xcc\x8c\x81\"L\x8c" +
"\xf5\x05\x89\x959\xf9\x89)07\x00\x02\x00\x00\xff\xff" +
"qES\xf2"
func RegisterSchema(reg *schemas.Registry) {
reg.Register(&schemas.Schema{
String: schema_8d728f3bbdc2c9fe,
Nodes: []uint64{
0xade20218703ef27d,
0xe49731bba3f92391,
0xeed2c21449ba16ff,
},
Compressed: true,
})
}