func NewGeneric(list runtime.Object) *GenericRegistry {
	return &GenericRegistry{
		ObjectList:  list,
		Broadcaster: watch.NewBroadcaster(0, watch.WaitIfChannelFull),
	}
}
// Creates a new event broadcaster.
func NewBroadcaster() EventBroadcaster {
	return &eventBroadcasterImpl{watch.NewBroadcaster(maxQueuedEvents, watch.DropIfChannelFull)}
}
func NewFakeControllerSource() *FakeControllerSource {
	return &FakeControllerSource{
		items:       map[nnu]runtime.Object{},
		broadcaster: watch.NewBroadcaster(100, watch.WaitIfChannelFull),
	}
}
Example #4
0
func NewGeneric(list runtime.Object) *GenericRegistry {
	return &GenericRegistry{
		ObjectList:  list,
		Broadcaster: watch.NewBroadcaster(0),
	}
}
			}
			event, ok := watchEvent.Object.(*api.Event)
			if !ok {
				// This is all local, so there's no reason this should
				// ever happen.
				continue
			}
			f(event)
		}
	}()
	return w
}

const maxQueuedEvents = 1000

var events = watch.NewBroadcaster(maxQueuedEvents, watch.DropIfChannelFull)

// Event constructs an event from the given information and puts it in the queue for sending.
// 'object' is the object this event is about. Event will make a reference-- or you may also
// pass a reference to the object directly.
// 'reason' is the reason this event is generated. 'reason' should be short and unique; it will
// be used to automate handling of events, so imagine people writing switch statements to
// handle them. You want to make that easy.
// 'message' is intended to be human readable.
//
// The resulting event will be created in the same namespace as the reference object.
func Event(object runtime.Object, reason, message string) {
	ref, err := api.GetReference(object)
	if err != nil {
		glog.Errorf("Could not construct reference to: '%#v' due to: '%v'. Will not report event: '%v' '%v'", object, err, reason, message)
		return
Example #6
0
func NewPodRegistry(pods *api.PodList) *PodRegistry {
	return &PodRegistry{
		Pods:        pods,
		broadcaster: watch.NewBroadcaster(0, watch.WaitIfChannelFull),
	}
}
Example #7
0
			}
			event, ok := watchEvent.Object.(*api.Event)
			if !ok {
				// This is all local, so there's no reason this should
				// ever happen.
				continue
			}
			f(event)
		}
	}()
	return w
}

const queueLen = 1000

var events = watch.NewBroadcaster(queueLen)

// Event constructs an event from the given information and puts it in the queue for sending.
// 'object' is the object this event is about. Event will make a reference-- or you may also
// pass a reference to the object directly.
// 'condition' is the new condition of the object. 'reason' is the reason it now has this status.
// Both 'condition' and 'reason' should be short and unique; they will be used to automate
// handling of events, so imagine people writing switch statements to handle them. You want to
// make that easy.
// 'message' is intended to be human readable.
//
// The resulting event will be created in the same namespace as the reference object.
func Event(object runtime.Object, condition, reason, message string) {
	ref, err := api.GetReference(object)
	if err != nil {
		glog.Errorf("Could not construct reference to: '%#v' due to: '%v'. Will not report event: '%v' '%v' '%v'", object, err, condition, reason, message)
Example #8
0
func NewPodRegistry(pods *api.PodList) *PodRegistry {
	return &PodRegistry{
		Pods:        pods,
		broadcaster: watch.NewBroadcaster(0),
	}
}
Example #9
0
// NewFake makes a new fake MasterElector.
func NewFake() *Fake {
	// 0 means block for clients.
	return &Fake{mux: watch.NewBroadcaster(0, watch.WaitIfChannelFull)}
}