Documentation
¶
Index ¶
- type Backend
- type Gateway
- func (r *Gateway) DeleteRoute(ctx context.Context, routeKey string) error
- func (r *Gateway) DeleteRouteByContainerInstanceID(ctx context.Context, containerInstanceID int64) error
- func (r *Gateway) ResolveByPath(path string) (Registration, string, bool)
- func (r *Gateway) UpsertRoute(ctx context.Context, route Registration) error
- type K8sIngressRegistry
- type K8sIngressRegistryConfig
- type PathRouteResolver
- type Registration
- type Registry
- type RouteRegistry
- type RouteRegistryHandler
- type TraefikRegistry
- type TraefikRegistryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gateway ¶ added in v0.1.4
type Gateway struct {
// contains filtered or unexported fields
}
Gateway keeps route-to-backend mapping for the in-process gateway. It is database-backed so mappings survive process restarts.
func (*Gateway) DeleteRoute ¶ added in v0.1.4
func (*Gateway) DeleteRouteByContainerInstanceID ¶ added in v0.1.4
func (*Gateway) ResolveByPath ¶ added in v0.1.4
func (r *Gateway) ResolveByPath(path string) (Registration, string, bool)
func (*Gateway) UpsertRoute ¶ added in v0.1.4
func (r *Gateway) UpsertRoute(ctx context.Context, route Registration) error
type K8sIngressRegistry ¶
type K8sIngressRegistry struct {
// contains filtered or unexported fields
}
func NewK8sIngressRegistry ¶
func NewK8sIngressRegistry(cfg K8sIngressRegistryConfig) (*K8sIngressRegistry, error)
func (*K8sIngressRegistry) DeleteRoute ¶
func (r *K8sIngressRegistry) DeleteRoute(ctx context.Context, routeKey string) error
func (*K8sIngressRegistry) DeleteRouteByContainerInstanceID ¶ added in v0.1.4
func (r *K8sIngressRegistry) DeleteRouteByContainerInstanceID(ctx context.Context, containerInstanceID int64) error
func (*K8sIngressRegistry) UpsertRoute ¶
func (r *K8sIngressRegistry) UpsertRoute(ctx context.Context, route Registration) error
type PathRouteResolver ¶
type PathRouteResolver interface {
ResolveByPath(path string) (route Registration, matchedPrefix string, ok bool)
}
PathRouteResolver resolves an incoming request path to a registered route. matchedPrefix is the path prefix bound to the resolved backend.
type Registration ¶
type Registration struct {
RouteKey string
ContainerInstanceID int64
IsTrimPrefix bool
PathPrefix string
Backend Backend
Metadata map[string]string
}
Registration describes one app-session route bound to a concrete backend.
type Registry ¶ added in v0.1.4
type Registry struct {
// contains filtered or unexported fields
}
Registry is the route registration factory. It holds named RouteRegistry implementations and resolves them by name at startup / runtime.
func NewRegistry ¶ added in v0.1.4
func NewRegistry() *Registry
NewRegistry creates an empty Registry.
func NewRegistryFromConfig ¶ added in v0.1.4
NewRegistryFromConfig builds a Registry populated with the external route registries selected by cfg.Route.Registrys, in declaration order. The in-process gateway is managed separately and is not part of this registry.
func (*Registry) Get ¶ added in v0.1.4
func (r *Registry) Get(name string) RouteRegistry
Get returns the RouteRegistry registered under the given name, or nil.
func (*Registry) Has ¶ added in v0.1.4
Has reports whether a RouteRegistry is registered under the given name.
func (*Registry) List ¶ added in v0.1.4
func (r *Registry) List() []RouteRegistry
List returns all registered RouteRegistry instances.
func (*Registry) Names ¶ added in v0.1.4
Names returns the normalized names of registered registries, sorted.
func (*Registry) Register ¶ added in v0.1.4
func (r *Registry) Register(name string, reg RouteRegistry)
Register registers a RouteRegistry under a normalized name; same-name registrations overwrite the previous one.
type RouteRegistry ¶
type RouteRegistry interface {
UpsertRoute(ctx context.Context, route Registration) error
DeleteRoute(ctx context.Context, routeKey string) error
DeleteRouteByContainerInstanceID(ctx context.Context, containerInstanceID int64) error
}
RouteRegistry is the abstraction for route management backends such as Traefik API/File, in-process gateway, or a composite implementation.
type RouteRegistryHandler ¶
type RouteRegistryHandler struct {
// contains filtered or unexported fields
}
func NewRouteRegistryHandler ¶
func NewRouteRegistryHandler(repo interfaces.ContainerRepository, registry *Registry, gateway *Gateway, cfg *config.Config) *RouteRegistryHandler
func (*RouteRegistryHandler) Handle ¶
func (h *RouteRegistryHandler) Handle(evt event.Event)
type TraefikRegistry ¶
type TraefikRegistry struct {
// contains filtered or unexported fields
}
func NewTraefikRegistry ¶
func NewTraefikRegistry(cfg TraefikRegistryConfig) (*TraefikRegistry, error)
func (*TraefikRegistry) DeleteRoute ¶
func (r *TraefikRegistry) DeleteRoute(ctx context.Context, routeKey string) error
func (*TraefikRegistry) DeleteRouteByContainerInstanceID ¶ added in v0.1.4
func (r *TraefikRegistry) DeleteRouteByContainerInstanceID(ctx context.Context, containerInstanceID int64) error
func (*TraefikRegistry) UpsertRoute ¶
func (r *TraefikRegistry) UpsertRoute(ctx context.Context, route Registration) error