MCPcopy Create free account
hub / github.com/encodeous/nylon / TryGetNode

Method TryGetNode

state/config.go:426–440  ·  view source on GitHub ↗
(node NodeId)

Source from the content-addressed store, hash-verified

424}
425
426func (e *CentralCfg) TryGetNode(node NodeId) *NodeCfg {
427 idx := slices.IndexFunc(e.Routers, func(cfg RouterCfg) bool {
428 return cfg.Id == node
429 })
430 if idx == -1 {
431 idx = slices.IndexFunc(e.Clients, func(cfg ClientCfg) bool {
432 return cfg.Id == node
433 })
434 if idx == -1 {
435 return nil
436 }
437 return &e.Clients[idx].NodeCfg
438 }
439 return &e.Routers[idx].NodeCfg
440}
441
442func (e *CentralCfg) GetRouter(node NodeId) RouterCfg {
443 idx := slices.IndexFunc(e.Routers, func(cfg RouterCfg) bool {

Callers 2

GetNodeMethod · 0.95
checkNodeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected