Repository: kubernetes/kubernetes
File: staging/src/k8s.io/client-go/tools/cache/the_real_fifo.go (Go)

Code before:

	// knownObjects list keys that are "known" --- affecting Delete(),
	// Replace(), and Resync().
	// It is nil if emitAtomicEvents is true.
	knownObjects KeyListerGetter

	// Indication the queue is closed.
	// Used to indicate a queue is closed so a control loop can exit when a queue is empty.
	// Currently, not used to gate any of CRUD operations.
	closed bool

	// Called with every object if non-nil.
	transformer TransformFunc

	// batchSize determines the maximum number of objects we can combine into a batch.
	batchSize int

	// emitAtomicEvents defines whether events like Replace and Resync should be emitted
	// atomically rather than as a series of events. This means that any call to the FIFO
	// will emit a single event.
	// If it is set:
	// * a single ReplacedAll event will be emitted instead of multiple Replace events
	// * a single SyncAll event will be emitted instead of multiple Sync events
	emitAtomicEvents bool

	// unlockWhileProcessing defines whether we should unlock the lock while processing events.
	// This may only be set if emitAtomicEvents is true.
	unlockWhileProcessing bool
}

// ReplacedAllInfo is the object associated with a Delta of type=ReplacedAll
type ReplacedAllInfo struct {
	// ResourceVersion is the resource version passed to the Replace() call that created this Delta
	ResourceVersion string
	// Objects are the list of objects passed to the Replace() call that created this Delta,
	// with any configured transformation already applied.
	Objects []interface{}
}

// SyncAllInfo is the object associated with a Delta of type=SyncAll
// It is used to trigger a resync of the entire queue.
type SyncAllInfo struct{}

var (
	_ = Queue(&RealFIFO{})             // RealFIFO is a Queue
	_ = TransformingStore(&RealFIFO{}) // RealFIFO implements TransformingStore to allow memory optimizations
)

// Close the queue.
func (f *RealFIFO) Close() {
	f.lock.Lock()

Review comment (suggestion):
```suggestion
	// unlockWhileProcessing defines whether we can unlock while processing events.
```

Code after:

	// knownObjects list keys that are "known" --- affecting Delete(),
	// Replace(), and Resync().
	// It is nil if emitAtomicEvents is true.
	knownObjects KeyListerGetter

	// Indication the queue is closed.
	// Used to indicate a queue is closed so a control loop can exit when a queue is empty.
	// Currently, not used to gate any of CRUD operations.
	closed bool

	// Called with every object if non-nil.
	transformer TransformFunc

	// batchSize determines the maximum number of objects we can combine into a batch.
	batchSize int

	// emitAtomicEvents defines whether events like Replace and Resync should be emitted
	// atomically rather than as a series of events. This means that any call to the FIFO
	// will emit a single event.
	// If it is set:
	// * a single ReplacedAll event will be emitted instead of multiple Replace events
	// * a single SyncAll event will be emitted instead of multiple Sync events
	emitAtomicEvents bool

	// unlockWhileProcessing defines whether we can unlock while processing events.
	// This may only be set if emitAtomicEvents is true. If unlockWhileProcessing is true,
	// Pop and PopBatch must be called from a single threaded consumer.
	unlockWhileProcessing bool
}

// ReplacedAllInfo is the object associated with a Delta of type=ReplacedAll
type ReplacedAllInfo struct {
	// ResourceVersion is the resource version passed to the Replace() call that created this Delta
	ResourceVersion string
	// Objects are the list of objects passed to the Replace() call that created this Delta,
	// with any configured transformation already applied.
	Objects []interface{}
}

// SyncAllInfo is the object associated with a Delta of type=SyncAll
// It is used to trigger a resync of the entire queue.
type SyncAllInfo struct{}

var (
	_ = Queue(&RealFIFO{})             // RealFIFO is a Queue
	_ = TransformingStore(&RealFIFO{}) // RealFIFO implements TransformingStore to allow memory optimizations
)

// Close the queue.
func (f *RealFIFO) Close() {