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

Function buildFeasibilityDistances

core/ipc_handler.go:272–287  ·  view source on GitHub ↗
(n *Nylon)

Source from the content-addressed store, hash-verified

270}
271
272func buildFeasibilityDistances(n *Nylon) []*protocol.FeasibilityDistance {
273 entries := make([]*protocol.FeasibilityDistance, 0, len(n.RouterState.Sources))
274 for source, fd := range n.RouterState.Sources {
275 entries = append(entries, &protocol.FeasibilityDistance{
276 Source: sourceProto(source),
277 Fd: fdProto(fd),
278 })
279 }
280 slices.SortFunc(entries, func(a, b *protocol.FeasibilityDistance) int {
281 if c := cmp.Compare(a.Source.Prefix, b.Source.Prefix); c != 0 {
282 return c
283 }
284 return cmp.Compare(a.Source.NodeId, b.Source.NodeId)
285 })
286 return entries
287}
288
289func advertisementsForNode(n *Nylon, id state.NodeId) []*protocol.Advertisement {
290 ads := make([]*protocol.Advertisement, 0)

Callers 1

handleStatusFunction · 0.85

Calls 2

sourceProtoFunction · 0.85
fdProtoFunction · 0.85

Tested by

no test coverage detected