blob: c48b85a5f9fdb1f4dd1060d7197c71277379a513 [file] [log] [blame]
// This file was auto-generated by the veyron idl tool.
// Source: root.idl
// Package root contains root process implementation and internal
// interfaces and types used by the implementation.
package root
import (
// The non-user imports are prefixed with "_gen_" to prevent collisions.
_gen_veyron2 "veyron2"
_gen_idl "veyron2/idl"
_gen_ipc "veyron2/ipc"
_gen_naming "veyron2/naming"
_gen_rt "veyron2/rt/r"
_gen_wiretype "veyron2/wiretype"
)
// Root is an interface to be implemented by a process with root level
// privileges.
// Root is the interface the client binds and uses.
// Root_InternalNoTagGetter is the interface without the TagGetter
// and UnresolveStep methods (both framework-added, rathern than user-defined),
// to enable embedding without method collisions. Not to be used directly by
// clients.
type Root_InternalNoTagGetter interface {
// Reset waits for the given deadline (in milliseconds) and then
// restars the host node machine.
Reset(Deadline uint64, opts ..._gen_ipc.ClientCallOpt) (err error)
}
type Root interface {
_gen_idl.TagGetter
// UnresolveStep returns the names for the remote service, rooted at the
// service's immediate namespace ancestor.
UnresolveStep(opts ..._gen_ipc.ClientCallOpt) ([]string, error)
Root_InternalNoTagGetter
}
// RootService is the interface the server implements.
type RootService interface {
// Reset waits for the given deadline (in milliseconds) and then
// restars the host node machine.
Reset(context _gen_ipc.Context, Deadline uint64) (err error)
}
// BindRoot returns the client stub implementing the Root
// interface.
//
// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
// global Runtime is used.
func BindRoot(name string, opts ..._gen_ipc.BindOpt) (Root, error) {
var client _gen_ipc.Client
switch len(opts) {
case 0:
client = _gen_rt.R().Client()
case 1:
switch o := opts[0].(type) {
case _gen_veyron2.Runtime:
client = o.Client()
case _gen_ipc.Client:
client = o
default:
return nil, _gen_idl.ErrUnrecognizedOption
}
default:
return nil, _gen_idl.ErrTooManyOptionsToBind
}
stub := &clientStubRoot{client: client, name: name}
return stub, nil
}
// NewServerRoot creates a new server stub.
//
// It takes a regular server implementing the RootService
// interface, and returns a new server stub.
func NewServerRoot(server RootService) interface{} {
return &ServerStubRoot{
service: server,
}
}
// clientStubRoot implements Root.
type clientStubRoot struct {
client _gen_ipc.Client
name string
}
func (c *clientStubRoot) GetMethodTags(method string) []interface{} {
return GetRootMethodTags(method)
}
func (__gen_c *clientStubRoot) Reset(Deadline uint64, opts ..._gen_ipc.ClientCallOpt) (err error) {
var call _gen_ipc.ClientCall
if call, err = __gen_c.client.StartCall(__gen_c.name, "Reset", []interface{}{Deadline}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
err = ierr
}
return
}
func (c *clientStubRoot) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
var call _gen_ipc.ClientCall
if call, err = c.client.StartCall(c.name, "UnresolveStep", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&reply, &err); ierr != nil {
err = ierr
}
return
}
// ServerStubRoot wraps a server that implements
// RootService and provides an object that satisfies
// the requirements of veyron2/ipc.ReflectInvoker.
type ServerStubRoot struct {
service RootService
}
func (s *ServerStubRoot) GetMethodTags(method string) []interface{} {
return GetRootMethodTags(method)
}
func (s *ServerStubRoot) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
result.Methods["Reset"] = _gen_ipc.MethodSignature{
InArgs: []_gen_ipc.MethodArgument{
{Name: "Deadline", Type: 53},
},
OutArgs: []_gen_ipc.MethodArgument{
{Name: "", Type: 65},
},
}
result.TypeDefs = []_gen_idl.AnyData{
_gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
return result, nil
}
func (s *ServerStubRoot) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
if unresolver, ok := s.service.(_gen_ipc.Unresolver); ok {
return unresolver.UnresolveStep(call)
}
if call.Server() == nil {
return
}
var published []string
if published, err = call.Server().Published(); err != nil || published == nil {
return
}
reply = make([]string, len(published))
for i, p := range published {
reply[i] = _gen_naming.Join(p, call.Name())
}
return
}
func (__gen_s *ServerStubRoot) Reset(call _gen_ipc.ServerCall, Deadline uint64) (err error) {
err = __gen_s.service.Reset(call, Deadline)
return
}
func GetRootMethodTags(method string) []interface{} {
switch method {
case "Reset":
return []interface{}{}
default:
return nil
}
}