func (alloc *Allocator) AdminTakeoverRanges(peerNameOrNickname string) address.Count {
	resultChan := make(chan address.Count)
	alloc.actionChan <- func() {
		peername, err := alloc.lookupPeername(peerNameOrNickname)
		if err != nil {
			alloc.warnf("attempt to take over range from unknown peer '%s'", peerNameOrNickname)
			resultChan <- address.Count(0)
			return
		}

		alloc.debugln("AdminTakeoverRanges:", peername)
		if peername == alloc.ourName {
			alloc.warnf("attempt to take over range from ourself")
			resultChan <- address.Count(0)
			return
		}

		newRanges := alloc.ring.Transfer(peername, alloc.ourName)

		if len(newRanges) == 0 {
			resultChan <- address.Count(0)
			return
		}

		before := alloc.space.NumFreeAddresses()
		alloc.ringUpdated()
		after := alloc.space.NumFreeAddresses()

		alloc.gossip.GossipBroadcast(alloc.Gossip())

		resultChan <- after - before
	}
	return <-resultChan
}
// 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.
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.
// 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 (alloc *Allocator) AdminTakeoverRanges(peerNameOrNickname string) address.Count {
	resultChan := make(chan address.Count)
	alloc.actionChan <- func() {
		peername, err := alloc.lookupPeername(peerNameOrNickname)
		if err != nil {
			alloc.warnf("attempt to take over range from unknown peer '%s'", peerNameOrNickname)
			resultChan <- address.Count(0)
			return
		}
		alloc.debugln("AdminTakeoverRanges:", peername)
		if peername == alloc.ourName {
			alloc.warnf("attempt to take over range from ourself")
			resultChan <- address.Count(0)
			return
		}
		newRanges := alloc.ring.Transfer(peername, alloc.ourName)
		if len(newRanges) == 0 {
			resultChan <- address.Count(0)
			return
		}
		before := alloc.space.NumFreeAddresses()
		alloc.ringUpdated()
		after := alloc.space.NumFreeAddresses()
		alloc.gossip.GossipBroadcast(alloc.Gossip())
		resultChan <- after - before
	}
	return <-resultChan
}
func ( alloc * Allocator ) AdminTakeoverRanges ( peerNameOrNickname string ) address . Count { resultChan := make ( chan address . Count ) alloc . actionChan <- func ( ) { peername , err := alloc . lookupPeername ( peerNameOrNickname ) if err != nil { alloc . warnf ( " " , peerNameOrNickname ) resultChan <- address . Count ( 0 ) return } alloc . debugln ( " " , peername ) if peername == alloc . ourName { alloc . warnf ( " " ) resultChan <- address . Count ( 0 ) return } newRanges := alloc . ring . Transfer ( peername , alloc . ourName ) if len ( newRanges ) == 0 { resultChan <- address . Count ( 0 ) return } before := alloc . space . NumFreeAddresses ( ) alloc . ringUpdated ( ) after := alloc . space . NumFreeAddresses ( ) alloc . gossip . GossipBroadcast ( alloc . Gossip ( ) ) resultChan <- after - before } return <- resultChan }
AdminTakeoverRanges (Sync) - take over the ranges owned by a given
peer, and return how much space was transferred in the process.
AdminTakeoverRanges ( Sync ) - take over the ranges owned by a given peer and return how much space was transferred in the process .