Documentation ¶
Index ¶
- Constants
- type Allocator
- func (alloc *Allocator) AdminTakeoverRanges(peerNameOrNickname string) error
- func (alloc *Allocator) Allocate(ident string, r address.Range, cancelChan <-chan bool) (address.Address, error)
- func (alloc *Allocator) Claim(ident string, addr address.Address, noErrorOnUnknown bool) error
- func (alloc *Allocator) ContainerDied(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() router.GossipData
- func (alloc *Allocator) HandleHTTP(router *mux.Router, defaultSubnet address.CIDR, dockerCli *docker.Client)
- func (alloc *Allocator) Lookup(ident string, r address.Range) (address.Address, error)
- func (alloc *Allocator) OnGossip(msg []byte) (router.GossipData, error)
- func (alloc *Allocator) OnGossipBroadcast(sender router.PeerName, msg []byte) (router.GossipData, error)
- func (alloc *Allocator) OnGossipUnicast(sender router.PeerName, msg []byte) error
- func (alloc *Allocator) SetInterfaces(gossip router.Gossip)
- func (alloc *Allocator) Shutdown()
- func (alloc *Allocator) Start()
- func (alloc *Allocator) Stop()
- type ClaimStatus
- type EntryStatus
- 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 ¶
This section is empty.
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 ¶
func NewAllocator(ourName router.PeerName, ourUID router.PeerUID, ourNickname string, universe address.Range, quorum uint) *Allocator
NewAllocator creates and initialises a new Allocator
func (*Allocator) AdminTakeoverRanges ¶
AdminTakeoverRanges (Sync) - take over the ranges owned by a given peer. Only done on adminstrator command.
func (*Allocator) Allocate ¶
func (alloc *Allocator) Allocate(ident string, r address.Range, cancelChan <-chan 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) ContainerDied ¶
ContainerDied is provided to satisfy the updater interface; does a 'Delete' underneath. Sync.
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() router.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 address for container with given name in range
func (*Allocator) OnGossip ¶
func (alloc *Allocator) OnGossip(msg []byte) (router.GossipData, error)
OnGossip (Sync)
func (*Allocator) OnGossipBroadcast ¶
func (alloc *Allocator) OnGossipBroadcast(sender router.PeerName, msg []byte) (router.GossipData, error)
OnGossipBroadcast (Sync)
func (*Allocator) OnGossipUnicast ¶
OnGossipUnicast (Sync)
func (*Allocator) SetInterfaces ¶
SetInterfaces gives the allocator two interfaces for talking to the outside world