Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ControllerConfig ¶
type ControllerConfig struct { Source string Handlers map[api.EventType][]ControllerHandlerFunc }
type ControllerHandlerContextKey ¶
type ControllerHandlerContextKey string
const EventID ControllerHandlerContextKey = "event"
const StatusEventID ControllerHandlerContextKey = "status_event"
type EventFilter ¶
type EventFilter interface { // Filter determines whether the event should be processed. // Returns true if the event should be handled, false and an error otherwise. Filter(ctx context.Context, id string) (bool, error) // DeferredAction schedules actions to be executed regardless of event processing success. DeferredAction(ctx context.Context, id string) }
EventFilter defines an interface for filtering and deferring actions on events. Implementations of EventFilter should provide logic for determining whether an event should be processed and for handling any actions that need to be deferred.
- Filter: Decides whether the event should be processed based on its ID.
- DeferredAction: Allows for scheduling actions that should occur regardless of whether the event was processed successfully or not, such as cleanup tasks or releasing resources.
func NewLockBasedEventFilter ¶
func NewLockBasedEventFilter(lockFactory db.LockFactory) EventFilter
func NewPredicatedEventFilter ¶
func NewPredicatedEventFilter(predicate eventFilterPredicate) EventFilter
type KindControllerManager ¶
type KindControllerManager struct {
// contains filtered or unexported fields
}
func NewKindControllerManager ¶
func NewKindControllerManager(eventFilter EventFilter, events services.EventService) *KindControllerManager
func (*KindControllerManager) Add ¶
func (km *KindControllerManager) Add(config *ControllerConfig)
func (*KindControllerManager) AddEvent ¶
func (km *KindControllerManager) AddEvent(id string)
func (*KindControllerManager) Run ¶
func (km *KindControllerManager) Run(stopCh <-chan struct{})
type LockBasedEventFilter ¶
type LockBasedEventFilter struct {
// contains filtered or unexported fields
}
LockBasedEventFilter implements EventFilter using a locking mechanism for event processing. It creates advisory locks on event IDs to ensure thread-safe access. - Filter acquires a lock on the event ID and returns true if the lock is successful. - DeferredAction releases the lock for the event ID.
func (*LockBasedEventFilter) DeferredAction ¶
func (h *LockBasedEventFilter) DeferredAction(ctx context.Context, id string)
DeferredAction releases the lock for the given event ID if it was acquired.
type PredicatedEventFilter ¶
type PredicatedEventFilter struct {
// contains filtered or unexported fields
}
PredicatedEventFilter implements EventFilter using a predicate function for event filtering. - Filter uses the predicate to decide if the event should be processed. - DeferredAction is a no-op as no locking is performed.
func (*PredicatedEventFilter) DeferredAction ¶
func (h *PredicatedEventFilter) DeferredAction(ctx context.Context, id string)
DeferredAction is a no-op since no locks are involved.
type StatusController ¶
type StatusController struct {
// contains filtered or unexported fields
}
func NewStatusController ¶
func NewStatusController(statusEvents services.StatusEventService, instanceDao dao.InstanceDao, eventInstanceDao dao.EventInstanceDao) *StatusController
func (*StatusController) Add ¶
func (sc *StatusController) Add(handlers map[api.StatusEventType][]StatusHandlerFunc)
func (*StatusController) AddStatusEvent ¶
func (sc *StatusController) AddStatusEvent(id string)
AddStatusEvent adds a status event to the queue to be processed.
func (*StatusController) Run ¶
func (sc *StatusController) Run(stopCh <-chan struct{})