Documentation ¶
Overview ¶
Package multichannelfanout provides an http.Handler that takes in one request to a Knative Channel and fans it out to N other requests. Logically, it represents multiple Knative Channels. It is made up of a map, map[channel]fanout.Handler and each incoming request is inspected to determine which Channel it is on. This Handler delegates the HTTP handling to the fanout.Handler corresponding to the incoming request's Channel. It is often used in conjunction with a swappable.Handler. The swappable.Handler delegates all its requests to the multichannelfanout.Handler. When a new configuration is available, a new multichannelfanout.Handler is created and swapped in for all subsequent requests. The old multichannelfanout.Handler is discarded.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelConfig ¶
type ChannelConfig struct { Namespace string `json:"namespace"` Name string `json:"name"` HostName string `json:"hostname"` FanoutConfig fanout.Config `json:"fanoutConfig"` }
ChannelConfig is the configuration for a single Channel.
type Config ¶
type Config struct { // The configuration of each channel in this handler. ChannelConfigs []ChannelConfig `json:"channelConfigs"` }
Config for a multichannelfanout.Handler.
func NewConfigFromChannels ¶
NewConfigFromChannels creates a new Config from the list of channels.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is an http.Handler that introspects the incoming request to determine what Channel it is on, and then delegates handling of that request to the single fanout.Handler corresponding to that Channel.
func NewHandler ¶
NewHandler creates a new Handler.
func (*Handler) ConfigDiff ¶
ConfigDiffs diffs the new config with the existing config. If there are no differences, then the empty string is returned. If there are differences, then a non-empty string is returned describing the differences.
func (*Handler) CopyWithNewConfig ¶
CopyWithNewConfig creates a new copy of this Handler with all the fields identical, except the new Handler uses conf, rather than copying the existing Handler's config.