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