channel

package
v0.40.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 21 Imported by: 24

Documentation

Index

Constants

View Source
const (
	// LabelUniqueName is the label for the unique name per stats_reporter instance.
	LabelUniqueName = "unique_name"

	// LabelContainerName is the label for the immutable name of the container.
	LabelContainerName = metrics.LabelContainerName
)

Variables

View Source
var (
	ContainerTagKey = tag.MustNewKey(LabelContainerName)
	UniqueTagKey    = tag.MustNewKey(LabelUniqueName)
)

Functions

func ReportEventCountMetricsForDispatchError added in v0.19.0

func ReportEventCountMetricsForDispatchError(err error, reporter StatsReporter, args *ReportArgs)

Types

type BadRequestError added in v0.38.0

type BadRequestError string

func (BadRequestError) Error added in v0.38.0

func (e BadRequestError) Error() string

type ChannelReference

type ChannelReference struct {
	Namespace string
	Name      string
}

ChannelReference references a Channel within the cluster by name and namespace.

func ParseChannelFromHost added in v0.38.0

func ParseChannelFromHost(host string) (ChannelReference, error)

ParseChannelFromHost determines a Channel reference from a host

func ParseChannelFromPath added in v0.38.0

func ParseChannelFromPath(path string) (ChannelReference, error)

ParseChannelFromPath determines a Channel reference from a URL path

func (*ChannelReference) String

func (r *ChannelReference) String() string

type EventReceiver added in v0.10.0

type EventReceiver struct {
	// contains filtered or unexported fields
}

EventReceiver starts a server to receive new events for the channel dispatcher. The new event is emitted via the receiver function.

func NewEventReceiver added in v0.10.0

func NewEventReceiver(receiverFunc EventReceiverFunc, logger *zap.Logger, reporter StatsReporter, opts ...EventReceiverOptions) (*EventReceiver, error)

NewEventReceiver creates an event receiver passing new events to the receiverFunc.

func (*EventReceiver) ServeHTTP added in v0.10.0

func (r *EventReceiver) ServeHTTP(response nethttp.ResponseWriter, request *nethttp.Request)

func (*EventReceiver) Start added in v0.10.0

func (r *EventReceiver) Start(ctx context.Context) error

Start begins to receive events for the receiver.

Only HTTP POST requests to the root path (/) are accepted. If other paths or methods are needed, use the HandleRequest method directly with another HTTP server.

type EventReceiverFunc added in v0.39.0

type EventReceiverFunc func(context.Context, ChannelReference, event.Event, nethttp.Header) error

EventReceiverFunc is the function to be called for handling the event.

type EventReceiverOptions added in v0.39.0

type EventReceiverOptions func(*EventReceiver) error

ReceiverOptions provides functional options to EventReceiver function.

func OIDCTokenVerification added in v0.40.0

func OIDCTokenVerification(tokenVerifier *auth.OIDCTokenVerifier, audience string) EventReceiverOptions

func ReceiverWithContextFunc added in v0.40.0

func ReceiverWithContextFunc(fn func(context.Context) context.Context) EventReceiverOptions

func ResolveChannelFromHostHeader

func ResolveChannelFromHostHeader(hostToChannelFunc ResolveChannelFromHostFunc) EventReceiverOptions

ResolveChannelFromHostHeader is a ReceiverOption for NewEventReceiver which enables the caller to overwrite the default behaviour defined by ParseChannelFromHost function.

func ResolveChannelFromPath added in v0.39.0

func ResolveChannelFromPath(PathToChannelFunc ResolveChannelFromPathFunc) EventReceiverOptions

ResolveChannelFromPath is a ReceiverOption for NewEventReceiver which enables the caller to overwrite the default behaviour defined by ParseChannelFromPath function.

type ReportArgs added in v0.19.0

type ReportArgs struct {
	Ns          string
	EventType   string
	EventScheme string
}

type ResolveChannelFromHostFunc

type ResolveChannelFromHostFunc func(string) (ChannelReference, error)

ResolveChannelFromHostFunc function enables EventReceiver to get the Channel Reference from incoming request HostHeader before calling receiverFunc. Returns UnknownHostError if the channel is not found, otherwise returns a generic error.

type ResolveChannelFromPathFunc added in v0.38.0

type ResolveChannelFromPathFunc func(string) (ChannelReference, error)

ResolveChannelFromPathFunc function enables EventReceiver to get the Channel Reference from incoming request's path before calling receiverFunc.

type StatsReporter added in v0.19.0

type StatsReporter interface {
	ReportEventCount(args *ReportArgs, responseCode int) error
	ReportEventDispatchTime(args *ReportArgs, responseCode int, d time.Duration) error
}

func NewStatsReporter added in v0.19.0

func NewStatsReporter(container, uniqueName string) StatsReporter

NewStatsReporter creates a reporter that collects and reports channel metrics.

type UnknownChannelError added in v0.10.0

type UnknownChannelError struct {
	Channel ChannelReference
}

UnknownChannelError represents the error when an event is received by a channel dispatcher for a channel that does not exist.

func (*UnknownChannelError) Error added in v0.10.0

func (e *UnknownChannelError) Error() string

type UnknownHostError added in v0.14.0

type UnknownHostError string

UnknownHostError represents the error when a ResolveChannelFromHostHeader func cannot resolve an host

func (UnknownHostError) Error added in v0.14.0

func (e UnknownHostError) Error() string

Directories

Path Synopsis
Package fanout provides an http.Handler that takes in one request and fans it out to N other requests, based on a list of Subscriptions.
Package fanout provides an http.Handler that takes in one request and fans it out to N other requests, based on a list of Subscriptions.
Package multichannelfanout provides an http.Handler that takes in one request to a Knative Channel and fans it out to N other requests.
Package multichannelfanout provides an http.Handler that takes in one request to a Knative Channel and fans it out to N other requests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL