Documentation
¶
Overview ¶
Package events provides interfaces and types for working with events
Index ¶
- Constants
- Variables
- func NewEvent(evType eventsv1.EventType, obj Object, eventLabels ...map[string]string) *eventsv1.Event
- func NewHandler[T any, PT interface{ ... }](h func(context.Context, PT) error) func(context.Context, proto.Message) error
- func NewRequest(evType eventsv1.EventType, obj Object, labels ...map[string]string) *eventsv1.PublishRequest
- type ConditionHandlerFunc
- type Exchange
- func (e *Exchange) AddForwarder(forwarder Forwarder)
- func (e *Exchange) Forward(ctx context.Context, ev *eventsv1.Event) error
- func (e *Exchange) On(ev eventsv1.EventType, f HandlerFunc)
- func (e *Exchange) Once(ev eventsv1.EventType, f HandlerFunc)
- func (e *Exchange) Publish(ctx context.Context, ev *eventsv1.Event) error
- func (e *Exchange) Subscribe(ctx context.Context, t ...eventsv1.EventType) chan *eventsv1.Event
- func (e *Exchange) Unsubscribe(context.Context, eventsv1.EventType) error
- type Forwarder
- type Handler
- type HandlerFunc
- func Handle(h HandlerFunc) HandlerFunc
- func HandleErrors(log logger.Logger, h HandlerFunc) HandlerFunc
- func HandleLease(h LeaseHandlerFunc) HandlerFunc
- func HandleNew[T any, PT interface{ ... }](h func(context.Context, PT) error) HandlerFunc
- func HandleNode(h NodeHandlerFunc) HandlerFunc
- func HandleNodeUpradeReq(h NodeUpgradeHandlerFunc) HandlerFunc
- func HandleScheduling(h SchedulingHandlerFunc) HandlerFunc
- func HandleTask(h TaskHandlerFunc) HandlerFunc
- func HandleTasks(h ...TaskHandlerFunc) HandlerFunc
- func HandleVolume(h VolumeHandlerFunc) HandlerFunc
- type LeaseHandlerFunc
- type LogExchange
- type LogKey
- type NewExchangeOption
- type NodeHandlerFunc
- type NodeUpgradeHandlerFunc
- type Object
- type Publisher
- type SchedulingHandlerFunc
- type Subscriber
- type TaskHandlerFunc
- type VolumeHandlerFunc
Constants ¶
View Source
const ( TaskCreate = eventsv1.EventType_TaskCreate TaskDelete = eventsv1.EventType_TaskDelete TaskUpdate = eventsv1.EventType_TaskUpdate TaskStart = eventsv1.EventType_TaskStart TaskGet = eventsv1.EventType_TaskGet TaskList = eventsv1.EventType_TaskList TaskKill = eventsv1.EventType_TaskKill TaskStop = eventsv1.EventType_TaskStop TaskPatch = eventsv1.EventType_TaskPatch NodeGet = eventsv1.EventType_NodeGet NodeCreate = eventsv1.EventType_NodeCreate NodeDelete = eventsv1.EventType_NodeDelete NodeList = eventsv1.EventType_NodeList NodeUpdate = eventsv1.EventType_NodeUpdate NodeJoin = eventsv1.EventType_NodeJoin NodeForget = eventsv1.EventType_NodeForget NodeConnect = eventsv1.EventType_NodeConnect NodeUpgrade = eventsv1.EventType_NodeUpgrade NodePatch = eventsv1.EventType_NodePatch ContainerSetCreate = eventsv1.EventType_ContainerSetCreate ContainerSetDelete = eventsv1.EventType_ContainerSetDelete ContainerSetUpdate = eventsv1.EventType_ContainerSetUpdate Schedule = eventsv1.EventType_Schedule TailLogsStart = eventsv1.EventType_TailLogsStart TailLogsStop = eventsv1.EventType_TailLogsStop VolumeCreate = eventsv1.EventType_VolumeCreate VolumeDelete = eventsv1.EventType_VolumeDelete VolumeUpdate = eventsv1.EventType_VolumeUpdate VolumeGet = eventsv1.EventType_VolumeGet VolumeList = eventsv1.EventType_VolumeList VolumePatch = eventsv1.EventType_VolumePatch RuntimeTaskExit = eventsv1.EventType_RuntimeTaskExit RuntimeTaskCreate = eventsv1.EventType_RuntimeTaskCreate RuntimeTaskStart = eventsv1.EventType_RuntimeTaskStart RuntimeTaskDelete = eventsv1.EventType_RuntimeTaskDelete RuntimeTaskIO = eventsv1.EventType_RuntimeTaskIO RuntimeTaskOOM = eventsv1.EventType_RuntimeTaskOOM RuntimeTaskExecAdded = eventsv1.EventType_RuntimeTaskExecAdded RuntimeTaskExecStarted = eventsv1.EventType_RuntimeTaskExecStarted RuntimeTaskPaused = eventsv1.EventType_RuntimeTaskPaused RuntimeTaskResumed = eventsv1.EventType_RuntimeTaskResumed RuntimeTaskCheckpointed = eventsv1.EventType_RuntimeTaskCheckpointed RuntimeSnapshotPrepare = eventsv1.EventType_RuntimeSnapshotPrepare RuntimeSnapshotCommit = eventsv1.EventType_RuntimeSnapshotCommit RuntimeSnapshotRemove = eventsv1.EventType_RuntimeSnapshotRemove RuntimeNamespaceCreate = eventsv1.EventType_RuntimeNamespaceCreate RuntimeNamespaceUpdate = eventsv1.EventType_RuntimeNamespaceUpdate RuntimeNamespaceDelete = eventsv1.EventType_RuntimeNamespaceDelete RuntimeImageCreate = eventsv1.EventType_RuntimeImageCreate RuntimeImageUpdate = eventsv1.EventType_RuntimeImageUpdate RuntimeImageDelete = eventsv1.EventType_RuntimeImageDelete RuntimeContainerCreate = eventsv1.EventType_RuntimeContainerCreate RuntimeContainerUpdate = eventsv1.EventType_RuntimeContainerUpdate RuntimeContainerDelete = eventsv1.EventType_RuntimeContainerDelete RuntimeContentCreate = eventsv1.EventType_RuntimeContentCreate RuntimeContentDelete = eventsv1.EventType_RuntimeContentDelete LeaseAcquiered = eventsv1.EventType_LeaseAcquired LeaseExpired = eventsv1.EventType_LeaseExpired LeaseRenewed = eventsv1.EventType_LeaseRenewed LeaseReleased = eventsv1.EventType_LeaseReleased LeaseDeleted = eventsv1.EventType_LeaseDeleted ConditionReported = eventsv1.EventType_ConditionReported )
Variables ¶
View Source
var ALL = []eventsv1.EventType{ TaskCreate, TaskDelete, TaskUpdate, TaskStart, TaskGet, TaskList, TaskKill, TaskStop, TaskPatch, NodeGet, NodeCreate, NodeDelete, NodeList, NodeUpdate, NodeJoin, NodeForget, NodeConnect, NodeUpgrade, NodePatch, ContainerSetCreate, ContainerSetDelete, ContainerSetUpdate, Schedule, TailLogsStart, TailLogsStop, VolumeCreate, VolumeDelete, VolumeUpdate, VolumeGet, VolumeList, RuntimeTaskExit, RuntimeTaskCreate, RuntimeTaskStart, RuntimeTaskDelete, RuntimeTaskIO, RuntimeTaskOOM, RuntimeTaskExecAdded, RuntimeTaskExecStarted, RuntimeTaskPaused, RuntimeTaskResumed, RuntimeTaskCheckpointed, RuntimeSnapshotPrepare, RuntimeSnapshotCommit, RuntimeSnapshotRemove, RuntimeNamespaceCreate, RuntimeNamespaceUpdate, RuntimeNamespaceDelete, RuntimeImageCreate, RuntimeImageUpdate, RuntimeImageDelete, RuntimeContainerCreate, RuntimeContainerUpdate, RuntimeContainerDelete, RuntimeContentCreate, RuntimeContentDelete, LeaseAcquiered, LeaseExpired, LeaseRenewed, LeaseReleased, LeaseDeleted, ConditionReported, }
Functions ¶
func NewHandler ¶ added in v0.0.18
func NewRequest ¶
Types ¶
type ConditionHandlerFunc ¶ added in v0.0.13
type Exchange ¶
type Exchange struct {
// contains filtered or unexported fields
}
func NewExchange ¶
func NewExchange(opts ...NewExchangeOption) *Exchange
func (*Exchange) AddForwarder ¶ added in v0.0.11
AddForwarder adds a forwarder to this Exchange, forwarding any message on Publish()
func (*Exchange) Forward ¶
Forward publishes the event using the publishers added to this exchange. Implements Forwarder.
func (*Exchange) On ¶
func (e *Exchange) On(ev eventsv1.EventType, f HandlerFunc)
On registers a handler func for a certain event type
func (*Exchange) Once ¶
func (e *Exchange) Once(ev eventsv1.EventType, f HandlerFunc)
Once attaches a handler to the specified event type. The handler func is only executed once
type HandlerFunc ¶
func Handle ¶ added in v0.0.13
func Handle(h HandlerFunc) HandlerFunc
func HandleErrors ¶ added in v0.0.13
func HandleErrors(log logger.Logger, h HandlerFunc) HandlerFunc
func HandleLease ¶ added in v0.0.13
func HandleLease(h LeaseHandlerFunc) HandlerFunc
func HandleNode ¶ added in v0.0.13
func HandleNode(h NodeHandlerFunc) HandlerFunc
func HandleNodeUpradeReq ¶ added in v0.0.18
func HandleNodeUpradeReq(h NodeUpgradeHandlerFunc) HandlerFunc
func HandleScheduling ¶ added in v0.0.13
func HandleScheduling(h SchedulingHandlerFunc) HandlerFunc
func HandleTask ¶ added in v0.0.13
func HandleTask(h TaskHandlerFunc) HandlerFunc
func HandleTasks ¶ added in v0.0.13
func HandleTasks(h ...TaskHandlerFunc) HandlerFunc
func HandleVolume ¶ added in v0.0.13
func HandleVolume(h VolumeHandlerFunc) HandlerFunc
type LeaseHandlerFunc ¶ added in v0.0.13
type LogExchange ¶
type LogExchange struct {
// contains filtered or unexported fields
}
func (*LogExchange) CloseKey ¶
func (lx *LogExchange) CloseKey(key LogKey)
CloseKey closes all subscriber channels for the given key and removes the topic.
func (*LogExchange) Publish ¶
func (lx *LogExchange) Publish(entry *logsv1.LogEntry)
Publish sends the entry to all subscribers on the exchange
func (*LogExchange) Subscribe ¶
func (lx *LogExchange) Subscribe(key LogKey) <-chan *logsv1.LogEntry
Subscribe adds a subscription on the exchange using key as the ID
func (*LogExchange) Unsubscribe ¶
func (lx *LogExchange) Unsubscribe(key LogKey, ch <-chan *logsv1.LogEntry)
Unsubscribe removes subscription from the exchange identified by key
type NewExchangeOption ¶
type NewExchangeOption func(*Exchange)
func WithExchangeLogger ¶
func WithExchangeLogger(l logger.Logger) NewExchangeOption
type NodeHandlerFunc ¶ added in v0.0.13
type NodeUpgradeHandlerFunc ¶ added in v0.0.18
type NodeUpgradeHandlerFunc func(context.Context, *nodesv1.UpgradeRequest) error
type Object ¶
type Object protoreflect.ProtoMessage
type SchedulingHandlerFunc ¶ added in v0.0.13
type Subscriber ¶
type TaskHandlerFunc ¶ added in v0.0.13
func HandleEach ¶ added in v0.0.13
func HandleEach(f ...func()) TaskHandlerFunc
Click to show internal directories.
Click to hide internal directories.