MCPcopy Create free account
hub / github.com/OpenSN-Library/OpenSN-Library / allocNodeIndex

Function allocNodeIndex

daemon/pkg/initializer/node_init.go:24–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22}
23
24func allocNodeIndex() error {
25
26 _, err := concurrency.NewSTM(utils.EtcdClient, func(s concurrency.STM) error {
27 indexStr := s.Get(key.NextNodeIndexKey)
28
29 if len(indexStr) <= 0 {
30 key.NodeIndex = 0
31 } else {
32 nodeIndex, err := strconv.Atoi(indexStr)
33 if err != nil {
34 return err
35 }
36 key.NodeIndex = nodeIndex
37
38 }
39 s.Put(key.NextNodeIndexKey, strconv.Itoa(key.NodeIndex+1))
40 return nil
41 })
42 return err
43}
44
45func getInterfaceInfo(ifName string, target *model.Node) error {
46 var link netlink.Link

Callers 1

NodeInitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected