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.
Index ¶
- Variables
- func ErrorfAddressNotReachable(ctx *context.T, format string, address string) error
- func ErrorfCantAcceptFromTag(ctx *context.T, format string, tag string) error
- func ErrorfInvalidAddress(ctx *context.T, format string, address string) error
- func ErrorfNoRegisteredProtocol(ctx *context.T, format string, protocol string) error
- func Init(ctx *context.T, name string, auth security.Authorizer, localTag string, ...) (*context.T, func(), error)
- func MessageAddressNotReachable(ctx *context.T, message string, address string) error
- func MessageCantAcceptFromTag(ctx *context.T, message string, tag string) error
- func MessageInvalidAddress(ctx *context.T, message string, address string) error
- func MessageNoRegisteredProtocol(ctx *context.T, message string, protocol string) error
- func NewErrAddressNotReachable(ctx *context.T, address string) error
- func NewErrCantAcceptFromTag(ctx *context.T, tag string) error
- func NewErrInvalidAddress(ctx *context.T, address string) error
- func NewErrNoRegisteredProtocol(ctx *context.T, protocol string) error
- func ParamsErrAddressNotReachable(argumentError error) (verrorComponent string, verrorOperation string, address string, ...)
- func ParamsErrCantAcceptFromTag(argumentError error) (verrorComponent string, verrorOperation string, tag string, returnErr error)
- func ParamsErrInvalidAddress(argumentError error) (verrorComponent string, verrorOperation string, address string, ...)
- func ParamsErrNoRegisteredProtocol(argumentError error) (verrorComponent string, verrorOperation string, protocol string, ...)
- func WithLocalTag(ctx *context.T, tag string) *context.T
- type PeerBehavior
- type PeerKey
- type VineClientMethods
- type VineClientStub
- type VineServerMethods
- type VineServerStub
- type VineServerStubMethods
Constants ¶
This section is empty.
Variables ¶
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) )
var VineDesc rpc.InterfaceDesc = descVine
VineDesc describes the Vine interface.
Functions ¶
func ErrorfAddressNotReachable ¶ added in v0.1.10
ErrorfAddressNotReachable calls ErrAddressNotReachable.Errorf with the supplied arguments.
func ErrorfCantAcceptFromTag ¶ added in v0.1.10
ErrorfCantAcceptFromTag calls ErrCantAcceptFromTag.Errorf with the supplied arguments.
func ErrorfInvalidAddress ¶ added in v0.1.10
ErrorfInvalidAddress calls ErrInvalidAddress.Errorf with the supplied arguments.
func ErrorfNoRegisteredProtocol ¶ added in v0.1.10
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
MessageAddressNotReachable calls ErrAddressNotReachable.Message with the supplied arguments.
func MessageCantAcceptFromTag ¶ added in v0.1.10
MessageCantAcceptFromTag calls ErrCantAcceptFromTag.Message with the supplied arguments.
func MessageInvalidAddress ¶ added in v0.1.10
MessageInvalidAddress calls ErrInvalidAddress.Message with the supplied arguments.
func MessageNoRegisteredProtocol ¶ added in v0.1.10
MessageNoRegisteredProtocol calls ErrNoRegisteredProtocol.Message with the supplied arguments.
func NewErrAddressNotReachable ¶
NewErrAddressNotReachable returns an error with the ErrAddressNotReachable ID. Deprecated: this function will be removed in the future, use ErrorfAddressNotReachable or MessageAddressNotReachable instead.
func NewErrCantAcceptFromTag ¶
NewErrCantAcceptFromTag returns an error with the ErrCantAcceptFromTag ID. Deprecated: this function will be removed in the future, use ErrorfCantAcceptFromTag or MessageCantAcceptFromTag instead.
func NewErrInvalidAddress ¶
NewErrInvalidAddress returns an error with the ErrInvalidAddress ID. Deprecated: this function will be removed in the future, use ErrorfInvalidAddress or MessageInvalidAddress instead.
func NewErrNoRegisteredProtocol ¶
NewErrNoRegisteredProtocol returns an error with the ErrNoRegisteredProtocol ID. Deprecated: this function will be removed in the future, use ErrorfNoRegisteredProtocol or MessageNoRegisteredProtocol instead.
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.
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) VDLReflect ¶
func (PeerBehavior) VDLReflect(struct { Name string `vdl:"v.io/x/ref/runtime/protocols/vine.PeerBehavior"` })
type PeerKey ¶
PeerKey is a key that represents a connection from a Dialer tag to an Acceptor tag.
func (PeerKey) VDLReflect ¶
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.