(oldByID, newByID map[string]*coreauth.Auth)
| 292 | } |
| 293 | |
| 294 | func (w *Watcher) computePerPathUpdatesLocked(oldByID, newByID map[string]*coreauth.Auth) []AuthUpdate { |
| 295 | if w.currentAuths == nil { |
| 296 | w.currentAuths = make(map[string]*coreauth.Auth) |
| 297 | } |
| 298 | updates := make([]AuthUpdate, 0, len(oldByID)+len(newByID)) |
| 299 | for id, newAuth := range newByID { |
| 300 | existing, ok := w.currentAuths[id] |
| 301 | if !ok { |
| 302 | w.currentAuths[id] = newAuth.Clone() |
| 303 | updates = append(updates, AuthUpdate{Action: AuthUpdateActionAdd, ID: id, Auth: newAuth.Clone()}) |
| 304 | continue |
| 305 | } |
| 306 | if !authEqual(existing, newAuth) { |
| 307 | w.currentAuths[id] = newAuth.Clone() |
| 308 | updates = append(updates, AuthUpdate{Action: AuthUpdateActionModify, ID: id, Auth: newAuth.Clone()}) |
| 309 | } |
| 310 | } |
| 311 | for id := range oldByID { |
| 312 | if _, stillExists := newByID[id]; stillExists { |
| 313 | continue |
| 314 | } |
| 315 | delete(w.currentAuths, id) |
| 316 | updates = append(updates, AuthUpdate{Action: AuthUpdateActionDelete, ID: id}) |
| 317 | } |
| 318 | return updates |
| 319 | } |
| 320 | |
| 321 | func authSliceToMap(auths []*coreauth.Auth) map[string]*coreauth.Auth { |
| 322 | byID := make(map[string]*coreauth.Auth, len(auths)) |
no test coverage detected