ingress

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 34 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// EventArrivalTime is used to access the metadata stored on a
	// CloudEvent to measure the time difference between when an event is
	// received on a broker and before it is dispatched to the trigger function.
	// The format is an RFC3339 time in string format. For example: 2019-08-26T23:38:17.834384404Z.
	EventArrivalTime = "knativearrivaltime"
)

Variables

View Source
var ErrIncomplete = errors.New("incomplete config")

ErrIncomplete is the error when a broker entry exists in the configmap but its decouple queue is nil or empty. This should never happen unless there is a bug in the controller.

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is the error when a broker doesn't exist in the configmap. This can happen if the clients specifies invalid broker in the path, or the configmap volume hasn't been updated.

View Source
var ErrNotReady = errors.New("not ready")

ErrNotReady is the error when a broker is not ready.

HandlerSet provides a handler with a real HTTPMessageReceiver and pubsub MultiTopicDecoupleSink.

Functions

func BrokerPath added in v0.17.0

func BrokerPath(namespace, name string) string

BrokerPath returns the path to be set in the status of a broker. The format is brokerNamespace/brokerName

func ConvertPathToNamespacedName added in v0.17.0

func ConvertPathToNamespacedName(path string) (types.NamespacedName, error)

convertPathToNamespacedName converts the broker path to a NamespaceName.

func NewMultiTopicDecoupleSink

func NewMultiTopicDecoupleSink(
	ctx context.Context,
	brokerConfig config.ReadonlyTargets,
	client *pubsub.Client,
	publishSettings pubsub.PublishSettings) *multiTopicDecoupleSink

NewMultiTopicDecoupleSink creates a new multiTopicDecoupleSink.

Types

type DecoupleSink

type DecoupleSink interface {
	// Send sends the event from a broker to the corresponding decoupling sink.
	Send(ctx context.Context, broker *config.BrokerKey, event cev2.Event) protocol.Result
}

DecoupleSink is an interface to send events to a decoupling sink (e.g., pubsub).

type Handler added in v0.15.0

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

Handler receives events and persists them to storage (pubsub).

func NewHandler

func NewHandler(ctx context.Context, httpReceiver HttpMessageReceiver, decouple DecoupleSink, reporter *metrics.IngressReporter, authType authcheck.AuthType) *Handler

NewHandler creates a new ingress handler.

func (*Handler) ServeHTTP added in v0.15.0

func (h *Handler) ServeHTTP(response nethttp.ResponseWriter, request *nethttp.Request)

ServeHTTP implements net/http Handler interface method. 1. Performs basic validation of the request. 2. Parse request URL to get namespace and broker. 3. Convert request to event. 4. Send event to decouple sink.

func (*Handler) Start added in v0.15.0

func (h *Handler) Start(ctx context.Context) error

Start blocks to receive events over HTTP.

type HttpMessageReceiver

type HttpMessageReceiver interface {
	StartListen(ctx context.Context, handler nethttp.Handler) error
}

HttpMessageReceiver is an interface to listen on http requests.

Jump to

Keyboard shortcuts

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