Rename consense -> prime

This commit is contained in:
Adam Harrison committed 2016-04-14 12:46:03 +01:00
1 parent e9ca0ffad1
commit a09986baa2
6 files changed
+20 -20

No files matched your search

+8 -8
View File
@@ -56,7 +56,7 @@ type Allocator struct {
nicknames map[mesh.PeerName]string // so we can map nicknames for rmpeer
pendingAllocates []operation // held until we get some free space
pendingClaims []operation // held until we know who owns the space
pendingConsenses []operation // held until consensus achieved
pendingPrimes []operation // held while our ring is empty
dead map[string]time.Time // containers we heard were dead, and when
db db.DB // persistence
gossip mesh.Gossip // our link to the outside world for sending messages
@@ -193,8 +193,8 @@ func (alloc *Allocator) tryOps(ops *[]operation) {
// Try all pending operations
func (alloc *Allocator) tryPendingOps() {
// Unblock pending consenses first
alloc.tryOps(&alloc.pendingConsenses)
// Unblock pending primes first
alloc.tryOps(&alloc.pendingPrimes)
// Process existing claims before servicing new allocations
alloc.tryOps(&alloc.pendingClaims)
alloc.tryOps(&alloc.pendingAllocates)
@@ -223,11 +223,11 @@ func (e *errorCancelled) Error() string {
// Actor client API
// Consense (Sync) - wait for consensus
func (alloc *Allocator) Consense() {
// Prime (Sync) - wait for consensus
func (alloc *Allocator) Prime() {
resultChan := make(chan struct{})
op := &consense{resultChan: resultChan}
alloc.doOperation(op, &alloc.pendingConsenses)
op := &prime{resultChan: resultChan}
alloc.doOperation(op, &alloc.pendingPrimes)
<-resultChan
}
@@ -381,7 +381,7 @@ func (alloc *Allocator) Shutdown() {
alloc.shuttingDown = true
alloc.cancelOps(&alloc.pendingClaims)
alloc.cancelOps(&alloc.pendingAllocates)
alloc.cancelOps(&alloc.pendingConsenses)
alloc.cancelOps(&alloc.pendingPrimes)
if heir := alloc.pickPeerForTransfer(); heir != mesh.UnknownPeerName {
alloc.ring.Transfer(alloc.ourName, heir)
alloc.space.Clear()
+2 -2
View File
@@ -82,8 +82,8 @@ func (alloc *Allocator) HandleHTTP(router *mux.Router, defaultSubnet address.CID
}
})
router.Methods("GET").Path("/consensus").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
alloc.Consense()
router.Methods("GET").Path("/ring").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
alloc.Prime()
})
router.Methods("GET").Path("/ip/{id}/{ip}/{prefixlen}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+4 -4
View File
@@ -1,10 +1,10 @@
package ipam
type consense struct {
type prime struct {
resultChan chan<- struct{}
}
func (c *consense) Try(alloc *Allocator) bool {
func (c *prime) Try(alloc *Allocator) bool {
if !alloc.ring.Empty() {
close(c.resultChan)
return true
@@ -15,10 +15,10 @@ func (c *consense) Try(alloc *Allocator) bool {
return false
}
func (c *consense) Cancel() {
func (c *prime) Cancel() {
close(c.resultChan)
}
func (c *consense) ForContainer(ident string) bool {
func (c *prime) ForContainer(ident string) bool {
return false
}
+1 -1
View File
@@ -147,7 +147,7 @@ existing cluster) it is desirable to ensure that a node has
successfully joined and is ready to allocate IP addresses. An
administrative command is provided for this purpose:
host1$ weave consense
host1$ weave prime
This operation will block until the node on which it is run has joined
successfully.
+2 -2
View File
@@ -9,9 +9,9 @@ weave_on $HOST1 launch
PEER1=$(weave_on $HOST1 report -f '{{.Router.Name}}')
start_container $HOST1
weave_on $HOST2 launch $HOST1
weave_on $HOST2 consense
weave_on $HOST2 prime
weave_on $HOST3 launch $HOST1
weave_on $HOST3 consense
weave_on $HOST3 prime
# nuke 1st peer
docker_on $HOST1 kill weave
+3 -3
View File
@@ -52,7 +52,7 @@ weave launch <same arguments as 'weave launch-router'>
[--rewrite-inspect]
launch-plugin [--no-multicast-route]
weave consense
weave prime
weave env [--restore]
config
@@ -2252,8 +2252,8 @@ EOF
echo "The 'stop-dns command has been removed; DNS is stopped as part of 'stop' and 'stop-router'." >&2
exit 0
;;
consense)
call_weave GET /consensus
prime)
call_weave GET /ring
;;
*)
echo "Unknown weave command '$COMMAND'" >&2