Documentation
¶
Index ¶
- Constants
- func AccessLog(app *zhttp.Engine)
- func AuthMiddleware(permission string) func(c zhttp.Context)
- func CORS(c zhttp.Context)
- func ClusterRoute() zhttp.HandlerFunc
- func ClusterSecretMiddleware(c zhttp.Context)
- func ESMiddleware(c zhttp.Context)
- func HTTPCacheForUI(app *zhttp.Engine)
- func IndexAliasMiddleware(c zhttp.Context)
- func ReadOnlyGuard(c zhttp.Context)
- func SetClusterRoutes(r *zhttp.Engine)
- func SetPProf(app *zhttp.Engine)
- func SetPrometheus(app *zhttp.Engine)
- func SetRoutes(r *zhttp.Engine)
- func SetSQLRoutes(r *zhttp.Engine)
- func SetTierRoutes(r *zhttp.Engine)
- func Setup(app *zhttp.Engine)
- func Tracing(app *zhttp.Engine)
Constants ¶
const ( // ForwardedByHeader names the node that proxied a request, a request // carrying it must be served locally or fail, never proxied again. ForwardedByHeader = "X-Zed-Forwarded-By" // ClusterEpochKey holds the ownership epoch the request was admitted // with, handlers may read it from the request context. ClusterEpochKey = "cluster_epoch" // InternalSearchPath is the node to node search endpoint. InternalSearchPath = "/api/_internal/search" )
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func ClusterRoute ¶
func ClusterRoute() zhttp.HandlerFunc
ClusterRoute routes a request for the `:target` index to the node that owns it.
- clustering disabled: nothing happens, this is the single node build
- another node owns the index: the request is proxied to it
- we own it: the ownership epoch is recorded and, for writes, checked again after the handler ran. A partition that moved meanwhile turns the response into 409 so the client retries against the new owner
- several indexes or a glob on an Elasticsearch search path: the request is split per owner and the responses are merged
func ClusterSecretMiddleware ¶
ClusterSecretMiddleware admits node to node calls carrying `zed_cluster_secret`. Background replication has no user credentials.
func ESMiddleware ¶
func HTTPCacheForUI ¶
func IndexAliasMiddleware ¶
func ReadOnlyGuard ¶
ReadOnlyGuard rejects document writes to a cold index. It has to be registered before the routes it protects, so SetTierRoutes runs first.
func SetClusterRoutes ¶
SetClusterRoutes installs the cluster endpoints and the ownership routing middleware.
It must run before SetRoutes: gin freezes the handler chain of a route when the route is registered, so ClusterRoute only covers routes added after this call.
func SetPrometheus ¶
SetPrometheus records request metrics and serves them on /metrics.
func SetSQLRoutes ¶
SetSQLRoutes sets up the SQL endpoints, native and Elasticsearch compatible.
func SetTierRoutes ¶
SetTierRoutes registers the data tier and index lifecycle endpoints together with the read-only guard. Call it before SetRoutes.
Types ¶
This section is empty.