mounttablelib

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2020 License: BSD-3-Clause Imports: 33 Imported by: 22

Documentation

Overview

Package mounttablelib implements utilities for mounttable implementations.

Index

Constants

This section is empty.

Variables

View Source
var CollectionDesc rpc.InterfaceDesc = descCollection

CollectionDesc describes the Collection interface.

Functions

func Main

func Main(opts Opts) error

func MainWithCtx

func MainWithCtx(ctx *context.T, opts Opts) error

func NewLoopbackNeighborhoodDispatcher

func NewLoopbackNeighborhoodDispatcher(host string, addresses ...string) (rpc.Dispatcher, error)

NewLoopbackNeighborhoodDispatcher creates a new instance of a dispatcher for a neighborhood service provider on loopback interfaces (meant for testing).

func NewMountTableDispatcher

func NewMountTableDispatcher(ctx *context.T, permsFile, persistDir, statsPrefix string) (rpc.Dispatcher, error)

NewMountTableDispatcher creates a new server that uses the AccessLists specified in permissions file for authorization.

permsFile is a JSON-encoded mapping from paths in the mounttable to the access.Permissions for that path. The tags used in the map are the typical access tags (the Tag type defined in v.io/v23/security/access).

persistDir is the directory for persisting Permissions.

statsPrefix is the prefix for for exported statistics objects.

func NewMountTableDispatcherWithClock

func NewMountTableDispatcherWithClock(ctx *context.T, permsFile, persistDir, statsPrefix string, clock timekeeper.TimeKeeper) (rpc.Dispatcher, error)

func NewNeighborhoodDispatcher

func NewNeighborhoodDispatcher(host string, addresses ...string) (rpc.Dispatcher, error)

NewNeighborhoodDispatcher creates a new instance of a dispatcher for a neighborhood service provider.

func StartServers

func StartServers(ctx *context.T, listenSpec rpc.ListenSpec, mountName, nhName, permsFile, persistDir, debugPrefix string) (string, func(), error)

Types

type CollectionClientMethods

type CollectionClientMethods interface {
	// Export sets the value for a name.  Overwrite controls the behavior when
	// an entry exists, if Overwrite is true, then the binding is replaced,
	// otherwise the call fails with an error.  The Val must be no larger than
	// MaxSize bytes.
	Export(_ *context.T, Val string, Overwrite bool, _ ...rpc.CallOpt) error
	// Lookup retrieves the value associated with a name.  Returns an error if
	// there is no such binding.
	Lookup(*context.T, ...rpc.CallOpt) ([]byte, error)
}

CollectionClientMethods is the client interface containing Collection methods.

type CollectionClientStub

type CollectionClientStub interface {
	CollectionClientMethods
}

CollectionClientStub embeds CollectionClientMethods and is a placeholder for additional management operations.

func CollectionClient

func CollectionClient(name string) CollectionClientStub

CollectionClient returns a client stub for Collection.

type CollectionServerMethods

type CollectionServerMethods interface {
	// Export sets the value for a name.  Overwrite controls the behavior when
	// an entry exists, if Overwrite is true, then the binding is replaced,
	// otherwise the call fails with an error.  The Val must be no larger than
	// MaxSize bytes.
	Export(_ *context.T, _ rpc.ServerCall, Val string, Overwrite bool) error
	// Lookup retrieves the value associated with a name.  Returns an error if
	// there is no such binding.
	Lookup(*context.T, rpc.ServerCall) ([]byte, error)
}

CollectionServerMethods is the interface a server writer implements for Collection.

type CollectionServerStub

type CollectionServerStub interface {
	CollectionServerStubMethods
	// DescribeInterfaces the Collection interfaces.
	Describe__() []rpc.InterfaceDesc
}

CollectionServerStub adds universal methods to CollectionServerStubMethods.

func CollectionServer

func CollectionServer(impl CollectionServerMethods) CollectionServerStub

CollectionServer returns a server stub for Collection. It converts an implementation of CollectionServerMethods into an object that may be used by rpc.Server.

type CollectionServerStubMethods

type CollectionServerStubMethods CollectionServerMethods

CollectionServerStubMethods is the server interface containing Collection methods, as expected by rpc.Server. There is no difference between this interface and CollectionServerMethods since there are no streaming methods.

type Opts

type Opts struct {
	MountName  string
	AclFile    string //nolint:golint // API change required.
	NhName     string
	PersistDir string
}

func (*Opts) InitFlags

func (o *Opts) InitFlags(f *flag.FlagSet)

Note: Where possible, we have flag default values be zero values, so that struct-based configuration matches flag-based configuration.

type VersionedPermissions

type VersionedPermissions struct {
	V int32
	P access.Permissions
}

VersionedPermissions associates a Version with a Permissions

func CopyPermissions

func CopyPermissions(cc *callContext, cur *node) *VersionedPermissions

CopyPermissions copies one node's permissions to another and adds the clients blessings as patterns to the Admin tag.

func NewVersionedPermissions

func NewVersionedPermissions() *VersionedPermissions

func (*VersionedPermissions) AccessListForTag

func (b *VersionedPermissions) AccessListForTag(tag string) (access.AccessList, bool)

AccessListForTag returns the current access list for the given tag.

func (*VersionedPermissions) Add

func (b *VersionedPermissions) Add(pattern security.BlessingPattern, tag string)

Add adds the blessing pattern to the tag in the receiver.

func (*VersionedPermissions) Copy

Copy copies the receiver.

func (*VersionedPermissions) Get

Get returns the current Version and Permissions.

func (*VersionedPermissions) Set

Set sets the Permissions iff Version matches the current Version. If the set happens, the Version is advanced. If b is nil, this creates a new VersionedPermissions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL