func (ch *ConsistentHash) RemoveBucket(toRemove string) (ok bool) {
	ch.mu.Lock()
	defer ch.mu.Unlock()

	if ch.buckets == nil {
		return
	}
	if _, ok = ch.buckets[toRemove]; !ok {
		return
	}
	delete(ch.buckets, toRemove)
	for x := 0; x < ch.ReplicasOrDefault(); x++ {
		index := ch.search(ch.bucketHashKey(toRemove, x))
		ch.hashring = append(ch.hashring[:index], ch.hashring[index+1:]...)
	}
	return
}
// RemoveBucket removes a bucket from the consistent hash, and returns
// a boolean indicating if the provided bucket was found.
//
// If the bucket exists on the hash ring, the bucket and its replicas are removed.
//
// If the bucket does not exist on the ring, no action is taken.
//
// Calling `RemoveBucket` is safe to do concurrently
// and acquires a write lock on the consistent hash reference.
RemoveBucket removes a bucket from the consistent hash, and returns
a boolean indicating if the provided bucket was found.

If the bucket exists on the hash ring, the bucket and its replicas are removed.

If the bucket does not exist on the ring, no action is taken.

Calling `RemoveBucket` is safe to do concurrently
and acquires a write lock on the consistent hash reference.
// RemoveBucket removes a bucket from the consistent hash and returns // a boolean indicating if the provided bucket was found . // // If the bucket exists on the hash ring the bucket and its replicas are removed . // // If the bucket does not exist on the ring no action is taken . // // Calling ` RemoveBucket ` is safe to do concurrently // and acquires a write lock on the consistent hash reference .
func (ch *ConsistentHash) RemoveBucket(toRemove string) (ok bool) {
	ch.mu.Lock()
	defer ch.mu.Unlock()
	if ch.buckets == nil {
		return
	}
	if _, ok = ch.buckets[toRemove]; !ok {
		return
	}
	delete(ch.buckets, toRemove)
	for x := 0; x < ch.ReplicasOrDefault(); x++ {
		index := ch.search(ch.bucketHashKey(toRemove, x))
		ch.hashring = append(ch.hashring[:index], ch.hashring[index+1:]...)
	}
	return
}
func ( ch * ConsistentHash ) RemoveBucket ( toRemove string ) ( ok bool ) { ch . mu . Lock ( ) defer ch . mu . Unlock ( ) if ch . buckets == nil { return } if _ , ok = ch . buckets [ toRemove ] ; ! ok { return } delete ( ch . buckets , toRemove ) for x := 0 ; x < ch . ReplicasOrDefault ( ) ; x ++ { index := ch . search ( ch . bucketHashKey ( toRemove , x ) ) ch . hashring = append ( ch . hashring [ : index ] , ch . hashring [ index + 1 : ] ... ) } return }
RemoveBucket removes a bucket from the consistent hash, and returns
a boolean indicating if the provided bucket was found.
RemoveBucket removes a bucket from the consistent hash and returns a boolean indicating if the provided bucket was found .