routes

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 40 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

Index

Constants

View Source
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 AccessLog

func AccessLog(app *zhttp.Engine)

func AuthMiddleware

func AuthMiddleware(permission string) func(c zhttp.Context)

func CORS

func CORS(c zhttp.Context)

CORS allows every origin and answers preflight requests.

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

func ClusterSecretMiddleware(c zhttp.Context)

ClusterSecretMiddleware admits node to node calls carrying `zed_cluster_secret`. Background replication has no user credentials.

func ESMiddleware

func ESMiddleware(c zhttp.Context)

func HTTPCacheForUI

func HTTPCacheForUI(app *zhttp.Engine)

func IndexAliasMiddleware

func IndexAliasMiddleware(c zhttp.Context)

func ReadOnlyGuard

func ReadOnlyGuard(c zhttp.Context)

ReadOnlyGuard rejects document writes to a cold index. It has to be registered before the routes it protects, so SetTierRoutes runs first.

func SetClusterRoutes

func SetClusterRoutes(r *zhttp.Engine)

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 SetPProf

func SetPProf(app *zhttp.Engine)

SetPProf serves the net/http/pprof endpoints under /debug/pprof/.

func SetPrometheus

func SetPrometheus(app *zhttp.Engine)

SetPrometheus records request metrics and serves them on /metrics.

func SetQueryRulesRoutes added in v1.4.0

func SetQueryRulesRoutes(r *zhttp.Engine)

SetQueryRulesRoutes sets up the query rules endpoints, native and Elasticsearch compatible.

func SetRoutes

func SetRoutes(r *zhttp.Engine)

SetRoutes sets up all HTTP API endpoints that can be called by front end

func SetSQLRoutes

func SetSQLRoutes(r *zhttp.Engine)

SetSQLRoutes sets up the SQL endpoints, native and Elasticsearch compatible.

func SetSynonymsRoutes added in v1.4.0

func SetSynonymsRoutes(r *zhttp.Engine)

SetSynonymsRoutes sets up the synonyms sets endpoints, native and Elasticsearch compatible.

func SetTierRoutes

func SetTierRoutes(r *zhttp.Engine)

SetTierRoutes registers the data tier and index lifecycle endpoints together with the read-only guard. Call it before SetRoutes.

func Setup

func Setup(app *zhttp.Engine)

func Tracing added in v1.3.0

func Tracing(app *zhttp.Engine)

Tracing runs every request in a server span, continuing the trace of a `traceparent` header, and returns the trace id in X-Trace-Id. It must be the first middleware so the others log the trace id.

Types

This section is empty.

Jump to

Keyboard shortcuts

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