-
Notifications
You must be signed in to change notification settings - Fork 28
/
tidyable.vdl.go
151 lines (130 loc) · 4.78 KB
/
tidyable.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
// 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: tidyable
// Package tidyable defines an interface for services that can be
// requested to clean up transient resource use (such as logs or caches.)
//
//nolint:revive
package tidyable
import (
v23 "v.io/v23"
"v.io/v23/context"
"v.io/v23/rpc"
"v.io/v23/security/access"
"v.io/v23/vdl"
)
var initializeVDLCalled = false
var _ = initializeVDL() // Must be first; see initializeVDL comments for details.
// Interface definitions
// =====================
// TidyableClientMethods is the client interface
// containing Tidyable methods.
//
// Tidyable specifies that a service can be tidied.
type TidyableClientMethods interface {
// Request the implementing service to perform regularly scheduled cleanup
// actions such as shrinking caches or rolling logs immediately.
TidyNow(*context.T, ...rpc.CallOpt) error
}
// TidyableClientStub embeds TidyableClientMethods and is a
// placeholder for additional management operations.
type TidyableClientStub interface {
TidyableClientMethods
}
// TidyableClient returns a client stub for Tidyable.
func TidyableClient(name string) TidyableClientStub {
return implTidyableClientStub{name}
}
type implTidyableClientStub struct {
name string
}
func (c implTidyableClientStub) TidyNow(ctx *context.T, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "TidyNow", nil, nil, opts...)
return
}
// TidyableServerMethods is the interface a server writer
// implements for Tidyable.
//
// Tidyable specifies that a service can be tidied.
type TidyableServerMethods interface {
// Request the implementing service to perform regularly scheduled cleanup
// actions such as shrinking caches or rolling logs immediately.
TidyNow(*context.T, rpc.ServerCall) error
}
// TidyableServerStubMethods is the server interface containing
// Tidyable methods, as expected by rpc.Server.
// There is no difference between this interface and TidyableServerMethods
// since there are no streaming methods.
type TidyableServerStubMethods TidyableServerMethods
// TidyableServerStub adds universal methods to TidyableServerStubMethods.
type TidyableServerStub interface {
TidyableServerStubMethods
// DescribeInterfaces the Tidyable interfaces.
Describe__() []rpc.InterfaceDesc
}
// TidyableServer returns a server stub for Tidyable.
// It converts an implementation of TidyableServerMethods into
// an object that may be used by rpc.Server.
func TidyableServer(impl TidyableServerMethods) TidyableServerStub {
stub := implTidyableServerStub{
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 implTidyableServerStub struct {
impl TidyableServerMethods
gs *rpc.GlobState
}
func (s implTidyableServerStub) TidyNow(ctx *context.T, call rpc.ServerCall) error {
return s.impl.TidyNow(ctx, call)
}
func (s implTidyableServerStub) Globber() *rpc.GlobState {
return s.gs
}
func (s implTidyableServerStub) Describe__() []rpc.InterfaceDesc {
return []rpc.InterfaceDesc{TidyableDesc}
}
// TidyableDesc describes the Tidyable interface.
var TidyableDesc rpc.InterfaceDesc = descTidyable
// descTidyable hides the desc to keep godoc clean.
var descTidyable = rpc.InterfaceDesc{
Name: "Tidyable",
PkgPath: "v.io/v23/services/tidyable",
Doc: "// Tidyable specifies that a service can be tidied.",
Methods: []rpc.MethodDesc{
{
Name: "TidyNow",
Doc: "// Request the implementing service to perform regularly scheduled cleanup\n// actions such as shrinking caches or rolling logs immediately.",
Tags: []*vdl.Value{vdl.ValueOf(access.Tag("Admin"))},
},
},
}
// 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{}{}
}