vine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: BSD-3-Clause Imports: 15 Imported by: 6

Documentation

Overview

Package vine contains Vanadium's Implementation of Network Emulation (VINE). VINE provides the ability to dynamically specific a network topology (e.g. A can reach B, but A cannot reach C) with various network charcteristics (e.g. A can reach B with latency of 500ms). This can be useful for testing Vanadium applications under unpredictable and unfriendly network conditions.

This file was auto-generated by the vanadium vdl tool. Package: vine

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAddress       = verror.NewIDAction("v.io/x/ref/runtime/protocols/vine.InvalidAddress", verror.NoRetry)
	ErrAddressNotReachable  = verror.NewIDAction("v.io/x/ref/runtime/protocols/vine.AddressNotReachable", verror.NoRetry)
	ErrNoRegisteredProtocol = verror.NewIDAction("v.io/x/ref/runtime/protocols/vine.NoRegisteredProtocol", verror.NoRetry)
	ErrCantAcceptFromTag    = verror.NewIDAction("v.io/x/ref/runtime/protocols/vine.CantAcceptFromTag", verror.NoRetry)
)
View Source
var VineDesc rpc.InterfaceDesc = descVine

VineDesc describes the Vine interface.

Functions

func ErrorfAddressNotReachable added in v0.1.10

func ErrorfAddressNotReachable(ctx *context.T, format string, address string) error

ErrorfAddressNotReachable calls ErrAddressNotReachable.Errorf with the supplied arguments.

func ErrorfCantAcceptFromTag added in v0.1.10

func ErrorfCantAcceptFromTag(ctx *context.T, format string, tag string) error

ErrorfCantAcceptFromTag calls ErrCantAcceptFromTag.Errorf with the supplied arguments.

func ErrorfInvalidAddress added in v0.1.10

func ErrorfInvalidAddress(ctx *context.T, format string, address string) error

ErrorfInvalidAddress calls ErrInvalidAddress.Errorf with the supplied arguments.

func ErrorfNoRegisteredProtocol added in v0.1.10

func ErrorfNoRegisteredProtocol(ctx *context.T, format string, protocol string) error

ErrorfNoRegisteredProtocol calls ErrNoRegisteredProtocol.Errorf with the supplied arguments.

func Init

func Init(ctx *context.T, name string, auth security.Authorizer, localTag string, discoveryTTL time.Duration) (*context.T, func(), error)

Init initializes the vine server mounted under name using auth as its authorization policy and registers the vine protocol. discoveryTTL specifies the ttl of scanned advertisings for the vine discovery plugin. The ctx returned from Init: (1) has localTag as the default localTag for dialers and acceptors. (2) has all addresses in the listenspec altered to listen on the vine protocol.

func MessageAddressNotReachable added in v0.1.10

func MessageAddressNotReachable(ctx *context.T, message string, address string) error

MessageAddressNotReachable calls ErrAddressNotReachable.Message with the supplied arguments.

func MessageCantAcceptFromTag added in v0.1.10

func MessageCantAcceptFromTag(ctx *context.T, message string, tag string) error

MessageCantAcceptFromTag calls ErrCantAcceptFromTag.Message with the supplied arguments.

func MessageInvalidAddress added in v0.1.10

func MessageInvalidAddress(ctx *context.T, message string, address string) error

MessageInvalidAddress calls ErrInvalidAddress.Message with the supplied arguments.

func MessageNoRegisteredProtocol added in v0.1.10

func MessageNoRegisteredProtocol(ctx *context.T, message string, protocol string) error

MessageNoRegisteredProtocol calls ErrNoRegisteredProtocol.Message with the supplied arguments.

func ParamsErrAddressNotReachable added in v0.1.10

func ParamsErrAddressNotReachable(argumentError error) (verrorComponent string, verrorOperation string, address string, returnErr error)

ParamsErrAddressNotReachable extracts the expected parameters from the error's ParameterList.

func ParamsErrCantAcceptFromTag added in v0.1.10

func ParamsErrCantAcceptFromTag(argumentError error) (verrorComponent string, verrorOperation string, tag string, returnErr error)

ParamsErrCantAcceptFromTag extracts the expected parameters from the error's ParameterList.

func ParamsErrInvalidAddress added in v0.1.10

func ParamsErrInvalidAddress(argumentError error) (verrorComponent string, verrorOperation string, address string, returnErr error)

ParamsErrInvalidAddress extracts the expected parameters from the error's ParameterList.

func ParamsErrNoRegisteredProtocol added in v0.1.10

func ParamsErrNoRegisteredProtocol(argumentError error) (verrorComponent string, verrorOperation string, protocol string, returnErr error)

