forked from vanadium-archive/go.v23
/
wakeup.vdl.go
154 lines (131 loc) · 4.84 KB
/
wakeup.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
// Copyright 2016 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: wakeup
// Package wakeup defines interfaces for waking up remote services, likely running
// on mobile devices (e.g., Android, iOS).
package wakeup
import (
"v.io/v23"
"v.io/v23/context"
"v.io/v23/rpc"
)
var _ = __VDLInit() // Must be first; see __VDLInit comments for details.
//////////////////////////////////////////////////
// Interface definitions
// WakeUpClientMethods is the client interface
// containing WakeUp methods.
//
// WakeUp interface defines methods for services that wish to be woken up remotely.
type WakeUpClientMethods interface {
// Register returns a rooted name where the service should mount itself
// in order to be woken up using the provided wakeup token.
Register(_ *context.T, token string, _ ...rpc.CallOpt) (string, error)
}
// WakeUpClientStub adds universal methods to WakeUpClientMethods.
type WakeUpClientStub interface {
WakeUpClientMethods
rpc.UniversalServiceMethods
}
// WakeUpClient returns a client stub for WakeUp.
func WakeUpClient(name string) WakeUpClientStub {
return implWakeUpClientStub{name}
}
type implWakeUpClientStub struct {
name string
}
func (c implWakeUpClientStub) Register(ctx *context.T, i0 string, opts ...rpc.CallOpt) (o0 string, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Register", []interface{}{i0}, []interface{}{&o0}, opts...)
return
}
// WakeUpServerMethods is the interface a server writer
// implements for WakeUp.
//
// WakeUp interface defines methods for services that wish to be woken up remotely.
type WakeUpServerMethods interface {
// Register returns a rooted name where the service should mount itself
// in order to be woken up using the provided wakeup token.
Register(_ *context.T, _ rpc.ServerCall, token string) (string, error)
}
// WakeUpServerStubMethods is the server interface containing
// WakeUp methods, as expected by rpc.Server.
// There is no difference between this interface and WakeUpServerMethods
// since there are no streaming methods.
type WakeUpServerStubMethods WakeUpServerMethods
// WakeUpServerStub adds universal methods to WakeUpServerStubMethods.
type WakeUpServerStub interface {
WakeUpServerStubMethods
// Describe the WakeUp interfaces.
Describe__() []rpc.InterfaceDesc
}
// WakeUpServer returns a server stub for WakeUp.
// It converts an implementation of WakeUpServerMethods into
// an object that may be used by rpc.Server.
func WakeUpServer(impl WakeUpServerMethods) WakeUpServerStub {
stub := implWakeUpServerStub{
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 implWakeUpServerStub struct {
impl WakeUpServerMethods
gs *rpc.GlobState
}
func (s implWakeUpServerStub) Register(ctx *context.T, call rpc.ServerCall, i0 string) (string, error) {
return s.impl.Register(ctx, call, i0)
}
func (s implWakeUpServerStub) Globber() *rpc.GlobState {
return s.gs
}
func (s implWakeUpServerStub) Describe__() []rpc.InterfaceDesc {
return []rpc.InterfaceDesc{WakeUpDesc}
}
// WakeUpDesc describes the WakeUp interface.
var WakeUpDesc rpc.InterfaceDesc = descWakeUp
// descWakeUp hides the desc to keep godoc clean.
var descWakeUp = rpc.InterfaceDesc{
Name: "WakeUp",
PkgPath: "v.io/v23/services/wakeup",
Doc: "// WakeUp interface defines methods for services that wish to be woken up remotely.",
Methods: []rpc.MethodDesc{
{
Name: "Register",
Doc: "// Register returns a rooted name where the service should mount itself\n// in order to be woken up using the provided wakeup token.",
InArgs: []rpc.ArgDesc{
{"token", ``}, // string
},
OutArgs: []rpc.ArgDesc{
{"", ``}, // string
},
},
},
}
var __VDLInitCalled bool
// __VDLInit 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 _ = __VDLInit()
//
// 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 __VDLInit() struct{} {
if __VDLInitCalled {
return struct{}{}
}
__VDLInitCalled = true
return struct{}{}
}