link adds a resource to the cache and its indexes.
(r *runtimev1.Resource)
| 433 | |
| 434 | // link adds a resource to the cache and its indexes. |
| 435 | func (c *catalogCache) link(r *runtimev1.Resource) { |
| 436 | if c.resources[r.Meta.Name.Kind] == nil { |
| 437 | c.resources[r.Meta.Name.Kind] = make(map[string]*runtimev1.Resource) |
| 438 | } |
| 439 | c.resources[r.Meta.Name.Kind][strings.ToLower(r.Meta.Name.Name)] = r |
| 440 | |
| 441 | s := nameStr(r.Meta.Name) |
| 442 | |
| 443 | if r.Meta.DeletedOn == nil { |
| 444 | ok := c.dag.Add(r.Meta.Name, r.Meta.Refs...) |
| 445 | if !ok { |
| 446 | c.cyclic[s] = r.Meta.Name |
| 447 | } |
| 448 | } else { |
| 449 | c.deleted[s] = r.Meta.Name |
| 450 | } |
| 451 | |
| 452 | if r.Meta.RenamedFrom != nil { |
| 453 | c.renamed[s] = r.Meta.Name |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | // unlink reverses a previous call to link. |
| 458 | func (c *catalogCache) unlink(r *runtimev1.Resource) { |
no test coverage detected