blob: e0f22b5f937a450da50239663756b9eeec84ba37 [file] [log] [blame]
Jiri Simsa67b8a262015-03-24 21:14:07 -07001// Copyright 2015 The Vanadium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
Suharsh Sivakumara4ac50a2015-03-13 16:13:50 -07005// This file was auto-generated by the vanadium vdl tool.
Todd Wangadb6cdb2016-03-11 17:15:02 -08006// Package: device
Bogdan Caprita4d67c042014-08-19 10:41:19 -07007
Bogdan Capritaa456f472014-12-10 10:18:03 -08008package device
Bogdan Caprita4d67c042014-08-19 10:41:19 -07009
10import (
Jiri Simsa6ac95222015-02-23 16:11:49 -080011 "v.io/v23"
12 "v.io/v23/context"
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070013 "v.io/v23/rpc"
Bogdan Caprita4d67c042014-08-19 10:41:19 -070014)
15
Todd Wang44269932016-03-15 16:46:53 -070016var _ = __VDLInit() // Must be first; see __VDLInit comments for details.
17
18//////////////////////////////////////////////////
19// Interface definitions
Benjamin Prosnitz2fa4e4e2016-03-03 17:25:28 -080020
Todd Wang702385a2014-11-07 01:54:08 -080021// ConfigClientMethods is the client interface
22// containing Config methods.
23//
Bogdan Caprita4d67c042014-08-19 10:41:19 -070024// Config is an RPC API to the config service.
Todd Wang702385a2014-11-07 01:54:08 -080025type ConfigClientMethods interface {
Bogdan Caprita4d67c042014-08-19 10:41:19 -070026 // Set sets the value for key.
Todd Wang9f3524a2015-11-18 12:30:18 -080027 Set(_ *context.T, key string, value string, _ ...rpc.CallOpt) error
Bogdan Caprita4d67c042014-08-19 10:41:19 -070028}
29
Todd Wang702385a2014-11-07 01:54:08 -080030// ConfigClientStub adds universal methods to ConfigClientMethods.
31type ConfigClientStub interface {
32 ConfigClientMethods
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070033 rpc.UniversalServiceMethods
Bogdan Caprita4d67c042014-08-19 10:41:19 -070034}
35
Todd Wang702385a2014-11-07 01:54:08 -080036// ConfigClient returns a client stub for Config.
Asim Shankar69fa69f2015-04-01 11:34:32 -070037func ConfigClient(name string) ConfigClientStub {
38 return implConfigClientStub{name}
Bogdan Caprita4d67c042014-08-19 10:41:19 -070039}
40
Todd Wang702385a2014-11-07 01:54:08 -080041type implConfigClientStub struct {
Asim Shankar69fa69f2015-04-01 11:34:32 -070042 name string
Bogdan Caprita4d67c042014-08-19 10:41:19 -070043}
44
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070045func (c implConfigClientStub) Set(ctx *context.T, i0 string, i1 string, opts ...rpc.CallOpt) (err error) {
Suharsh Sivakumardf2672a2015-04-09 19:26:43 -070046 err = v23.GetClient(ctx).Call(ctx, c.name, "Set", []interface{}{i0, i1}, nil, opts...)
Bogdan Caprita4d67c042014-08-19 10:41:19 -070047 return
48}
49
Todd Wang702385a2014-11-07 01:54:08 -080050// ConfigServerMethods is the interface a server writer
51// implements for Config.
52//
53// Config is an RPC API to the config service.
54type ConfigServerMethods interface {
55 // Set sets the value for key.
Todd Wang9f3524a2015-11-18 12:30:18 -080056 Set(_ *context.T, _ rpc.ServerCall, key string, value string) error
Bogdan Caprita4d67c042014-08-19 10:41:19 -070057}
58
Todd Wang702385a2014-11-07 01:54:08 -080059// ConfigServerStubMethods is the server interface containing
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070060// Config methods, as expected by rpc.Server.
Todd Wang1fe7cdd2014-11-12 12:51:49 -080061// There is no difference between this interface and ConfigServerMethods
62// since there are no streaming methods.
63type ConfigServerStubMethods ConfigServerMethods
Bogdan Caprita4d67c042014-08-19 10:41:19 -070064
Todd Wang702385a2014-11-07 01:54:08 -080065// ConfigServerStub adds universal methods to ConfigServerStubMethods.
66type ConfigServerStub interface {
67 ConfigServerStubMethods
Todd Wang5739dda2014-11-16 22:44:02 -080068 // Describe the Config interfaces.
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070069 Describe__() []rpc.InterfaceDesc
Todd Wang702385a2014-11-07 01:54:08 -080070}
71
72// ConfigServer returns a server stub for Config.
73// It converts an implementation of ConfigServerMethods into
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070074// an object that may be used by rpc.Server.
Todd Wang702385a2014-11-07 01:54:08 -080075func ConfigServer(impl ConfigServerMethods) ConfigServerStub {
76 stub := implConfigServerStub{
77 impl: impl,
78 }
79 // Initialize GlobState; always check the stub itself first, to handle the
80 // case where the user has the Glob method defined in their VDL source.
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070081 if gs := rpc.NewGlobState(stub); gs != nil {
Todd Wang702385a2014-11-07 01:54:08 -080082 stub.gs = gs
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070083 } else if gs := rpc.NewGlobState(impl); gs != nil {
Todd Wang702385a2014-11-07 01:54:08 -080084 stub.gs = gs
85 }
86 return stub
87}
88
89type implConfigServerStub struct {
90 impl ConfigServerMethods
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070091 gs *rpc.GlobState
Todd Wang702385a2014-11-07 01:54:08 -080092}
93
Todd Wang54feabe2015-04-15 23:38:26 -070094func (s implConfigServerStub) Set(ctx *context.T, call rpc.ServerCall, i0 string, i1 string) error {
95 return s.impl.Set(ctx, call, i0, i1)
Todd Wang702385a2014-11-07 01:54:08 -080096}
97
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070098func (s implConfigServerStub) Globber() *rpc.GlobState {
Todd Wang702385a2014-11-07 01:54:08 -080099 return s.gs
100}
101
Matt Rosencrantz94502cf2015-03-18 09:43:44 -0700102func (s implConfigServerStub) Describe__() []rpc.InterfaceDesc {
103 return []rpc.InterfaceDesc{ConfigDesc}
Todd Wang5739dda2014-11-16 22:44:02 -0800104}
105
106// ConfigDesc describes the Config interface.
Matt Rosencrantz94502cf2015-03-18 09:43:44 -0700107var ConfigDesc rpc.InterfaceDesc = descConfig
Todd Wang5739dda2014-11-16 22:44:02 -0800108
109// descConfig hides the desc to keep godoc clean.
Matt Rosencrantz94502cf2015-03-18 09:43:44 -0700110var descConfig = rpc.InterfaceDesc{
Todd Wang5739dda2014-11-16 22:44:02 -0800111 Name: "Config",
Todd Wangcd4b3cc2015-04-06 16:42:02 -0700112 PkgPath: "v.io/x/ref/services/device",
Todd Wang5739dda2014-11-16 22:44:02 -0800113 Doc: "// Config is an RPC API to the config service.",
Matt Rosencrantz94502cf2015-03-18 09:43:44 -0700114 Methods: []rpc.MethodDesc{
Todd Wang5739dda2014-11-16 22:44:02 -0800115 {
116 Name: "Set",
117 Doc: "// Set sets the value for key.",
Matt Rosencrantz94502cf2015-03-18 09:43:44 -0700118 InArgs: []rpc.ArgDesc{
Todd Wang5739dda2014-11-16 22:44:02 -0800119 {"key", ``}, // string
120 {"value", ``}, // string
121 },
Todd Wang5739dda2014-11-16 22:44:02 -0800122 },
123 },
Bogdan Caprita4d67c042014-08-19 10:41:19 -0700124}
Todd Wang44269932016-03-15 16:46:53 -0700125
126var __VDLInitCalled bool
127
128// __VDLInit performs vdl initialization. It is safe to call multiple times.
129// If you have an init ordering issue, just insert the following line verbatim
130// into your source files in this package, right after the "package foo" clause:
131//
132// var _ = __VDLInit()
133//
134// The purpose of this function is to ensure that vdl initialization occurs in
135// the right order, and very early in the init sequence. In particular, vdl
136// registration and package variable initialization needs to occur before
137// functions like vdl.TypeOf will work properly.
138//
139// This function returns a dummy value, so that it can be used to initialize the
140// first var in the file, to take advantage of Go's defined init order.
141func __VDLInit() struct{} {
142 if __VDLInitCalled {
143 return struct{}{}
144 }
Benjamin Prosnitzd0d7cbc2016-03-30 08:59:19 -0700145 __VDLInitCalled = true
Todd Wang44269932016-03-15 16:46:53 -0700146
147 return struct{}{}
148}