blob: ade1ee0d3f92abec44f9c439a99ee3b1611b087c [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.
// Source: namespace.vdl
// Package namespace defines an RPC services that allows remoting of the
// namespace client library over the wire. This is useful for
// javascript so it doesn't have to implement the library.
// This should be kept in sync with the namespace library (v.io/v23/naming).
package namespace
import (
// VDL system imports
"io"
"v.io/v23"
"v.io/v23/context"
"v.io/v23/rpc"
// VDL user imports
"time"
"v.io/v23/naming"
"v.io/v23/security/access"
_ "v.io/v23/vdlroot/time"
)
// NamespaceClientMethods is the client interface
// containing Namespace methods.
type NamespaceClientMethods interface {
// Run a glob query and stream the results.
Glob(ctx *context.T, pattern string, opts ...rpc.CallOpt) (NamespaceGlobClientCall, error)
// Mount mounts a server under the given name.
Mount(ctx *context.T, name string, server string, ttl time.Duration, replace bool, opts ...rpc.CallOpt) error
// Unmount removes an existing mount point.
Unmount(ctx *context.T, name string, server string, opts ...rpc.CallOpt) error
// Resolve resolves a name to an address.
Resolve(ctx *context.T, name string, opts ...rpc.CallOpt) ([]string, error)
// ResolveToMountTable resolves a name to the address of the mounttable
// directly hosting it.
ResolveToMountTable(ctx *context.T, name string, opts ...rpc.CallOpt) ([]string, error)
// FlushCacheEntry removes the namespace cache entry for a given name.
FlushCacheEntry(ctx *context.T, name string, opts ...rpc.CallOpt) (bool, error)
// DisableCache disables the naming cache.
DisableCache(ctx *context.T, disable bool, opts ...rpc.CallOpt) error
// Roots returns the addresses of the current mounttable roots.
Roots(*context.T, ...rpc.CallOpt) ([]string, error)
// SetRoots sets the current mounttable roots.
SetRoots(ctx *context.T, roots []string, opts ...rpc.CallOpt) error
// SetPermissions sets the AccessList in a node in a mount table.
SetPermissions(ctx *context.T, name string, perms access.Permissions, version string, opts ...rpc.CallOpt) error
// GetPermissions returns the AccessList in a node in a mount table.
GetPermissions(ctx *context.T, name string, opts ...rpc.CallOpt) (perms access.Permissions, version string, err error)
// Delete deletes the name from the mounttable and, if requested, any subtree.
Delete(ctx *context.T, name string, deleteSubtree bool, opts ...rpc.CallOpt) error
}
// NamespaceClientStub adds universal methods to NamespaceClientMethods.
type NamespaceClientStub interface {
NamespaceClientMethods
rpc.UniversalServiceMethods
}
// NamespaceClient returns a client stub for Namespace.
func NamespaceClient(name string) NamespaceClientStub {
return implNamespaceClientStub{name}
}
type implNamespaceClientStub struct {
name string
}
func (c implNamespaceClientStub) Glob(ctx *context.T, i0 string, opts ...rpc.CallOpt) (ocall NamespaceGlobClientCall, err error) {
var call rpc.ClientCall
if call, err = v23.GetClient(ctx).StartCall(ctx, c.name, "Glob", []interface{}{i0}, opts...); err != nil {
return
}
ocall = &implNamespaceGlobClientCall{ClientCall: call}
return
}
func (c implNamespaceClientStub) Mount(ctx *context.T, i0 string, i1 string, i2 time.Duration, i3 bool, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Mount", []interface{}{i0, i1, i2, i3}, nil, opts...)
return
}
func (c implNamespaceClientStub) Unmount(ctx *context.T, i0 string, i1 string, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Unmount", []interface{}{i0, i1}, nil, opts...)
return
}
func (c implNamespaceClientStub) Resolve(ctx *context.T, i0 string, opts ...rpc.CallOpt) (o0 []string, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Resolve", []interface{}{i0}, []interface{}{&o0}, opts...)
return
}
func (c implNamespaceClientStub) ResolveToMountTable(ctx *context.T, i0 string, opts ...rpc.CallOpt) (o0 []string, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "ResolveToMountTable", []interface{}{i0}, []interface{}{&o0}, opts...)
return
}
func (c implNamespaceClientStub) FlushCacheEntry(ctx *context.T, i0 string, opts ...rpc.CallOpt) (o0 bool, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "FlushCacheEntry", []interface{}{i0}, []interface{}{&o0}, opts...)
return
}
func (c implNamespaceClientStub) DisableCache(ctx *context.T, i0 bool, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "DisableCache", []interface{}{i0}, nil, opts...)
return
}
func (c implNamespaceClientStub) Roots(ctx *context.T, opts ...rpc.CallOpt) (o0 []string, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Roots", nil, []interface{}{&o0}, opts...)
return
}
func (c implNamespaceClientStub) SetRoots(ctx *context.T, i0 []string, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "SetRoots", []interface{}{i0}, nil, opts...)
return
}
func (c implNamespaceClientStub) SetPermissions(ctx *context.T, i0 string, i1 access.Permissions, i2 string, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "SetPermissions", []interface{}{i0, i1, i2}, nil, opts...)
return
}
func (c implNamespaceClientStub) GetPermissions(ctx *context.T, i0 string, opts ...rpc.CallOpt) (o0 access.Permissions, o1 string, err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "GetPermissions", []interface{}{i0}, []interface{}{&o0, &o1}, opts...)
return
}
func (c implNamespaceClientStub) Delete(ctx *context.T, i0 string, i1 bool, opts ...rpc.CallOpt) (err error) {
err = v23.GetClient(ctx).Call(ctx, c.name, "Delete", []interface{}{i0, i1}, nil, opts...)
return
}
// NamespaceGlobClientStream is the client stream for Namespace.Glob.
type NamespaceGlobClientStream interface {
// RecvStream returns the receiver side of the Namespace.Glob client stream.
RecvStream() interface {
// Advance stages an item so that it may be retrieved via Value. Returns
// true iff there is an item to retrieve. Advance must be called before
// Value is called. May block if an item is not available.
Advance() bool
// Value returns the item that was staged by Advance. May panic if Advance
// returned false or was not called. Never blocks.
Value() naming.GlobReply
// Err returns any error encountered by Advance. Never blocks.
Err() error
}
}
// NamespaceGlobClientCall represents the call returned from Namespace.Glob.
type NamespaceGlobClientCall interface {
NamespaceGlobClientStream
// Finish blocks until the server is done, and returns the positional return
// values for call.
//
// Finish returns immediately if the call has been canceled; depending on the
// timing the output could either be an error signaling cancelation, or the
// valid positional return values from the server.
//
// Calling Finish is mandatory for releasing stream resources, unless the call
// has been canceled or any of the other methods return an error. Finish should
// be called at most once.
Finish() error
}
type implNamespaceGlobClientCall struct {
rpc.ClientCall
valRecv naming.GlobReply
errRecv error
}
func (c *implNamespaceGlobClientCall) RecvStream() interface {
Advance() bool
Value() naming.GlobReply
Err() error
} {
return implNamespaceGlobClientCallRecv{c}
}
type implNamespaceGlobClientCallRecv struct {
c *implNamespaceGlobClientCall
}
func (c implNamespaceGlobClientCallRecv) Advance() bool {
c.c.errRecv = c.c.Recv(&c.c.valRecv)
return c.c.errRecv == nil
}
func (c implNamespaceGlobClientCallRecv) Value() naming.GlobReply {
return c.c.valRecv
}
func (c implNamespaceGlobClientCallRecv) Err() error {
if c.c.errRecv == io.EOF {
return nil
}
return c.c.errRecv
}
func (c *implNamespaceGlobClientCall) Finish() (err error) {
err = c.ClientCall.Finish()
return
}
// NamespaceServerMethods is the interface a server writer
// implements for Namespace.
type NamespaceServerMethods interface {
// Run a glob query and stream the results.
Glob(ctx *context.T, call NamespaceGlobServerCall, pattern string) error
// Mount mounts a server under the given name.
Mount(ctx *context.T, call rpc.ServerCall, name string, server string, ttl time.Duration, replace bool) error
// Unmount removes an existing mount point.
Unmount(ctx *context.T, call rpc.ServerCall, name string, server string) error
// Resolve resolves a name to an address.
Resolve(ctx *context.T, call rpc.ServerCall, name string) ([]string, error)
// ResolveToMountTable resolves a name to the address of the mounttable
// directly hosting it.
ResolveToMountTable(ctx *context.T, call rpc.ServerCall, name string) ([]string, error)
// FlushCacheEntry removes the namespace cache entry for a given name.
FlushCacheEntry(ctx *context.T, call rpc.ServerCall, name string) (bool, error)
// DisableCache disables the naming cache.
DisableCache(ctx *context.T, call rpc.ServerCall, disable bool) error
// Roots returns the addresses of the current mounttable roots.
Roots(*context.T, rpc.ServerCall) ([]string, error)
// SetRoots sets the current mounttable roots.
SetRoots(ctx *context.T, call rpc.ServerCall, roots []string) error
// SetPermissions sets the AccessList in a node in a mount table.
SetPermissions(ctx *context.T, call rpc.ServerCall, name string, perms access.Permissions, version string) error
// GetPermissions returns the AccessList in a node in a mount table.
GetPermissions(ctx *context.T, call rpc.ServerCall, name string) (perms access.Permissions, version string, err error)
// Delete deletes the name from the mounttable and, if requested, any subtree.
Delete(ctx *context.T, call rpc.ServerCall, name string, deleteSubtree bool) error
}
// NamespaceServerStubMethods is the server interface containing
// Namespace methods, as expected by rpc.Server.
// The only difference between this interface and NamespaceServerMethods
// is the streaming methods.
type NamespaceServerStubMethods interface {
// Run a glob query and stream the results.
Glob(ctx *context.T, call *NamespaceGlobServerCallStub, pattern string) error
// Mount mounts a server under the given name.
Mount(ctx *context.T, call rpc.ServerCall, name string, server string, ttl time.Duration, replace bool) error
// Unmount removes an existing mount point.
Unmount(ctx *context.T, call rpc.ServerCall, name string, server string) error
// Resolve resolves a name to an address.
Resolve(ctx *context.T, call rpc.ServerCall, name string) ([]string, error)
// ResolveToMountTable resolves a name to the address of the mounttable
// directly hosting it.
ResolveToMountTable(ctx *context.T, call rpc.ServerCall, name string) ([]string, error)
// FlushCacheEntry removes the namespace cache entry for a given name.
FlushCacheEntry(ctx *context.T, call rpc.ServerCall, name string) (bool, error)
// DisableCache disables the naming cache.
DisableCache(ctx *context.T, call rpc.ServerCall, disable bool) error
// Roots returns the addresses of the current mounttable roots.
Roots(*context.T, rpc.ServerCall) ([]string, error)
// SetRoots sets the current mounttable roots.
SetRoots(ctx *context.T, call rpc.ServerCall, roots []string) error
// SetPermissions sets the AccessList in a node in a mount table.
SetPermissions(ctx *context.T, call rpc.ServerCall, name string, perms access.Permissions, version string) error
// GetPermissions returns the AccessList in a node in a mount table.
GetPermissions(ctx *context.T, call rpc.ServerCall, name string) (perms access.Permissions, version string, err error)
// Delete deletes the name from the mounttable and, if requested, any subtree.
Delete(ctx *context.T, call rpc.ServerCall, name string, deleteSubtree bool) error
}
// NamespaceServerStub adds universal methods to NamespaceServerStubMethods.
type NamespaceServerStub interface {
NamespaceServerStubMethods
// Describe the Namespace interfaces.
Describe__() []rpc.InterfaceDesc
}
// NamespaceServer returns a server stub for Namespace.
// It converts an implementation of NamespaceServerMethods into
// an object that may be used by rpc.Server.
func NamespaceServer(impl NamespaceServerMethods) NamespaceServerStub {
stub := implNamespaceServerStub{
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 implNamespaceServerStub struct {
impl NamespaceServerMethods
gs *rpc.GlobState
}
func (s implNamespaceServerStub) Glob(ctx *context.T, call *NamespaceGlobServerCallStub, i0 string) error {
return s.impl.Glob(ctx, call, i0)
}
func (s implNamespaceServerStub) Mount(ctx *context.T, call rpc.ServerCall, i0 string, i1 string, i2 time.Duration, i3 bool) error {
return s.impl.Mount(ctx, call, i0, i1, i2, i3)
}
func (s implNamespaceServerStub) Unmount(ctx *context.T, call rpc.ServerCall, i0 string, i1 string) error {
return s.impl.Unmount(ctx, call, i0, i1)
}
func (s implNamespaceServerStub) Resolve(ctx *context.T, call rpc.ServerCall, i0 string) ([]string, error) {
return s.impl.Resolve(ctx, call, i0)
}
func (s implNamespaceServerStub) ResolveToMountTable(ctx *context.T, call rpc.ServerCall, i0 string) ([]string, error) {
return s.impl.ResolveToMountTable(ctx, call, i0)
}
func (s implNamespaceServerStub) FlushCacheEntry(ctx *context.T, call rpc.ServerCall, i0 string) (bool, error) {
return s.impl.FlushCacheEntry(ctx, call, i0)
}
func (s implNamespaceServerStub) DisableCache(ctx *context.T, call rpc.ServerCall, i0 bool) error {
return s.impl.DisableCache(ctx, call, i0)
}
func (s implNamespaceServerStub) Roots(ctx *context.T, call rpc.ServerCall) ([]string, error) {
return s.impl.Roots(ctx, call)
}
func (s implNamespaceServerStub) SetRoots(ctx *context.T, call rpc.ServerCall, i0 []string) error {
return s.impl.SetRoots(ctx, call, i0)
}
func (s implNamespaceServerStub) SetPermissions(ctx *context.T, call rpc.ServerCall, i0 string, i1 access.Permissions, i2 string) error {
return s.impl.SetPermissions(ctx, call, i0, i1, i2)
}
func (s implNamespaceServerStub) GetPermissions(ctx *context.T, call rpc.ServerCall, i0 string) (access.Permissions, string, error) {
return s.impl.GetPermissions(ctx, call, i0)
}
func (s implNamespaceServerStub) Delete(ctx *context.T, call rpc.ServerCall, i0 string, i1 bool) error {
return s.impl.Delete(ctx, call, i0, i1)
}
func (s implNamespaceServerStub) Globber() *rpc.GlobState {
return s.gs
}
func (s implNamespaceServerStub) Describe__() []rpc.InterfaceDesc {
return []rpc.InterfaceDesc{NamespaceDesc}
}
// NamespaceDesc describes the Namespace interface.
var NamespaceDesc rpc.InterfaceDesc = descNamespace
// descNamespace hides the desc to keep godoc clean.
var descNamespace = rpc.InterfaceDesc{
Name: "Namespace",
PkgPath: "v.io/x/ref/services/wspr/internal/namespace",
Methods: []rpc.MethodDesc{
{
Name: "Glob",
Doc: "// Run a glob query and stream the results.",
InArgs: []rpc.ArgDesc{
{"pattern", ``}, // string
},
},
{
Name: "Mount",
Doc: "// Mount mounts a server under the given name.",
InArgs: []rpc.ArgDesc{
{"name", ``}, // string
{"server", ``}, // string
{"ttl", ``}, // time.Duration
{"replace", ``}, // bool
},
},
{
Name: "Unmount",
Doc: "// Unmount removes an existing mount point.",
InArgs: []rpc.ArgDesc{
{"name", ``}, // string
{"server", ``}, // string
},
},
{
Name: "Resolve",
Doc: "// Resolve resolves a name to an address.",
InArgs: []rpc.ArgDesc{
{"name", ``}, // string
},
OutArgs: []rpc.ArgDesc{
{"", ``}, // []string
},
},
{
Name: "ResolveToMountTable",
Doc: "// ResolveToMountTable resolves a name to the address of the mounttable\n// directly hosting it.",
InArgs: []rpc.ArgDesc{
{"name", ``}, // string
},
OutArgs: []rpc.ArgDesc{
{"", ``}, // []string
},
},
{
Name: "FlushCacheEntry",
Doc: "// FlushCacheEntry removes the namespace cache entry for a given name.",
InArgs: []rpc.ArgDesc{
{"name", ``}, // string
},
OutArgs: []rpc.ArgDesc{
{"", ``}, // bool
},
},
{
Name: "DisableCache",
Doc: "// DisableCache disables the naming cache.",
InArgs: []rpc.ArgDesc{
{"disable", ``}, // bool
},
},
{
Name: "Roots",
Doc: "// Roots returns the addresses of the current mounttable roots.",
OutArgs: []rpc.ArgDesc{
{"", ``}, // []string
},
},
{
Name: "SetRoots",
Doc: "// SetRoots sets the current mounttable roots.",
InArgs: []rpc.ArgDesc{
{"roots", ``}, // []string
},
},
{
Name: "SetPermissions",
Doc: "// SetPermissions sets the AccessList in a node in a mount table.",
InArgs: []rpc.ArgDesc{
{"name", ``}, // string
{"perms", ``}, // access.Permissions
{"version", ``}, // string
},
},
{
Name: "GetPermissions",
Doc: "// GetPermissions returns the AccessList in a node in a mount table.",
InArgs: []rpc.ArgDesc{
{"name", ``}, // string
},
OutArgs: []rpc.ArgDesc{
{"perms", ``}, // access.Permissions
{"version", ``}, // string
},
},
{
Name: "Delete",
Doc: "// Delete deletes the name from the mounttable and, if requested, any subtree.",
InArgs: []rpc.ArgDesc{
{"name", ``}, // string
{"deleteSubtree", ``}, // bool
},
},
},
}
// NamespaceGlobServerStream is the server stream for Namespace.Glob.
type NamespaceGlobServerStream interface {
// SendStream returns the send side of the Namespace.Glob server stream.
SendStream() interface {
// Send places the item onto the output stream. Returns errors encountered
// while sending. Blocks if there is no buffer space; will unblock when
// buffer space is available.
Send(item naming.GlobReply) error
}
}
// NamespaceGlobServerCall represents the context passed to Namespace.Glob.
type NamespaceGlobServerCall interface {
rpc.ServerCall
NamespaceGlobServerStream
}
// NamespaceGlobServerCallStub is a wrapper that converts rpc.StreamServerCall into
// a typesafe stub that implements NamespaceGlobServerCall.
type NamespaceGlobServerCallStub struct {
rpc.StreamServerCall
}
// Init initializes NamespaceGlobServerCallStub from rpc.StreamServerCall.
func (s *NamespaceGlobServerCallStub) Init(call rpc.StreamServerCall) {
s.StreamServerCall = call
}
// SendStream returns the send side of the Namespace.Glob server stream.
func (s *NamespaceGlobServerCallStub) SendStream() interface {
Send(item naming.GlobReply) error
} {
return implNamespaceGlobServerCallSend{s}
}
type implNamespaceGlobServerCallSend struct {
s *NamespaceGlobServerCallStub
}
func (s implNamespaceGlobServerCallSend) Send(item naming.GlobReply) error {
return s.s.Send(item)
}