blob: 5c062f6b025f31c764b6fa5672b6326e7f1e9dab [file] [log] [blame]
// Copyright 2015 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: main
package main
import (
"v.io/v23"
"v.io/v23/context"
"v.io/v23/rpc"
)
var _ = __VDLInit() // Must be first; see __VDLInit comments for details.
//////////////////////////////////////////////////
// Interface definitions
// PingPongClientMethods is the client interface
// containing PingPong methods.
//
// Simple service used in the agent tests.
type PingPongClientMethods interface {
Ping(_ *context.T, message string, _ ...rpc.CallOpt) (string, error)
}
// PingPongClientStub adds universal methods to PingPongClientMethods.
type PingPongClientStub interface {
PingPongClientMethods
rpc.UniversalServiceMethods
}
// PingPongClient returns a client stub for PingPong.
func PingPongClient(name string) PingPongClientStub {
return implPingPongClientStub{name}
}
type implPingPongClientStub struct {
name string
}
func (c implPingPongClientStub) Ping(ctx *context.T, i0 string, opts ...rpc.CallOpt) (o0 string, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Ping", []interface{}{i0}, []interface{}{&o0}, opts...)
return
}
// PingPongServerMethods is the interface a server writer
// implements for PingPong.
//
// Simple service used in the agent tests.
type PingPongServerMethods interface {
Ping(_ *context.T, _ rpc.ServerCall, message string) (string, error)
}
// PingPongServerStubMethods is the server interface containing
// PingPong methods, as expected by rpc.Server.
// There is no difference between this interface and PingPongServerMethods
// since there are no streaming methods.
type PingPongServerStubMethods PingPongServerMethods
// PingPongServerStub adds universal methods to PingPongServerStubMethods.
type PingPongServerStub interface {
PingPongServerStubMethods
// Describe the PingPong interfaces.
Describe__() []rpc.InterfaceDesc
}
// PingPongServer returns a server stub for PingPong.
// It converts an implementation of PingPongServerMethods into
// an object that may be used by rpc.Server.
func PingPongServer(impl PingPongServerMethods) PingPongServerStub {
stub := implPingPongServerStub{
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 implPingPongServerStub struct {
impl PingPongServerMethods
gs *rpc.GlobState
}
func (s implPingPongServerStub) Ping(ctx *context.T, call rpc.ServerCall, i0 string) (string, error) {
return s.impl.Ping(ctx, call, i0)
}
func (s implPingPongServerStub) Globber() *rpc.GlobState {
return s.gs
}
func (s implPingPongServerStub) Describe__() []rpc.InterfaceDesc {
return []rpc.InterfaceDesc{PingPongDesc}
}
// PingPongDesc describes the PingPong interface.
var PingPongDesc rpc.InterfaceDesc = descPingPong
// descPingPong hides the desc to keep godoc clean.
var descPingPong = rpc.InterfaceDesc{
Name: "PingPong",
PkgPath: "v.io/x/ref/services/agent/internal/pingpong",
Doc: "// Simple service used in the agent tests.",
Methods: []rpc.MethodDesc{
{
Name: "Ping",
InArgs: []rpc.ArgDesc{
{"message", ``}, // 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{}{}
}