Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DockerEventMap = map[dockerEvents.Action]Action{ dockerEvents.ActionCreate: ActionContainerCreate, dockerEvents.ActionStart: ActionContainerStart, dockerEvents.ActionUnPause: ActionContainerUnpause, dockerEvents.ActionKill: ActionContainerKill, dockerEvents.ActionStop: ActionContainerStop, dockerEvents.ActionPause: ActionContainerPause, dockerEvents.ActionDie: ActionContainerDie, dockerEvents.ActionDestroy: ActionContainerDestroy, }
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action uint16
func (Action) IsContainerPause ¶ added in v0.11.0
func (Action) IsContainerStart ¶ added in v0.11.0
func (Action) IsContainerStop ¶ added in v0.11.0
type Event ¶
type EventQueue ¶
type EventQueue struct {
// contains filtered or unexported fields
}
func NewEventQueue ¶
func NewEventQueue(queueTask *task.Task, flushInterval time.Duration, onFlush OnFlushFunc, onError OnErrorFunc) *EventQueue
NewEventQueue returns a new EventQueue with the given queueTask, flushInterval, onFlush and onError.
The returned EventQueue will start a goroutine to flush events in the queue when the flushInterval is reached.
The onFlush function is called when the flushInterval is reached and the queue is not empty,
The onError function is called when an error received from the errCh, or panic occurs in the onFlush function. Panic will cause a E.ErrPanicRecv error.
flushTask.Finish must be called after the flush is done, but the onFlush function can return earlier (e.g. run in another goroutine).
If task is canceled before the flushInterval is reached, the events in queue will be discarded.
type OnErrorFunc ¶
type OnFlushFunc ¶
type OnFlushFunc = func(events []Event)