8916f2ee92
This adds a new flag that allows to ignore some nodes completely. Change-Id: I203d25f931262c809037e25e9c37e9a89bf47026
33 lines
699 B
Go
33 lines
699 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)
|
|
}
|
|
|
|
// RemoveAll xs from the set.
|
|
func (set NodeAliasSet) RemoveAll(xs NodeAliasSet) {
|
|
for x := range xs {
|
|
delete(set, x)
|
|
}
|
|
}
|