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

Method smapFromURL

ais/proxy.go:2527–2552  ·  view source on GitHub ↗
(baseURL string)

Source from the content-addressed store, hash-verified

2525}
2526
2527func (p *proxy) smapFromURL(baseURL string) (smap *smapX, err error) {
2528 cargs := allocCargs()
2529 {
2530 cargs.req = cmn.HreqArgs{
2531 Method: http.MethodGet,
2532 Base: baseURL,
2533 Path: apc.URLPathDae.S,
2534 Query: url.Values{apc.QparamWhat: []string{apc.GetWhatSmap}},
2535 }
2536 cargs.timeout = apc.DefaultTimeout
2537 cargs.cresv = cresSM{} // -> smapX
2538 }
2539 res := p.call(cargs)
2540 if res.err != nil {
2541 err = res.errorf("failed to get Smap from %s", baseURL)
2542 } else {
2543 smap = res.v.(*smapX)
2544 if err = smap.validate(); err != nil {
2545 err = fmt.Errorf("%s: invalid %s from %s: %v", p, smap, baseURL, err)
2546 smap = nil
2547 }
2548 }
2549 freeCargs(cargs)
2550 freeCR(res)
2551 return
2552}
2553
2554// forceful primary change - is used when the original primary network is down
2555// for a while and the remained nodes selected a new primary. After the

Callers 1

forcefulJoinMethod · 0.95

Calls 6

allocCargsFunction · 0.85
freeCargsFunction · 0.85
freeCRFunction · 0.85
errorfMethod · 0.80
callMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected