ingress

package
Version: v0.0.0-...-d19fc40 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

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

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

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 types.NamespacedName, event cev2.Event) protocol.Result
}

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

type Handler

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) *Handler

NewHandler creates a new ingress handler.

func (*Handler) ServeHTTP

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

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL