ipam

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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(config Config) *Allocator

NewAllocator creates and initialises a new Allocator

func (*Allocator) AdminTakeoverRanges

func (alloc *Allocator) AdminTakeoverRanges(peerNameOrNickname string) address.Count

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) AllContainerIDs added in v1.5.0

func (alloc *Allocator) AllContainerIDs(ids []string)

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) error

Claim an address that we think we should own (Sync)

func (*Allocator) ContainerDestroyed added in v1.5.0

func (alloc *Allocator) ContainerDestroyed(ident string)

ContainerDestroyed called from the updater interface. Async.

func (*Allocator) ContainerDied

func (alloc *Allocator) ContainerDied(ident string)

ContainerDied called from the updater interface. Async.

func (*Allocator) ContainerStarted added in v1.2.0

func (alloc *Allocator) ContainerStarted(ident string)

func (*Allocator) Delete added in v1.0.0

func (alloc *Allocator) Delete(ident string) error

Delete (Sync) - release all IP addresses for container with given name

func (*Allocator) Encode

func (alloc *Allocator) Encode() []byte

Encode (Sync)

func (*Allocator) Free

func (alloc *Allocator) Free(ident string, addrToFree address.Address) error

Free (Sync) - release single IP address for container

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

func (alloc *Allocator) Lookup(ident string, r address.Range) ([]address.CIDR, error)

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

func (alloc *Allocator) OnGossipUnicast(sender mesh.PeerName, msg []byte) error

OnGossipUnicast (Sync)

func (*Allocator) Prime added in v1.5.0

func (alloc *Allocator) Prime()

Prime (Sync) - wait for consensus

func (*Allocator) SetInterfaces

func (alloc *Allocator) SetInterfaces(gossip mesh.Gossip)

SetInterfaces gives the allocator two interfaces for talking to the outside world

func (*Allocator) Shutdown

func (alloc *Allocator) Shutdown()

Shutdown (Sync)

func (*Allocator) Start

func (alloc *Allocator) Start()

Start runs the allocator goroutine

func (*Allocator) Stop

func (alloc *Allocator) Stop()

Stop makes the actor routine exit, for test purposes ONLY because any calls after this is processed will hang. Async.

type ClaimStatus added in v1.1.0

type ClaimStatus struct {
	Ident string
	CIDR  address.CIDR
}

type Config added in v1.5.0

type Config struct {
	OurName     mesh.PeerName
	OurUID      mesh.PeerUID
	OurNickname string
	Seed        []mesh.PeerName
	Universe    address.Range
	IsObserver  bool
	Quorum      func() uint
	Db          db.DB
	IsKnownPeer func(name mesh.PeerName) bool
}

type EntryStatus added in v1.1.0

type EntryStatus struct {
	Token       string
	Size        uint32
	Peer        string
	Nickname    string
	IsKnownPeer bool
	Version     uint32
}

type Status added in v1.1.0

type Status struct {
	Paxos            *paxos.Status
	Range            string
	RangeNumIPs      int
	DefaultSubnet    string
	Entries          []EntryStatus
	PendingClaims    []ClaimStatus
	PendingAllocates []string
}

func NewStatus added in v1.1.0

func NewStatus(allocator *Allocator, defaultSubnet address.CIDR) *Status

Directories

Path Synopsis
Package ring implements a simple ring CRDT.
Package ring implements a simple ring CRDT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL