-
Notifications
You must be signed in to change notification settings - Fork 28
/
vtrace.vdl.go
300 lines (261 loc) · 9.56 KB
/
vtrace.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
// 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: vtrace
// Package vtrace defines an interface to access v.io/v23/vtrace traces, to help
// analyze and debug distributed systems.
//nolint:golint
package vtrace
import (
"io"
v23 "v.io/v23"
"v.io/v23/context"
"v.io/v23/rpc"
"v.io/v23/security/access"
"v.io/v23/uniqueid"
"v.io/v23/vdl"
"v.io/v23/vtrace"
)
var _ = initializeVDL() // Must be first; see initializeVDL comments for details.
// Interface definitions
// =====================
// StoreClientMethods is the client interface
// containing Store methods.
type StoreClientMethods interface {
// Trace returns the trace that matches the given Id.
// Will return a NoExists error if no matching trace was found.
Trace(_ *context.T, id uniqueid.Id, _ ...rpc.CallOpt) (vtrace.TraceRecord, error)
// AllTraces returns TraceRecords for all traces the server currently
// knows about.
AllTraces(*context.T, ...rpc.CallOpt) (StoreAllTracesClientCall, error)
}
// StoreClientStub embeds StoreClientMethods and is a
// placeholder for additional management operations.
type StoreClientStub interface {
StoreClientMethods
}
// StoreClient returns a client stub for Store.
func StoreClient(name string) StoreClientStub {
return implStoreClientStub{name}
}
type implStoreClientStub struct {
name string
}
func (c implStoreClientStub) Trace(ctx *context.T, i0 uniqueid.Id, opts ...rpc.CallOpt) (o0 vtrace.TraceRecord, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Trace", []interface{}{i0}, []interface{}{&o0}, opts...)
return
}
func (c implStoreClientStub) AllTraces(ctx *context.T, opts ...rpc.CallOpt) (ocall StoreAllTracesClientCall, err error) {
var call rpc.ClientCall
if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "AllTraces", nil, opts...); err != nil {
return
}
ocall = &implStoreAllTracesClientCall{ClientCall: call}
return
}
// StoreAllTracesClientStream is the client stream for Store.AllTraces.
type StoreAllTracesClientStream interface {
// RecvStream returns the receiver side of the Store.AllTraces client stream.
RecvStream() interface {
// Advance stages an item so that it may be retrieved via Value. Returns
// true iff there is an item to retrieve. Advance must be called before
// Value is called. May block if an item is not available.
Advance() bool
// Value returns the item that was staged by Advance. May panic if Advance
// returned false or was not called. Never blocks.
Value() vtrace.TraceRecord
// Err returns any error encountered by Advance. Never blocks.
Err() error
}
}
// StoreAllTracesClientCall represents the call returned from Store.AllTraces.
type StoreAllTracesClientCall interface {
StoreAllTracesClientStream
// Finish blocks until the server is done, and returns the positional return
// values for call.
//
// Finish returns immediately if the call has been canceled; depending on the
// timing the output could either be an error signaling cancelation, or the
// valid positional return values from the server.
//
// Calling Finish is mandatory for releasing stream resources, unless the call
// has been canceled or any of the other methods return an error. Finish should
// be called at most once.
Finish() error
}
type implStoreAllTracesClientCall struct {
rpc.ClientCall
valRecv vtrace.TraceRecord
errRecv error
}
func (c *implStoreAllTracesClientCall) RecvStream() interface {
Advance() bool
Value() vtrace.TraceRecord
Err() error
} {
return implStoreAllTracesClientCallRecv{c}
}
type implStoreAllTracesClientCallRecv struct {
c *implStoreAllTracesClientCall
}
func (c implStoreAllTracesClientCallRecv) Advance() bool {
c.c.valRecv = vtrace.TraceRecord{}
c.c.errRecv = c.c.Recv(&c.c.valRecv)
return c.c.errRecv == nil
}
func (c implStoreAllTracesClientCallRecv) Value() vtrace.TraceRecord {
return c.c.valRecv
}
func (c implStoreAllTracesClientCallRecv) Err() error {
if c.c.errRecv == io.EOF {
return nil
}
return c.c.errRecv
}
func (c *implStoreAllTracesClientCall) Finish() (err error) {
err = c.ClientCall.Finish()
return
}
// StoreServerMethods is the interface a server writer
// implements for Store.
type StoreServerMethods interface {
// Trace returns the trace that matches the given Id.
// Will return a NoExists error if no matching trace was found.
Trace(_ *context.T, _ rpc.ServerCall, id uniqueid.Id) (vtrace.TraceRecord, error)
// AllTraces returns TraceRecords for all traces the server currently
// knows about.
AllTraces(*context.T, StoreAllTracesServerCall) error
}
// StoreServerStubMethods is the server interface containing
// Store methods, as expected by rpc.Server.
// The only difference between this interface and StoreServerMethods
// is the streaming methods.
type StoreServerStubMethods interface {
// Trace returns the trace that matches the given Id.
// Will return a NoExists error if no matching trace was found.
Trace(_ *context.T, _ rpc.ServerCall, id uniqueid.Id) (vtrace.TraceRecord, error)
// AllTraces returns TraceRecords for all traces the server currently
// knows about.
AllTraces(*context.T, *StoreAllTracesServerCallStub) error
}
// StoreServerStub adds universal methods to StoreServerStubMethods.
type StoreServerStub interface {
StoreServerStubMethods
// DescribeInterfaces the Store interfaces.
Describe__() []rpc.InterfaceDesc
}
// StoreServer returns a server stub for Store.
// It converts an implementation of StoreServerMethods into
// an object that may be used by rpc.Server.
func StoreServer(impl StoreServerMethods) StoreServerStub {
stub := implStoreServerStub{
impl: impl,
}
// Initialize GlobState; always check the stub itself first, to handle the
// case where the user has the Glob method defined in their VDL source.
if gs := rpc.NewGlobState(stub); gs != nil {
stub.gs = gs
} else if gs := rpc.NewGlobState(impl); gs != nil {
stub.gs = gs
}
return stub
}
type implStoreServerStub struct {
impl StoreServerMethods
gs *rpc.GlobState
}
func (s implStoreServerStub) Trace(ctx *context.T, call rpc.ServerCall, i0 uniqueid.Id) (vtrace.TraceRecord, error) {
return s.impl.Trace(ctx, call, i0)
}
func (s implStoreServerStub) AllTraces(ctx *context.T, call *StoreAllTracesServerCallStub) error {
return s.impl.AllTraces(ctx, call)
}
func (s implStoreServerStub) Globber() *rpc.GlobState {
return s.gs
}
func (s implStoreServerStub) Describe__() []rpc.InterfaceDesc {
return []rpc.InterfaceDesc{StoreDesc}
}
// StoreDesc describes the Store interface.
var StoreDesc rpc.InterfaceDesc = descStore
// descStore hides the desc to keep godoc clean.
var descStore = rpc.InterfaceDesc{
Name: "Store",
PkgPath: "v.io/v23/services/vtrace",
Methods: []rpc.MethodDesc{
{
Name: "Trace",
Doc: "// Trace returns the trace that matches the given Id.\n// Will return a NoExists error if no matching trace was found.",
InArgs: []rpc.ArgDesc{
{Name: "id", Doc: ``}, // uniqueid.Id
},
OutArgs: []rpc.ArgDesc{
{Name: "", Doc: ``}, // vtrace.TraceRecord
},
Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Debug"))},
},
{
Name: "AllTraces",
Doc: "// AllTraces returns TraceRecords for all traces the server currently\n// knows about.",
Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Debug"))},
},
},
}
// StoreAllTracesServerStream is the server stream for Store.AllTraces.
type StoreAllTracesServerStream interface {
// SendStream returns the send side of the Store.AllTraces server stream.
SendStream() interface {
// Send places the item onto the output stream. Returns errors encountered
// while sending. Blocks if there is no buffer space; will unblock when
// buffer space is available.
Send(item vtrace.TraceRecord) error
}
}
// StoreAllTracesServerCall represents the context passed to Store.AllTraces.
type StoreAllTracesServerCall interface {
rpc.ServerCall
StoreAllTracesServerStream
}
// StoreAllTracesServerCallStub is a wrapper that converts rpc.StreamServerCall into
// a typesafe stub that implements StoreAllTracesServerCall.
type StoreAllTracesServerCallStub struct {
rpc.StreamServerCall
}
// Init initializes StoreAllTracesServerCallStub from rpc.StreamServerCall.
func (s *StoreAllTracesServerCallStub) Init(call rpc.StreamServerCall) {
s.StreamServerCall = call
}
// SendStream returns the send side of the Store.AllTraces server stream.
func (s *StoreAllTracesServerCallStub) SendStream() interface {
Send(item vtrace.TraceRecord) error
} {
return implStoreAllTracesServerCallSend{s}
}
type implStoreAllTracesServerCallSend struct {
s *StoreAllTracesServerCallStub
}
func (s implStoreAllTracesServerCallSend) Send(item vtrace.TraceRecord) error {
return s.s.Send(item)
}
var initializeVDLCalled bool
// initializeVDL 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 _ = initializeVDL()
//
// 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 initializeVDL() struct{} {
if initializeVDLCalled {
return struct{}{}
}
initializeVDLCalled = true
return struct{}{}
}