cache

package
v1.2.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventQueue

type EventQueue struct {
	// contains filtered or unexported fields
}

EventQueue is a Store implementation that provides a sequence of compressed events to a consumer along with event types. This differs from the FIFO implementation in that FIFO does not provide events when an object is deleted and does not provide the type of event. Events are compressed in a manner similar to FIFO, but accounting for event types and deletions. The exact compression semantics are as follows:

  1. If a watch.Added is enqueued with state X and a watch.Modified with state Y is received, these are compressed into (Added, Y)
  1. If a watch.Added is enqueued with state X and a watch.Deleted is received, these are compressed and the item is removed from the queue
  1. If a watch.Modified is enqueued with state X and a watch.Modified with state Y is received, these two events are compressed into (Modified, Y)
  1. If a watch.Modified is enqueued with state X and a watch.Deleted is received, these are compressed into (Deleted, X)

It should be noted that the scenario where an object is deleted and re-added is not handled by this type nor is it in scope; the reflector uses UIDs for the IDs passed to stores, so you will never see a delete and a re-add for the same ID.

This type maintains a backing store in order to provide the deleted state on watch.Deleted events. This is necessary because the Store API does not receive the deleted state on a watch.Deleted event (though this state is delivered by the watch API itself, it is not passed on to the reflector Store).

func NewEventQueue

func NewEventQueue(keyFn kcache.KeyFunc) *EventQueue

NewEventQueue returns a new EventQueue.

func NewEventQueueForStore added in v1.0.6

func NewEventQueueForStore(keyFn kcache.KeyFunc, store kcache.Store) *EventQueue

NewEventQueueForStore returns a new EventQueue that uses the provided store.

func (*EventQueue) Add

func (eq *EventQueue) Add(obj interface{}) error

Add enqueues a watch.Added event for the given state.

func (*EventQueue) Cancel added in v1.0.6

func (eq *EventQueue) Cancel()

Cancel function to force Pop function to unblock

func (*EventQueue) ContainedIDs

func (eq *EventQueue) ContainedIDs() sets.String

ContainedIDs returns a sets.String containing all IDs of the enqueued items. This is a snapshot of a moment in time, and one should keep in mind that other go routines can add or remove items after you call this.

func (*EventQueue) Delete

func (eq *EventQueue) Delete(obj interface{}) error

Delete enqueues a watch.Delete event for the given object.

func (*EventQueue) Get

func (eq *EventQueue) Get(obj interface{}) (item interface{}, exists bool, err error)

Get returns the requested item, or sets exists=false.

func (*EventQueue) GetByKey

func (eq *EventQueue) GetByKey(key string) (item interface{}, exists bool, err error)

GetByKey returns the requested item, or sets exists=false.

func (*EventQueue) List

func (eq *EventQueue) List() []interface{}

List returns a list of all enqueued items.

func (*EventQueue) ListKeys

func (eq *EventQueue) ListKeys() []string

ListKeys returns all enqueued keys.

func (*EventQueue) Pop

func (eq *EventQueue) Pop() (watch.EventType, interface{}, error)

Pop gets the event and object at the head of the queue. If the event is a delete event, Pop deletes the key from the underlying cache.

func (*EventQueue) Replace

func (eq *EventQueue) Replace(objects []interface{}, resourceVersion string) error

Replace initializes 'eq' with the state contained in the given map and populates the queue with a watch.Modified event for each of the replaced objects. The backing store takes ownership of keyToObjs; you should not reference the map again after calling this function.

func (*EventQueue) Update

func (eq *EventQueue) Update(obj interface{}) error

Update enqueues a watch.Modified event for the given state.

type EventQueueStopped added in v1.0.6

type EventQueueStopped struct{}

func (EventQueueStopped) Error added in v1.0.6

func (es EventQueueStopped) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL