/
reserved.vdl.go
171 lines (144 loc) · 5.68 KB
/
reserved.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
// 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: reserved
//
//nolint:revive
package reserved
import (
"fmt"
"v.io/v23/context"
"v.io/v23/verror"
)
var initializeVDLCalled = false
var _ = initializeVDL() // Must be first; see initializeVDL comments for details.
// Error definitions
// =================
var (
// ErrGlobMaxRecursionReached indicates that the Glob request exceeded the
// max recursion level.
ErrGlobMaxRecursionReached = verror.NewIDAction("v.io/v23/rpc/reserved.GlobMaxRecursionReached", verror.NoRetry)
// ErrGlobMatchesOmitted indicates that some of the Glob results might
// have been omitted due to access restrictions.
ErrGlobMatchesOmitted = verror.NewIDAction("v.io/v23/rpc/reserved.GlobMatchesOmitted", verror.NoRetry)
// ErrGlobNotImplemented indicates that Glob is not implemented by the
// object.
ErrGlobNotImplemented = verror.NewIDAction("v.io/v23/rpc/reserved.GlobNotImplemented", verror.NoRetry)
)
// ErrorfGlobMaxRecursionReached calls ErrGlobMaxRecursionReached.Errorf with the supplied arguments.
func ErrorfGlobMaxRecursionReached(ctx *context.T, format string) error {
return ErrGlobMaxRecursionReached.Errorf(ctx, format)
}
// MessageGlobMaxRecursionReached calls ErrGlobMaxRecursionReached.Message with the supplied arguments.
func MessageGlobMaxRecursionReached(ctx *context.T, message string) error {
return ErrGlobMaxRecursionReached.Message(ctx, message)
}
// ParamsErrGlobMaxRecursionReached extracts the expected parameters from the error's ParameterList.
func ParamsErrGlobMaxRecursionReached(argumentError error) (verrorComponent string, verrorOperation string, returnErr error) {
params := verror.Params(argumentError)
if params == nil {
returnErr = fmt.Errorf("no parameters found in: %T: %v", argumentError, argumentError)
return
}
iter := ¶mListIterator{params: params, max: len(params)}
if verrorComponent, verrorOperation, returnErr = iter.preamble(); returnErr != nil {
return
}
return
}
// ErrorfGlobMatchesOmitted calls ErrGlobMatchesOmitted.Errorf with the supplied arguments.
func ErrorfGlobMatchesOmitted(ctx *context.T, format string) error {
return ErrGlobMatchesOmitted.Errorf(ctx, format)
}
// MessageGlobMatchesOmitted calls ErrGlobMatchesOmitted.Message with the supplied arguments.
func MessageGlobMatchesOmitted(ctx *context.T, message string) error {
return ErrGlobMatchesOmitted.Message(ctx, message)
}
// ParamsErrGlobMatchesOmitted extracts the expected parameters from the error's ParameterList.
func ParamsErrGlobMatchesOmitted(argumentError error) (verrorComponent string, verrorOperation string, returnErr error) {
params := verror.Params(argumentError)
if params == nil {
returnErr = fmt.Errorf("no parameters found in: %T: %v", argumentError, argumentError)
return
}
iter := ¶mListIterator{params: params, max: len(params)}
if verrorComponent, verrorOperation, returnErr = iter.preamble(); returnErr != nil {
return
}
return
}
// ErrorfGlobNotImplemented calls ErrGlobNotImplemented.Errorf with the supplied arguments.
func ErrorfGlobNotImplemented(ctx *context.T, format string) error {
return ErrGlobNotImplemented.Errorf(ctx, format)
}
// MessageGlobNotImplemented calls ErrGlobNotImplemented.Message with the supplied arguments.
func MessageGlobNotImplemented(ctx *context.T, message string) error {
return ErrGlobNotImplemented.Message(ctx, message)
}
// ParamsErrGlobNotImplemented extracts the expected parameters from the error's ParameterList.
func ParamsErrGlobNotImplemented(argumentError error) (verrorComponent string, verrorOperation string, returnErr error) {
params := verror.Params(argumentError)
if params == nil {
returnErr = fmt.Errorf("no parameters found in: %T: %v", argumentError, argumentError)
return
}
iter := ¶mListIterator{params: params, max: len(params)}
if verrorComponent, verrorOperation, returnErr = iter.preamble(); returnErr != nil {
return
}
return
}
type paramListIterator struct {
err error
idx, max int
params []interface{}
}
func (pl *paramListIterator) next() (interface{}, error) {
if pl.err != nil {
return nil, pl.err
}
if pl.idx+1 > pl.max {
pl.err = fmt.Errorf("too few parameters: have %v", pl.max)
return nil, pl.err
}
pl.idx++
return pl.params[pl.idx-1], nil
}
func (pl *paramListIterator) preamble() (component, operation string, err error) {
var tmp interface{}
if tmp, err = pl.next(); err != nil {
return
}
var ok bool
if component, ok = tmp.(string); !ok {
return "", "", fmt.Errorf("ParamList[0]: component name is not a string: %T", tmp)
}
if tmp, err = pl.next(); err != nil {
return
}
if operation, ok = tmp.(string); !ok {
return "", "", fmt.Errorf("ParamList[1]: operation name is not a string: %T", tmp)
}
return
}
// 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{}{}
}