From 4e37f5ec4213c0129bda2cdcc8e1b61e9066344e Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 13 Feb 2017 17:31:02 +0000 Subject: [PATCH] Add explanations of various claim and allocation fields --- ipam/allocate.go | 4 ++-- ipam/allocator.go | 5 +++-- ipam/claim.go | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ipam/allocate.go b/ipam/allocate.go index ac542aac..c4092a12 100644 --- a/ipam/allocate.go +++ b/ipam/allocate.go @@ -14,9 +14,9 @@ type allocateResult struct { type allocate struct { resultChan chan<- allocateResult - ident string + ident string // a container ID, something like "weave:expose", or api.NoContainerID r address.CIDR // Subnet we are trying to allocate within - isContainer bool + isContainer bool // true if ident is a container ID hasBeenCancelled func() bool } diff --git a/ipam/allocator.go b/ipam/allocator.go index 71b21309..6ad7a540 100644 --- a/ipam/allocator.go +++ b/ipam/allocator.go @@ -76,9 +76,10 @@ type Allocator struct { now func() time.Time } +// PreClaims are IP addresses discovered before we could initialize IPAM type PreClaim struct { - Ident string - IsContainer bool + Ident string // a container ID, something like "weave:expose", or api.NoContainerID + IsContainer bool // true if Ident is a container ID Cidr address.CIDR } diff --git a/ipam/claim.go b/ipam/claim.go index dfd3ab76..9a827e54 100644 --- a/ipam/claim.go +++ b/ipam/claim.go @@ -12,10 +12,10 @@ import ( type claim struct { resultChan chan<- error - ident string - cidr address.CIDR - isContainer bool - noErrorOnUnknown bool + ident string // a container ID, something like "weave:expose", or api.NoContainerID + cidr address.CIDR // single address being claimed + isContainer bool // true if ident is a container ID + noErrorOnUnknown bool // if false, error or block if we don't know; if true return ok but keep trying hasBeenCancelled func() bool }