Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
const NetworkPluginEndpointType = "NetworkDriver"
    NetworkPluginEndpointType represents the Endpoint Type used by Plugin system
const ( // NodeDiscovery represents Node join/leave events provided by discovery NodeDiscovery = iota + 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capability ¶
type Capability struct {
	DataScope string
}
    Capability represents the high level capabilities of the drivers which libnetwork can make use of
type DiscoveryType ¶
type DiscoveryType int
DiscoveryType represents the type of discovery element the DiscoverNew function is invoked on
type Driver ¶
type Driver interface {
	// CreateNetwork invokes the driver method to create a network passing
	// the network id and network specific config. The config mechanism will
	// eventually be replaced with labels which are yet to be introduced.
	CreateNetwork(nid string, options map[string]interface{}, ipV4Data, ipV6Data []IPAMData) error
	// DeleteNetwork invokes the driver method to delete network passing
	// the network id.
	DeleteNetwork(nid string) error
	// CreateEndpoint invokes the driver method to create an endpoint
	// passing the network id, endpoint id endpoint information and driver
	// specific config. The endpoint information can be either consumed by
	// the driver or populated by the driver. The config mechanism will
	// eventually be replaced with labels which are yet to be introduced.
	CreateEndpoint(nid, eid string, ifInfo InterfaceInfo, options map[string]interface{}) error
	// DeleteEndpoint invokes the driver method to delete an endpoint
	// passing the network id and endpoint id.
	DeleteEndpoint(nid, eid string) error
	// EndpointOperInfo retrieves from the driver the operational data related to the specified endpoint
	EndpointOperInfo(nid, eid string) (map[string]interface{}, error)
	// Join method is invoked when a Sandbox is attached to an endpoint.
	Join(nid, eid string, sboxKey string, jinfo JoinInfo, options map[string]interface{}) error
	// Leave method is invoked when a Sandbox detaches from an endpoint.
	Leave(nid, eid string) error
	// DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster
	DiscoverNew(dType DiscoveryType, data interface{}) error
	// DiscoverDelete is a notification for a discovery delete event, Example:a node leaving a cluster
	DiscoverDelete(dType DiscoveryType, data interface{}) error
	// Type returns the the type of this driver, the network type this driver manages
	Type() string
}
    Driver is an interface that every plugin driver needs to implement.
type DriverCallback ¶
type DriverCallback interface {
	// RegisterDriver provides a way for Remote drivers to dynamically register new NetworkType and associate with a driver instance
	RegisterDriver(name string, driver Driver, capability Capability) error
}
    DriverCallback provides a Callback interface for Drivers into LibNetwork
type ErrActiveRegistration ¶
type ErrActiveRegistration string
ErrActiveRegistration represents an error when a driver is registered to a networkType that is previously registered
func (ErrActiveRegistration) Error ¶
func (ar ErrActiveRegistration) Error() string
Error interface for ErrActiveRegistration
func (ErrActiveRegistration) Forbidden ¶
func (ar ErrActiveRegistration) Forbidden()
Forbidden denotes the type of this error
type ErrEndpointExists ¶
type ErrEndpointExists string
ErrEndpointExists is returned if more than one endpoint is added to the network
func (ErrEndpointExists) Error ¶
func (ee ErrEndpointExists) Error() string
func (ErrEndpointExists) Forbidden ¶
func (ee ErrEndpointExists) Forbidden()
Forbidden denotes the type of this error
type ErrNoEndpoint ¶
type ErrNoEndpoint string
ErrNoEndpoint is returned if no endpoint with the specified id exists
func (ErrNoEndpoint) Error ¶
func (ene ErrNoEndpoint) Error() string
func (ErrNoEndpoint) NotFound ¶
func (ene ErrNoEndpoint) NotFound()
NotFound denotes the type of this error
type ErrNoNetwork ¶
type ErrNoNetwork string
ErrNoNetwork is returned if no network with the specified id exists
func (ErrNoNetwork) Error ¶
func (enn ErrNoNetwork) Error() string
func (ErrNoNetwork) NotFound ¶
func (enn ErrNoNetwork) NotFound()
NotFound denotes the type of this error
type ErrNotImplemented ¶
type ErrNotImplemented struct{}
    ErrNotImplemented is returned when a Driver has not implemented an API yet
func (*ErrNotImplemented) Error ¶
func (eni *ErrNotImplemented) Error() string
func (*ErrNotImplemented) NotImplemented ¶
func (eni *ErrNotImplemented) NotImplemented()
NotImplemented denotes the type of this error
type IPAMData ¶
type IPAMData struct {
	AddressSpace string
	Pool         *net.IPNet
	Gateway      *net.IPNet
	AuxAddresses map[string]*net.IPNet
}
    IPAMData represents the per-network ip related operational information libnetwork will send to the network driver during CreateNetwork()
func (*IPAMData) MarshalJSON ¶
MarshalJSON encodes IPAMData into json message
func (*IPAMData) UnmarshalJSON ¶
UnmarshalJSON decodes a json message into IPAMData
type InterfaceInfo ¶
type InterfaceInfo interface {
	// SetMacAddress allows the driver to set the mac address to the endpoint interface
	// during the call to CreateEndpoint, if the mac address is not already set.
	SetMacAddress(mac net.HardwareAddr) error
	// SetIPAddress allows the driver to set the ip address to the endpoint interface
	// during the call to CreateEndpoint, if the address is not already set.
	// The API is to be used to assign both the IPv4 and IPv6 address types.
	SetIPAddress(ip *net.IPNet) error
	// MacAddress returns the MAC address.
	MacAddress() net.HardwareAddr
	// Address returns the IPv4 address.
	Address() *net.IPNet
	// AddressIPv6 returns the IPv6 address.
	AddressIPv6() *net.IPNet
}
    InterfaceInfo provides a go interface for drivers to retrive network information to interface resources.
type InterfaceNameInfo ¶
type InterfaceNameInfo interface {
	// SetNames method assigns the srcName and dstPrefix for the interface.
	SetNames(srcName, dstPrefix string) error
}
    InterfaceNameInfo provides a go interface for the drivers to assign names to interfaces.
type JoinInfo ¶
type JoinInfo interface {
	// InterfaceName returns a InterfaceNameInfo go interface to facilitate
	// setting the names for the interface.
	InterfaceName() InterfaceNameInfo
	// SetGateway sets the default IPv4 gateway when a container joins the endpoint.
	SetGateway(net.IP) error
	// SetGatewayIPv6 sets the default IPv6 gateway when a container joins the endpoint.
	SetGatewayIPv6(net.IP) error
	// AddStaticRoute adds a routes to the sandbox.
	// It may be used in addtion to or instead of a default gateway (as above).
	AddStaticRoute(destination *net.IPNet, routeType int, nextHop net.IP) error
}
    JoinInfo represents a set of resources that the driver has the ability to provide during join time.
type NodeDiscoveryData ¶
NodeDiscoveryData represents the structure backing the node discovery data json string