Documentation ¶
Index ¶
- Constants
- type Event
- type EventFunc
- type EventHandler
- func (handler *EventHandler) DeRegisterFunc(eventFunc *EventFunc)
- func (handler *EventHandler) FakeEvent(event Event)
- func (handler *EventHandler) RegisterFunc(operation string, f func(event Event), replay bool) *EventFunc
- func (handler *EventHandler) RegisterFuncUntilCtxDone(ctx context.Context, operations []string, replay bool, f func(event Event))
- type EventWebsocket
- type TrafficLogger
- type TrafficMetricsLogger
Constants ¶
const ( OperationReloadStarted = "reload.started" OperationReloadEnded = "reload.ended" OperationDataUpdated = "data.updated" OperationAttributesUpdated = "attributes.updated" OperationResult = "result" OperationUpdated = "updated" OperationCreated = "created" )
Constants for known operations
const ( ResourceTypeApp = "app" ResourceTypeReload = "reload" ResourceTypeEvaluation = "evaluation" ResourceTypeItems = "items" )
Constants for known ResourceType
const BufferSize = 20
const WsType = "EventWebsocket"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Operation string `json:"operation,omitempty"` Origin string `json:"origin,omitempty"` ResourceID string `json:"resourceId,omitempty"` ResourceType string `json:"resourceType,omitempty"` Success bool `json:"success,omitempty"` Time string `json:"time,omitempty"` SpaceId string `json:"spaceId,omitempty"` ReloadId string `json:"reloadId,omitempty"` Data map[string]interface{} `json:"data,omitempty"` }
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
EventHandler handles events received on event websocket
func NewEventHandler ¶
func NewEventHandler() *EventHandler
NewEventHandler creates a new EventHandler which can be registered to and EventWs,
func (*EventHandler) DeRegisterFunc ¶
func (handler *EventHandler) DeRegisterFunc(eventFunc *EventFunc)
DeRegisterFunc from execution on event triggering
func (*EventHandler) FakeEvent ¶
func (handler *EventHandler) FakeEvent(event Event)
FakeEvent fake event being received
func (*EventHandler) RegisterFunc ¶
func (handler *EventHandler) RegisterFunc(operation string, f func(event Event), replay bool) *EventFunc
RegisterFunc to be executed on event triggering replay: triggers the latest events from buffer upon creation
func (*EventHandler) RegisterFuncUntilCtxDone ¶ added in v0.7.0
func (handler *EventHandler) RegisterFuncUntilCtxDone(ctx context.Context, operations []string, replay bool, f func(event Event))
RegisterFuncUntilCtxDone to be executed on event triggering. The function is deregistered when context is done. replay: triggers the latest events from buffer upon creation
type EventWebsocket ¶
type EventWebsocket struct { *EventHandler *wsdialer.WsDialer }
func SetupEventSocket ¶
func SetupEventSocket(dialContext context.Context, listenContext context.Context, timeout time.Duration, cookieJar http.CookieJar, trafficLogger TrafficLogger, metricsLogger TrafficMetricsLogger, url *neturl.URL, httpHeader http.Header, allowUntrusted bool, requestMetrics *requestmetrics.RequestMetrics, currentActionState func() *action.State) (*EventWebsocket, error)
SetupEventSocket to listen for events, event listening will stop at listenContext done.
type TrafficLogger ¶
type TrafficLogger interface { Received([]byte) Opened() }