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 Init(ctx *context.T, name string, auth security.Authorizer, localTag string, ...) (*context.T, func(), 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 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.Register("v.io/x/ref/runtime/protocols/vine.InvalidAddress", verror.NoRetry, "{1:}{2:} invalid vine address {3}, address must be of the form 'network/address/tag'") ErrAddressNotReachable = verror.Register("v.io/x/ref/runtime/protocols/vine.AddressNotReachable", verror.NoRetry, "{1:}{2:} address {3} not reachable") ErrNoRegisteredProtocol = verror.Register("v.io/x/ref/runtime/protocols/vine.NoRegisteredProtocol", verror.NoRetry, "{1:}{2:} no registered protocol {3}") ErrCantAcceptFromTag = verror.Register("v.io/x/ref/runtime/protocols/vine.CantAcceptFromTag", verror.NoRetry, "{1:}{2:} can't accept connection from tag {3}") )
var VineDesc rpc.InterfaceDesc = descVine
VineDesc describes the Vine interface.
Functions ¶
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 NewErrAddressNotReachable ¶
NewErrAddressNotReachable returns an error with the ErrAddressNotReachable ID.
func NewErrCantAcceptFromTag ¶
NewErrCantAcceptFromTag returns an error with the ErrCantAcceptFromTag ID.
func NewErrInvalidAddress ¶
NewErrInvalidAddress returns an error with the ErrInvalidAddress ID.
func NewErrNoRegisteredProtocol ¶
NewErrNoRegisteredProtocol returns an error with the ErrNoRegisteredProtocol ID.
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 rpc.UniversalServiceMethods }
VineClientStub adds universal methods to VineClientMethods.
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 // Describe 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.