3467fd4b7f
Implements creating roughly load-balanced set of batched that can be used to make multiple requests. Change-Id: I349b276176dcb8ba9163e7e06a94509d73fa5ddc
26 lines
572 B
Go
26 lines
572 B
Go
// Copyright (C) 2022 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package main
|
|
|
|
import "storj.io/storj/satellite/metabase"
|
|
|
|
// NodeAliasSet is a set containing node aliases.
|
|
type NodeAliasSet map[metabase.NodeAlias]struct{}
|
|
|
|
// Contains checks whether v is in the set.
|
|
func (set NodeAliasSet) Contains(v metabase.NodeAlias) bool {
|
|
_, ok := set[v]
|
|
return ok
|
|
}
|
|
|
|
// Add v to the set.
|
|
func (set NodeAliasSet) Add(v metabase.NodeAlias) {
|
|
set[v] = struct{}{}
|
|
}
|
|
|
|
// Remove v from the set.
|
|
func (set NodeAliasSet) Remove(v metabase.NodeAlias) {
|
|
delete(set, v)
|
|
}
|