Documentation
¶
Overview ¶
Package ce implements a Functions CloudEvent middleware for use by scaffolding which exposes a function as a network service which handles Cloud Events.
Index ¶
Constants ¶
const ( LogDebug = logLevel(zerolog.DebugLevel) LogInfo = logLevel(zerolog.InfoLevel) LogWarn = logLevel(zerolog.WarnLevel) LogDisabled = logLevel(zerolog.Disabled) )
Variables ¶
This section is empty.
Functions ¶
func SetLogLevel ¶ added in v0.20.0
func SetLogLevel(l logLevel)
SetLogLevel to LogDebug, LogInfo, LogWarn, or LogDisabled Errors are always returned as values.
Types ¶
type DefaultHandler ¶
type DefaultHandler struct {
Handler any
}
DefaultHandler is used for simple static function implementations which need only define a single exported function named Handle which must be of a signature understood by the CloudEvents SDK.
type Handler ¶
type Handler any
Handler is a CloudEvent function Handler, which is invoked when it receives a cloud event. It must implement one of the following methods:
Handle() Handle() error Handle(context.Context) Handle(context.Context) error Handle(event.Event) Handle(event.Event) error Handle(context.Context, event.Event) Handle(context.Context, event.Event) error Handle(event.Event) *event.Event Handle(event.Event) (*event.Event, error) Handle(context.Context, event.Event) *event.Event Handle(context.Context, event.Event) (*event.Event, error)
It can optionaly implement any of Start, Stop, Ready, and Alive.
type LivenessReporter ¶
type LivenessReporter interface { // Alive allows the instance to report it's liveness status. Alive(context.Context) (bool, error) }
LivenessReporter is a function which defines a method to be used to determine liveness.
type ReadinessReporter ¶
type ReadinessReporter interface { // Ready to be invoked or not. Ready(context.Context) (bool, error) }
ReadinessReporter is a function which defines a method to be used to determine readiness.
type Service ¶
Service exposes a Function Instance as a an HTTP service.
func (*Service) Addr ¶ added in v0.20.0
Addr returns the address upon which the service is listening if started; nil otherwise.
func (*Service) Alive ¶
func (s *Service) Alive(w http.ResponseWriter, r *http.Request)
Alive handles liveness checks.