httpservice

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package httpservice provides realm-neutral, scoped HTTP routing mechanics for plugin compositions. It deliberately knows no product routes, tokens, or payload schemas; those remain behavior owned by server or presentation plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(
	mounted *pluginruntime.Mounted, export string, want plugin.Contract,
) (http.Handler, error)

Handler returns an exact exported handler boundary from a mounted realm.

func RegisterRoutes

func RegisterRoutes(
	mount pluginruntime.MountContext, contract plugin.Contract, routes []Route,
) error

RegisterRoutes registers routes and attaches their disposer to the plugin's lifecycle before returning.

Types

type Registry

type Registry interface {
	Register(owner string, routes []Route) (dispose func(), err error)
}

Registry is the typed route extension point. Register atomically publishes all routes or none and returns an idempotent disposer scoped to their owner.

func LookupRegistry

func LookupRegistry(
	services pluginruntime.Services, contract plugin.Contract,
) (Registry, error)

LookupRegistry resolves one exact route-registry dependency.

type RegistryHandler

type RegistryHandler interface {
	Registry
	http.Handler
}

RegistryHandler is the complete in-memory router mechanic. Applications normally consume it through plugin services; the constructor is exposed for focused conformance and benchmarks of route publication itself.

func NewRouter

func NewRouter() RegistryHandler

NewRouter returns an empty atomic router.

type Route

type Route struct {
	Pattern string
	Handler http.Handler
}

Route is one standard-library HTTP mux pattern and handler. Patterns carry their method (for example, "GET /client/v1/manifest") so method admission is owned by the registering plugin instead of a shared catch-all.

type RouterFactory

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

RouterFactory provides a route registry and handler under caller-supplied exact contracts. The descriptor determines the realm and immutable identity.

func NewRouterFactory

func NewRouterFactory(
	descriptor plugin.Descriptor, routesContract, handlerContract plugin.Contract,
) (*RouterFactory, error)

NewRouterFactory validates a complete router descriptor. It must provide exactly the two supplied contracts and must not require another service.

func (*RouterFactory) Descriptor

func (factory *RouterFactory) Descriptor() plugin.Descriptor

func (*RouterFactory) Mount

func (factory *RouterFactory) Mount(_ context.Context, mount pluginruntime.MountContext) error

Jump to

Keyboard shortcuts

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