blob: 99c9c2a15c7f6d1f8a7e813c7486a95e1501af9f [file] [log] [blame]
Todd Wange5d67b42014-05-27 10:48:07 -07001// This file was auto-generated by the veyron vdl tool.
Tilak Sharma43395f32014-05-27 11:33:38 -07002// Source: root.vdl
Jiri Simsa5293dcb2014-05-10 09:56:38 -07003
4// Package root contains root process implementation and internal
5// interfaces and types used by the implementation.
6package root
7
8import (
9 // The non-user imports are prefixed with "_gen_" to prevent collisions.
Cosmos Nicolaoub07fa772014-05-16 08:07:02 -070010 _gen_veyron2 "veyron2"
Jiri Simsa5293dcb2014-05-10 09:56:38 -070011 _gen_ipc "veyron2/ipc"
12 _gen_naming "veyron2/naming"
Cosmos Nicolaouae678942014-05-17 17:21:43 -070013 _gen_rt "veyron2/rt"
Todd Wange5d67b42014-05-27 10:48:07 -070014 _gen_vdl "veyron2/vdl"
Jiri Simsa5293dcb2014-05-10 09:56:38 -070015 _gen_wiretype "veyron2/wiretype"
16)
17
18// Root is an interface to be implemented by a process with root level
19// privileges.
20// Root is the interface the client binds and uses.
Benjamin Prosnitzdcddb932014-05-27 15:55:58 -070021// Root_ExcludingUniversal is the interface without internal framework-added methods
22// to enable embedding without method collisions. Not to be used directly by clients.
23type Root_ExcludingUniversal interface {
Jiri Simsa5293dcb2014-05-10 09:56:38 -070024 // Reset waits for the given deadline (in milliseconds) and then
25 // restars the host node machine.
26 Reset(Deadline uint64, opts ..._gen_ipc.ClientCallOpt) (err error)
27}
28type Root interface {
Benjamin Prosnitzdcddb932014-05-27 15:55:58 -070029 _gen_ipc.UniversalServiceMethods
30 Root_ExcludingUniversal
Jiri Simsa5293dcb2014-05-10 09:56:38 -070031}
32
33// RootService is the interface the server implements.
34type RootService interface {
35
36 // Reset waits for the given deadline (in milliseconds) and then
37 // restars the host node machine.
38 Reset(context _gen_ipc.Context, Deadline uint64) (err error)
39}
40
41// BindRoot returns the client stub implementing the Root
42// interface.
43//
44// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
45// global Runtime is used.
46func BindRoot(name string, opts ..._gen_ipc.BindOpt) (Root, error) {
47 var client _gen_ipc.Client
48 switch len(opts) {
49 case 0:
50 client = _gen_rt.R().Client()
51 case 1:
52 switch o := opts[0].(type) {
Cosmos Nicolaoub07fa772014-05-16 08:07:02 -070053 case _gen_veyron2.Runtime:
Jiri Simsa5293dcb2014-05-10 09:56:38 -070054 client = o.Client()
55 case _gen_ipc.Client:
56 client = o
57 default:
Todd Wange5d67b42014-05-27 10:48:07 -070058 return nil, _gen_vdl.ErrUnrecognizedOption
Jiri Simsa5293dcb2014-05-10 09:56:38 -070059 }
60 default:
Todd Wange5d67b42014-05-27 10:48:07 -070061 return nil, _gen_vdl.ErrTooManyOptionsToBind
Jiri Simsa5293dcb2014-05-10 09:56:38 -070062 }
63 stub := &clientStubRoot{client: client, name: name}
64
65 return stub, nil
66}
67
68// NewServerRoot creates a new server stub.
69//
70// It takes a regular server implementing the RootService
71// interface, and returns a new server stub.
72func NewServerRoot(server RootService) interface{} {
73 return &ServerStubRoot{
74 service: server,
75 }
76}
77
78// clientStubRoot implements Root.
79type clientStubRoot struct {
80 client _gen_ipc.Client
81 name string
82}
83
Jiri Simsa5293dcb2014-05-10 09:56:38 -070084func (__gen_c *clientStubRoot) Reset(Deadline uint64, opts ..._gen_ipc.ClientCallOpt) (err error) {
85 var call _gen_ipc.ClientCall
86 if call, err = __gen_c.client.StartCall(__gen_c.name, "Reset", []interface{}{Deadline}, opts...); err != nil {
87 return
88 }
89 if ierr := call.Finish(&err); ierr != nil {
90 err = ierr
91 }
92 return
93}
94
Benjamin Prosnitzdcddb932014-05-27 15:55:58 -070095func (__gen_c *clientStubRoot) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
Jiri Simsa5293dcb2014-05-10 09:56:38 -070096 var call _gen_ipc.ClientCall
Benjamin Prosnitzdcddb932014-05-27 15:55:58 -070097 if call, err = __gen_c.client.StartCall(__gen_c.name, "UnresolveStep", nil, opts...); err != nil {
98 return
99 }
100 if ierr := call.Finish(&reply, &err); ierr != nil {
101 err = ierr
102 }
103 return
104}
105
106func (__gen_c *clientStubRoot) Signature(opts ..._gen_ipc.ClientCallOpt) (reply _gen_ipc.ServiceSignature, err error) {
107 var call _gen_ipc.ClientCall
108 if call, err = __gen_c.client.StartCall(__gen_c.name, "Signature", nil, opts...); err != nil {
109 return
110 }
111 if ierr := call.Finish(&reply, &err); ierr != nil {
112 err = ierr
113 }
114 return
115}
116
117func (__gen_c *clientStubRoot) GetMethodTags(method string, opts ..._gen_ipc.ClientCallOpt) (reply []interface{}, err error) {
118 var call _gen_ipc.ClientCall
119 if call, err = __gen_c.client.StartCall(__gen_c.name, "GetMethodTags", []interface{}{method}, opts...); err != nil {
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700120 return
121 }
122 if ierr := call.Finish(&reply, &err); ierr != nil {
123 err = ierr
124 }
125 return
126}
127
128// ServerStubRoot wraps a server that implements
129// RootService and provides an object that satisfies
130// the requirements of veyron2/ipc.ReflectInvoker.
131type ServerStubRoot struct {
132 service RootService
133}
134
Benjamin Prosnitzdcddb932014-05-27 15:55:58 -0700135func (__gen_s *ServerStubRoot) GetMethodTags(call _gen_ipc.ServerCall, method string) ([]interface{}, error) {
136 // TODO(bprosnitz) GetMethodTags() will be replaces with Signature().
137 // Note: This exhibits some weird behavior like returning a nil error if the method isn't found.
138 // This will change when it is replaced with Signature().
139 switch method {
140 case "Reset":
141 return []interface{}{}, nil
142 default:
143 return nil, nil
144 }
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700145}
146
Benjamin Prosnitzdcddb932014-05-27 15:55:58 -0700147func (__gen_s *ServerStubRoot) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700148 result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
149 result.Methods["Reset"] = _gen_ipc.MethodSignature{
150 InArgs: []_gen_ipc.MethodArgument{
151 {Name: "Deadline", Type: 53},
152 },
153 OutArgs: []_gen_ipc.MethodArgument{
154 {Name: "", Type: 65},
155 },
156 }
157
Todd Wange5d67b42014-05-27 10:48:07 -0700158 result.TypeDefs = []_gen_vdl.Any{
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700159 _gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
160
161 return result, nil
162}
163
Benjamin Prosnitzdcddb932014-05-27 15:55:58 -0700164func (__gen_s *ServerStubRoot) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
165 if unresolver, ok := __gen_s.service.(_gen_ipc.Unresolver); ok {
Jiri Simsa5293dcb2014-05-10 09:56:38 -0700166 return unresolver.UnresolveStep(call)
167 }
168 if call.Server() == nil {
169 return
170 }
171 var published []string
172 if published, err = call.Server().Published(); err != nil || published == nil {
173 return
174 }
175 reply = make([]string, len(published))
176 for i, p := range published {
177 reply[i] = _gen_naming.Join(p, call.Name())
178 }
179 return
180}
181
182func (__gen_s *ServerStubRoot) Reset(call _gen_ipc.ServerCall, Deadline uint64) (err error) {
183 err = __gen_s.service.Reset(call, Deadline)
184 return
185}