blob: e7e2009f53cdb0e10fa0a9b76844caa4605b034a [file] [log] [blame]
// This file was auto-generated by the veyron vdl tool.
// Source: fortune.vdl
// index=3
package fortune
import (
// The non-user imports are prefixed with "__" to prevent collisions.
__veyron2 "v.io/core/veyron2"
__context "v.io/core/veyron2/context"
__ipc "v.io/core/veyron2/ipc"
)
// FortuneClientMethods is the client interface
// containing Fortune methods.
type FortuneClientMethods interface {
// Returns a random fortune.
Get(*__context.T, ...__ipc.CallOpt) (Fortune string, err error)
// Adds a fortune to the set used by Get().
Add(ctx *__context.T, Fortune string, opts ...__ipc.CallOpt) error
}
// FortuneClientStub adds universal methods to FortuneClientMethods.
type FortuneClientStub interface {
FortuneClientMethods
__ipc.UniversalServiceMethods
}
// FortuneClient returns a client stub for Fortune.
func FortuneClient(name string, opts ...__ipc.BindOpt) FortuneClientStub {
var client __ipc.Client
for _, opt := range opts {
if clientOpt, ok := opt.(__ipc.Client); ok {
client = clientOpt
}
}
return implFortuneClientStub{name, client}
}
type implFortuneClientStub struct {
name string
client __ipc.Client
}
func (c implFortuneClientStub) c(ctx *__context.T) __ipc.Client {
if c.client != nil {
return c.client
}
return __veyron2.GetClient(ctx)
}
func (c implFortuneClientStub) Get(ctx *__context.T, opts ...__ipc.CallOpt) (o0 string, err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Get", nil, opts...); err != nil {
return
}
if ierr := call.Finish(&o0, &err); ierr != nil {
err = ierr
}
return
}
func (c implFortuneClientStub) Add(ctx *__context.T, i0 string, opts ...__ipc.CallOpt) (err error) {
var call __ipc.Call
if call, err = c.c(ctx).StartCall(ctx, c.name, "Add", []interface{}{i0}, opts...); err != nil {
return
}
if ierr := call.Finish(&err); ierr != nil {
err = ierr
}
return
}
// FortuneServerMethods is the interface a server writer
// implements for Fortune.
type FortuneServerMethods interface {
// Returns a random fortune.
Get(__ipc.ServerContext) (Fortune string, err error)
// Adds a fortune to the set used by Get().
Add(ctx __ipc.ServerContext, Fortune string) error
}
// FortuneServerStubMethods is the server interface containing
// Fortune methods, as expected by ipc.Server.
// There is no difference between this interface and FortuneServerMethods
// since there are no streaming methods.
type FortuneServerStubMethods FortuneServerMethods
// FortuneServerStub adds universal methods to FortuneServerStubMethods.
type FortuneServerStub interface {
FortuneServerStubMethods
// Describe the Fortune interfaces.
Describe__() []__ipc.InterfaceDesc
}
// FortuneServer returns a server stub for Fortune.
// It converts an implementation of FortuneServerMethods into
// an object that may be used by ipc.Server.
func FortuneServer(impl FortuneServerMethods) FortuneServerStub {
stub := implFortuneServerStub{
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 := __ipc.NewGlobState(stub); gs != nil {
stub.gs = gs
} else if gs := __ipc.NewGlobState(impl); gs != nil {
stub.gs = gs
}
return stub
}
type implFortuneServerStub struct {
impl FortuneServerMethods
gs *__ipc.GlobState
}
func (s implFortuneServerStub) Get(ctx __ipc.ServerContext) (string, error) {
return s.impl.Get(ctx)
}
func (s implFortuneServerStub) Add(ctx __ipc.ServerContext, i0 string) error {
return s.impl.Add(ctx, i0)
}
func (s implFortuneServerStub) Globber() *__ipc.GlobState {
return s.gs
}
func (s implFortuneServerStub) Describe__() []__ipc.InterfaceDesc {
return []__ipc.InterfaceDesc{FortuneDesc}
}
// FortuneDesc describes the Fortune interface.
var FortuneDesc __ipc.InterfaceDesc = descFortune
// descFortune hides the desc to keep godoc clean.
var descFortune = __ipc.InterfaceDesc{
Name: "Fortune",
PkgPath: "v.io/playground/client/bundles/fortune/ex0_go/src/fortune",
Methods: []__ipc.MethodDesc{
{
Name: "Get",
Doc: "// Returns a random fortune.",
OutArgs: []__ipc.ArgDesc{
{"Fortune", ``}, // string
{"err", ``}, // error
},
},
{
Name: "Add",
Doc: "// Adds a fortune to the set used by Get().",
InArgs: []__ipc.ArgDesc{
{"Fortune", ``}, // string
},
OutArgs: []__ipc.ArgDesc{
{"", ``}, // error
},
},
},
}