MCPcopy
hub / github.com/NVIDIA/aistore / GetRandProxy

Method GetRandProxy

cluster/map.go:398–411  ·  view source on GitHub ↗
(excludePrimary bool)

Source from the content-addressed store, hash-verified

396}
397
398func (m *Smap) GetRandProxy(excludePrimary bool) (si *Snode, err error) {
399 var cnt int
400 for _, psi := range m.Pmap {
401 if psi.IsAnySet(NodeFlagsMaintDecomm) {
402 cnt++
403 continue
404 }
405 if !excludePrimary || !m.IsPrimary(psi) {
406 return psi, nil
407 }
408 }
409 return nil, fmt.Errorf("failed to find a random proxy (num=%d, in-maintenance=%d, exclude-primary=%t)",
410 len(m.Pmap), cnt, excludePrimary)
411}
412
413func (m *Smap) IsDuplicate(nsi *Snode) (osi *Snode, err error) {
414 for _, tsi := range m.Tmap {

Callers 15

TestGetNodeStatsFunction · 0.80
TestConfigGetFunction · 0.80
TestConfigSyncToNewNodeFunction · 0.80
killRestoreDiffIPFunction · 0.80
proxyCrashFunction · 0.80
_addNodeDuplicateIPFunction · 0.80

Calls 2

IsPrimaryMethod · 0.95
IsAnySetMethod · 0.45

Tested by 15

TestGetNodeStatsFunction · 0.64
TestConfigGetFunction · 0.64
TestConfigSyncToNewNodeFunction · 0.64
killRestoreDiffIPFunction · 0.64
proxyCrashFunction · 0.64
_addNodeDuplicateIPFunction · 0.64