ParamsErrNoRegisteredProtocol extracts the expected parameters from the error's ParameterList.

func WithLocalTag

func WithLocalTag(ctx *context.T, tag string) *context.T

WithLocalTag returns a ctx that will have localTag as the default localTag for dialers and acceptors. This local tag will be inserted into any listening endpoints. i.e "net/address" -> "net/address/tag"

Types

type PeerBehavior

type PeerBehavior struct {
	// Reachable specifies whether the outgoing or incoming connection can be
	// dialed or accepted.
	// TODO(suharshs): Make this a user defined error which vine will return instead of a bool.
	Reachable bool
	// Discoverable specifies whether the Dialer can advertise a discovery packet
	// to the Acceptor. This is useful for emulating neighborhoods.
	// TODO(suharshs): Discoverable should always be bidirectional. It is unrealistic for
	// A to discover B, but not vice versa.
	Discoverable bool
}

PeerBehavior specifies characteristics of a connection.

func (PeerBehavior) VDLIsZero

func (x PeerBehavior) VDLIsZero() bool

func (*PeerBehavior) VDLRead

func (x *PeerBehavior) VDLRead(dec vdl.Decoder) error

func (PeerBehavior) VDLReflect

func (PeerBehavior) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/runtime/protocols/vine.PeerBehavior"`
})

func (PeerBehavior) VDLWrite

func (x PeerBehavior) VDLWrite(enc vdl.Encoder) error

type PeerKey

type PeerKey struct {
	Dialer   string
	Acceptor string
}

Type definitions ================ PeerKey is a key that represents a connection from a Dialer tag to an Acceptor tag.

func (PeerKey) VDLIsZero

func (x PeerKey) VDLIsZero() bool

func (*PeerKey) VDLRead

func (x *PeerKey) VDLRead(dec vdl.Decoder) error

func (PeerKey) VDLReflect

func (PeerKey) VDLReflect(struct {
	Name string `vdl:"v.io/x/ref/runtime/protocols/vine.PeerKey"`
})

func (PeerKey) VDLWrite

func (x PeerKey) VDLWrite(enc vdl.Encoder) error

type VineClientMethods

type VineClientMethods interface {
	// SetBehaviors sets the policy that the accepting vine service's process
	// will use on connections.
	// behaviors is a map from server tag to the desired connection behavior.
	// For example,
	//   client.SetBehaviors(map[PeerKey]PeerBehavior{PeerKey{"foo", "bar"}, PeerBehavior{Reachable: false}})
	// will cause all vine protocol dial calls from "foo" to "bar" to fail.
	SetBehaviors(_ *context.T, behaviors map[PeerKey]PeerBehavior, _ ...rpc.CallOpt) error
}

VineClientMethods is the client interface containing Vine methods.

Vine is the interface to a vine service that can dynamically change the network behavior of connection's on the vine service's process.

type VineClientStub

type VineClientStub interface {
	VineClientMethods
}

VineClientStub embeds VineClientMethods and is a placeholder for additional management operations.

func VineClient

func VineClient(name string) VineClientStub

VineClient returns a client stub for Vine.

type VineServerMethods

type VineServerMethods interface {
	// SetBehaviors sets the policy that the accepting vine service's process
	// will use on connections.
	// behaviors is a map from server tag to the desired connection behavior.
	// For example,
	//   client.SetBehaviors(map[PeerKey]PeerBehavior{PeerKey{"foo", "bar"}, PeerBehavior{Reachable: false}})
	// will cause all vine protocol dial calls from "foo" to "bar" to fail.
	SetBehaviors(_ *context.T, _ rpc.ServerCall, behaviors map[PeerKey]PeerBehavior) error
}

VineServerMethods is the interface a server writer implements for Vine.

Vine is the interface to a vine service that can dynamically change the network behavior of connection's on the vine service's process.

type VineServerStub

type VineServerStub interface {
	VineServerStubMethods
	// DescribeInterfaces the Vine interfaces.
	Describe__() []rpc.InterfaceDesc
}

VineServerStub adds universal methods to VineServerStubMethods.

func VineServer

func VineServer(impl VineServerMethods) VineServerStub

VineServer returns a server stub for Vine. It converts an implementation of VineServerMethods into an object that may be used by rpc.Server.

type VineServerStubMethods

type VineServerStubMethods VineServerMethods

VineServerStubMethods is the server interface containing Vine methods, as expected by rpc.Server. There is no difference between this interface and VineServerMethods since there are no streaming methods.

Jump to

Keyboard shortcuts

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