blob: 63e522bcfce45bffb7f4700bbb4a21ea3706970c [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.
Bogdan Caprita4d67c042014-08-19 10:41:19 -07006// Source: config.vdl
7
Bogdan Capritaa456f472014-12-10 10:18:03 -08008package device
Bogdan Caprita4d67c042014-08-19 10:41:19 -07009
10import (
Todd Wangb0d5dce2015-02-05 14:07:55 -080011 // VDL system imports
Jiri Simsa6ac95222015-02-23 16:11:49 -080012 "v.io/v23"
13 "v.io/v23/context"
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070014 "v.io/v23/rpc"
Bogdan Caprita4d67c042014-08-19 10:41:19 -070015)
16
Todd Wang702385a2014-11-07 01:54:08 -080017// ConfigClientMethods is the client interface
18// containing Config methods.
19//
Bogdan Caprita4d67c042014-08-19 10:41:19 -070020// Config is an RPC API to the config service.
Todd Wang702385a2014-11-07 01:54:08 -080021type ConfigClientMethods interface {
Bogdan Caprita4d67c042014-08-19 10:41:19 -070022 // Set sets the value for key.
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070023 Set(ctx *context.T, key string, value string, opts ...rpc.CallOpt) error
Bogdan Caprita4d67c042014-08-19 10:41:19 -070024}
25
Todd Wang702385a2014-11-07 01:54:08 -080026// ConfigClientStub adds universal methods to ConfigClientMethods.
27type ConfigClientStub interface {
28 ConfigClientMethods
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070029 rpc.UniversalServiceMethods
Bogdan Caprita4d67c042014-08-19 10:41:19 -070030}
31
Todd Wang702385a2014-11-07 01:54:08 -080032// ConfigClient returns a client stub for Config.
Asim Shankar69fa69f2015-04-01 11:34:32 -070033func ConfigClient(name string) ConfigClientStub {
34 return implConfigClientStub{name}
Bogdan Caprita4d67c042014-08-19 10:41:19 -070035}
36
Todd Wang702385a2014-11-07 01:54:08 -080037type implConfigClientStub struct {
Asim Shankar69fa69f2015-04-01 11:34:32 -070038 name string
Bogdan Caprita4d67c042014-08-19 10:41:19 -070039}
40
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070041func (c implConfigClientStub) Set(ctx *context.T, i0 string, i1 string, opts ...rpc.CallOpt) (err error) {
Suharsh Sivakumardf2672a2015-04-09 19:26:43 -070042 err = v23.GetClient(ctx).Call(ctx, c.name, "Set", []interface{}{i0, i1}, nil, opts...)
Bogdan Caprita4d67c042014-08-19 10:41:19 -070043 return
44}
45
Todd Wang702385a2014-11-07 01:54:08 -080046// ConfigServerMethods is the interface a server writer
47// implements for Config.
48//
49// Config is an RPC API to the config service.
50type ConfigServerMethods interface {
51 // Set sets the value for key.
Todd Wang54feabe2015-04-15 23:38:26 -070052 Set(ctx *context.T, call rpc.ServerCall, key string, value string) error
Bogdan Caprita4d67c042014-08-19 10:41:19 -070053}
54
Todd Wang702385a2014-11-07 01:54:08 -080055// ConfigServerStubMethods is the server interface containing
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070056// Config methods, as expected by rpc.Server.
Todd Wang1fe7cdd2014-11-12 12:51:49 -080057// There is no difference between this interface and ConfigServerMethods
58// since there are no streaming methods.
59type ConfigServerStubMethods ConfigServerMethods
Bogdan Caprita4d67c042014-08-19 10:41:19 -070060
Todd Wang702385a2014-11-07 01:54:08 -080061// ConfigServerStub adds universal methods to ConfigServerStubMethods.
62type ConfigServerStub interface {
63 ConfigServerStubMethods
Todd Wang5739dda2014-11-16 22:44:02 -080064 // Describe the Config interfaces.
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070065 Describe__() []rpc.InterfaceDesc
Todd Wang702385a2014-11-07 01:54:08 -080066}
67
68// ConfigServer returns a server stub for Config.
69// It converts an implementation of ConfigServerMethods into
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070070// an object that may be used by rpc.Server.
Todd Wang702385a2014-11-07 01:54:08 -080071func ConfigServer(impl ConfigServerMethods) ConfigServerStub {
72 stub := implConfigServerStub{
73 impl: impl,
74 }
75 // Initialize GlobState; always check the stub itself first, to handle the
76 // case where the user has the Glob method defined in their VDL source.
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070077 if gs := rpc.NewGlobState(stub); gs != nil {
Todd Wang702385a2014-11-07 01:54:08 -080078 stub.gs = gs
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070079 } else if gs := rpc.NewGlobState(impl); gs != nil {
Todd Wang702385a2014-11-07 01:54:08 -080080 stub.gs = gs
81 }
82 return stub
83}
84
85type implConfigServerStub struct {
86 impl ConfigServerMethods
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070087 gs *rpc.GlobState
Todd Wang702385a2014-11-07 01:54:08 -080088}
89
Todd Wang54feabe2015-04-15 23:38:26 -070090func (s implConfigServerStub) Set(ctx *context.T, call rpc.ServerCall, i0 string, i1 string) error {
91 return s.impl.Set(ctx, call, i0, i1)
Todd Wang702385a2014-11-07 01:54:08 -080092}
93
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070094func (s implConfigServerStub) Globber() *rpc.GlobState {
Todd Wang702385a2014-11-07 01:54:08 -080095 return s.gs
96}
97
Matt Rosencrantz94502cf2015-03-18 09:43:44 -070098func (s implConfigServerStub) Describe__() []rpc.InterfaceDesc {
99 return []rpc.InterfaceDesc{ConfigDesc}
Todd Wang5739dda2014-11-16 22:44:02 -0800100}
101
102// ConfigDesc describes the Config interface.
Matt Rosencrantz94502cf2015-03-18 09:43:44 -0700103var ConfigDesc rpc.InterfaceDesc = descConfig
Todd Wang5739dda2014-11-16 22:44:02 -0800104
105// descConfig hides the desc to keep godoc clean.
Matt Rosencrantz94502cf2015-03-18 09:43:44 -0700106var descConfig = rpc.InterfaceDesc{
Todd Wang5739dda2014-11-16 22:44:02 -0800107 Name: "Config",
Todd Wangcd4b3cc2015-04-06 16:42:02 -0700108 PkgPath: "v.io/x/ref/services/device",
Todd Wang5739dda2014-11-16 22:44:02 -0800109 Doc: "// Config is an RPC API to the config service.",
Matt Rosencrantz94502cf2015-03-18 09:43:44 -0700110 Methods: []rpc.MethodDesc{
Todd Wang5739dda2014-11-16 22:44:02 -0800111 {
112 Name: "Set",
113 Doc: "// Set sets the value for key.",
Matt Rosencrantz94502cf2015-03-18 09:43:44 -0700114 InArgs: []rpc.ArgDesc{
Todd Wang5739dda2014-11-16 22:44:02 -0800115 {"key", ``}, // string
116 {"value", ``}, // string
117 },
Todd Wang5739dda2014-11-16 22:44:02 -0800118 },
119 },
Bogdan Caprita4d67c042014-08-19 10:41:19 -0700120}