Documentation ¶
Index ¶
- Constants
- func ParseCIDRSubnet(cidrStr string) (cidr address.CIDR, err error)
- type Allocator
- func (alloc *Allocator) AdminTakeoverRanges(peerNameOrNickname string) address.Count
- func (alloc *Allocator) Allocate(ident string, r address.CIDR, isContainer bool, hasBeenCancelled func() bool) (address.Address, error)
- func (alloc *Allocator) Claim(ident string, cidr address.CIDR, isContainer, noErrorOnUnknown bool, ...) error
- func (alloc *Allocator) ContainerDestroyed(ident string)
- func (alloc *Allocator) ContainerDied(ident string)
- func (alloc *Allocator) ContainerStarted(ident string)
- func (alloc *Allocator) Delete(ident string) error
- func (alloc *Allocator) Encode() []byte
- func (alloc *Allocator) Free(ident string, addrToFree address.Address) error
- func (alloc *Allocator) Gossip() mesh.GossipData
- func (alloc *Allocator) HandleHTTP(router *mux.Router, defaultSubnet address.CIDR, dockerCli *docker.Client)
- func (alloc *Allocator) Lookup(ident string, r address.Range) ([]address.CIDR, error)
- func (alloc *Allocator) OnGossip(msg []byte) (mesh.GossipData, error)
- func (alloc *Allocator) OnGossipBroadcast(sender mesh.PeerName, msg []byte) (mesh.GossipData, error)
- func (alloc *Allocator) OnGossipUnicast(sender mesh.PeerName, msg []byte) error
- func (alloc *Allocator) PeerGone(peerName mesh.PeerName)
- func (alloc *Allocator) Prime()
- func (alloc *Allocator) PruneOwned(ids []string)
- func (alloc *Allocator) SetInterfaces(gossip mesh.Gossip)
- func (alloc *Allocator) Shutdown()
- func (alloc *Allocator) Start()
- func (alloc *Allocator) Stop()
- type ClaimStatus
- type Config
- type EntryStatus
- type PreClaim
- type Status
Constants ¶
const (
MinSubnetSize = 4 // first and last addresses are excluded, so 2 would be too small
)
Kinds of message we can unicast to other peers
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
Allocator brings together Ring and space.Set, and does the necessary plumbing. Runs as a single-threaded Actor, so no locks are used around data structures.
func NewAllocator ¶
NewAllocator creates and initialises a new Allocator
func (*Allocator) AdminTakeoverRanges ¶
AdminTakeoverRanges (Sync) - take over the ranges owned by a given peer, and return how much space was transferred in the process. Only done on administrator command.
func (*Allocator) Allocate ¶
func (alloc *Allocator) Allocate(ident string, r address.CIDR, isContainer bool, hasBeenCancelled func() bool) (address.Address, error)
Allocate (Sync) - get new IP address for container with given name in range if there isn't any space in that range we block indefinitely
func (*Allocator) Claim ¶
func (alloc *Allocator) Claim(ident string, cidr address.CIDR, isContainer, noErrorOnUnknown bool, hasBeenCancelled func() bool) error
Claim an address that we think we should own (Sync)
func (*Allocator) ContainerDestroyed ¶ added in v1.5.0
ContainerDestroyed called from the updater interface. Async.
func (*Allocator) ContainerDied ¶
ContainerDied called from the updater interface. Async.
func (*Allocator) ContainerStarted ¶ added in v1.2.0
func (*Allocator) Delete ¶ added in v1.0.0
Delete (Sync) - release all IP addresses for container with given name
func (*Allocator) Gossip ¶
func (alloc *Allocator) Gossip() mesh.GossipData
Gossip returns a GossipData implementation, which in this case always returns the latest ring state (and does nothing on merge)
func (*Allocator) HandleHTTP ¶
func (alloc *Allocator) HandleHTTP(router *mux.Router, defaultSubnet address.CIDR, dockerCli *docker.Client)
HandleHTTP wires up ipams HTTP endpoints to the provided mux.
func (*Allocator) Lookup ¶ added in v1.0.0
Lookup (Sync) - get existing IP addresses for container with given name in range
func (*Allocator) OnGossip ¶
func (alloc *Allocator) OnGossip(msg []byte) (mesh.GossipData, error)
OnGossip (Sync)
func (*Allocator) OnGossipBroadcast ¶
func (alloc *Allocator) OnGossipBroadcast(sender mesh.PeerName, msg []byte) (mesh.GossipData, error)
OnGossipBroadcast (Sync)
func (*Allocator) OnGossipUnicast ¶
OnGossipUnicast (Sync)
func (*Allocator) PeerGone ¶ added in v1.6.0
PeerGone removes nicknames of peers which are no longer mentioned in the ring. Async.
NB: the function is invoked by the gossip library routines and should be
registered manually.
func (*Allocator) Prime ¶ added in v1.5.0
func (alloc *Allocator) Prime()
Prime (Sync) - wait for consensus
func (*Allocator) PruneOwned ¶ added in v1.6.0
func (*Allocator) SetInterfaces ¶
SetInterfaces gives the allocator two interfaces for talking to the outside world
type ClaimStatus ¶ added in v1.1.0
type EntryStatus ¶ added in v1.1.0
type PreClaim ¶ added in v1.9.1
type PreClaim struct { Ident string // a container ID, something like "weave:expose", or api.NoContainerID IsContainer bool // true if Ident is a container ID Cidr address.CIDR }
PreClaims are IP addresses discovered before we could initialize IPAM