Documentation
¶
Overview ¶
Package httpapi is the transport-neutral HTTP surface for quicSQL. Phase 1 serves the thin native-JSON endpoint (POST /<db>/query) over an ordinary http.Handler, so it runs identically on every transport a later phase adds (HTTP/1.1, h2/h2c, HTTP/3, WebSocket, UDS). Routing resolves the target database from the URL path (default) or the Host subdomain, with server-scoped reserved paths (`/_health`, and `/_*` reserved) resolved first.
Index ¶
- type Handler
- type Option
- func WithAdmin(a http.Handler) Option
- func WithLimiter(l *limits.Limiter) Option
- func WithLogger(l *slog.Logger) Option
- func WithMaxBlob(n int64) Option
- func WithMaxBody(n int64) Option
- func WithMaxExport(n int64) Option
- func WithMetrics(m obs.Metrics) Option
- func WithPolicy(p *authz.Policy) Option
- func WithSessions(s *session.Store) Option
- func WithStatementTimeout(d time.Duration) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the quicSQL HTTP handler. The auth middleware (package auth) has already attached the request's principal to the context by the time a request reaches here; the handler enforces the per-database capability via policy.
type Option ¶
type Option func(*Handler)
Option customizes a Handler.
func WithAdmin ¶
WithAdmin mounts the control-plane handler at /_admin. Nil (the default) leaves the control plane disabled — /_admin then 404s like any reserved path.
func WithLimiter ¶
WithLimiter sets the admission-control limiter (per-principal rate + per-db concurrency). Nil admits every request.
func WithLogger ¶
WithLogger sets the handler's logger (server-side error logging).
func WithMaxBlob ¶
WithMaxBlob caps a single streamed large object (blob write). Non-positive keeps the default. Unlike WithMaxBody this bounds a streamed body, not a buffered one, so it can be large without a matching memory cost.
func WithMaxBody ¶
WithMaxBody caps the request body size (bytes). Non-positive keeps the default.
func WithMaxExport ¶
WithMaxExport caps a full-database /export image (bytes), which is materialized whole in RAM. Non-positive disables the cap (unbounded).
func WithMetrics ¶
WithMetrics sets the metrics sink; when it also implements obs.Exposer, the /_metrics endpoint renders it.
func WithPolicy ¶
WithPolicy sets the authorization policy. Without it the handler defaults to open mode (every principal is read-write on every database), preserving the pre-auth behavior for tests and no-auth deployments.
func WithSessions ¶
WithSessions enables the Hrana pipeline endpoints, backed by the given store.
func WithStatementTimeout ¶
WithStatementTimeout bounds each request's execution via the request context.