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

Function reconcileConfiguredEndpoints

core/nylon_apply.go:110–137  ·  view source on GitHub ↗
(neigh *state.Neighbour, desired []*state.DynamicEndpoint, t *state.RouterTunables)

Source from the content-addressed store, hash-verified

108}
109
110func reconcileConfiguredEndpoints(neigh *state.Neighbour, desired []*state.DynamicEndpoint, t *state.RouterTunables) {
111 desiredByValue := make(map[string]*state.DynamicEndpoint, len(desired))
112 for _, ep := range desired {
113 desiredByValue[ep.Value] = ep
114 }
115
116 eps := make([]state.Endpoint, 0, len(neigh.Eps)+len(desired))
117 seen := make(map[string]struct{}, len(desired))
118 for _, ep := range neigh.Eps {
119 nep := ep.AsNylonEndpoint()
120 if ep.IsRemote() {
121 eps = append(eps, ep)
122 continue
123 }
124 // only keep if desired
125 if desiredEp, ok := desiredByValue[nep.DynEP.Value]; ok {
126 eps = append(eps, ep)
127 seen[desiredEp.Value] = struct{}{}
128 }
129 }
130 for _, ep := range desired {
131 if _, ok := seen[ep.Value]; ok {
132 continue
133 }
134 eps = append(eps, state.NewEndpoint(ep, false, nil, t))
135 }
136 neigh.Eps = eps
137}
138
139func (n *Nylon) reconcileAdvertisedPrefixes(next *state.CentralCfg) {
140 cur := n.GetRouter(n.LocalCfg.Id)

Callers 1

reconcileRouterStateMethod · 0.85

Calls 3

NewEndpointFunction · 0.92
AsNylonEndpointMethod · 0.65
IsRemoteMethod · 0.65

Tested by

no test coverage detected