| 547 | } |
| 548 | |
| 549 | func (f *DeltaFIFO) syncKeyLocked(key string) error { |
| 550 | obj, exists, err := f.knownObjects.GetByKey(key) |
| 551 | if err != nil { |
| 552 | klog.Errorf("Unexpected error %v during lookup of key %v, unable to queue object for sync", err, key) |
| 553 | return nil |
| 554 | } else if !exists { |
| 555 | klog.Infof("Key %v does not exist in known objects store, unable to queue object for sync", key) |
| 556 | return nil |
| 557 | } |
| 558 | |
| 559 | // If we are doing Resync() and there is already an event queued for that object, |
| 560 | // we ignore the Resync for it. This is to avoid the race, in which the resync |
| 561 | // comes with the previous value of object (since queueing an event for the object |
| 562 | // doesn't trigger changing the underlying store <knownObjects>. |
| 563 | id, err := f.KeyOf(obj) |
| 564 | if err != nil { |
| 565 | return KeyError{obj, err} |
| 566 | } |
| 567 | if len(f.items[id]) > 0 { |
| 568 | return nil |
| 569 | } |
| 570 | |
| 571 | if err := f.queueActionLocked(Sync, obj); err != nil { |
| 572 | return fmt.Errorf("couldn't queue object: %v", err) |
| 573 | } |
| 574 | return nil |
| 575 | } |
| 576 | |
| 577 | // A KeyListerGetter is anything that knows how to list its keys and look up by key. |
| 578 | type KeyListerGetter interface { |