func (ch *ConsistentHash) AddBuckets(newBuckets ...string) (ok bool) {
	ch.mu.Lock()
	defer ch.mu.Unlock()

	if ch.buckets == nil {
		ch.buckets = make(map[string]struct{})
	}
	for _, newBucket := range newBuckets {
		if _, ok := ch.buckets[newBucket]; ok {
			continue
		}
		ok = true
		ch.buckets[newBucket] = struct{}{}
		ch.insertUnsafe(newBucket)
	}
	return
}
// AddBuckets adds a list of buckets to the consistent hash, and returns
// a boolean indiciating if _any_ buckets were added.
//
// If any of the new buckets do not exist on the hash ring the
// new bucket will be inserted `ReplicasOrDefault` number
// of times into the internal hashring.
//
// If any of the new buckets already exist on the hash ring
// no action is taken for that bucket.
//
// Calling `AddBuckets` is safe to do concurrently
// and acquires a write lock on the consistent hash reference.
AddBuckets adds a list of buckets to the consistent hash, and returns
a boolean indiciating if _any_ buckets were added.

If any of the new buckets do not exist on the hash ring the
new bucket will be inserted `ReplicasOrDefault` number
of times into the internal hashring.

If any of the new buckets already exist on the hash ring
no action is taken for that bucket.

Calling `AddBuckets` is safe to do concurrently
and acquires a write lock on the consistent hash reference.
// AddBuckets adds a list of buckets to the consistent hash and returns // a boolean indiciating if _any_ buckets were added . // // If any of the new buckets do not exist on the hash ring the // new bucket will be inserted ` ReplicasOrDefault ` number // of times into the internal hashring . // // If any of the new buckets already exist on the hash ring // no action is taken for that bucket . // // Calling ` AddBuckets ` is safe to do concurrently // and acquires a write lock on the consistent hash reference .
func (ch *ConsistentHash) AddBuckets(newBuckets ...string) (ok bool) {
	ch.mu.Lock()
	defer ch.mu.Unlock()
	if ch.buckets == nil {
		ch.buckets = make(map[string]struct{})
	}
	for _, newBucket := range newBuckets {
		if _, ok := ch.buckets[newBucket]; ok {
			continue
		}
		ok = true
		ch.buckets[newBucket] = struct{}{}
		ch.insertUnsafe(newBucket)
	}
	return
}
func ( ch * ConsistentHash ) AddBuckets ( newBuckets ... string ) ( ok bool ) { ch . mu . Lock ( ) defer ch . mu . Unlock ( ) if ch . buckets == nil { ch . buckets = make ( map [ string ] struct { } ) } for _ , newBucket := range newBuckets { if _ , ok := ch . buckets [ newBucket ] ; ok { continue } ok = true ch . buckets [ newBucket ] = struct { } { } ch . insertUnsafe ( newBucket ) } return }
AddBuckets adds a list of buckets to the consistent hash, and returns
a boolean indiciating if _any_ buckets were added.
AddBuckets adds a list of buckets to the consistent hash and returns a boolean indiciating if _any_ buckets were added .