backends

package
v1.1.0-beta7.0...-3ae970a Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package backends the interface and generic functionality for Backend providers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsVirtual

func IsVirtual(provider string) bool

IsVirtual returns true if the backend is a virtual type (e.g., ones that do not make an outbound http request, but instead front to other backends)

func UsesCache

func UsesCache(provider string) bool

UsesCache returns true if the backend uses a cache (anything execpt Virtuals and ReverseProxy)

Types

type Backend

type Backend interface {
	// RegisterHandlers registers the provided Handlers into the Router
	RegisterHandlers(map[string]http.Handler)
	// Handlers returns a map of the HTTP Handlers the Backend has registered
	Handlers() map[string]http.Handler
	// DefaultPathConfigs returns the default PathConfigs for the given Provider
	DefaultPathConfigs(*bo.Options) map[string]*po.Options
	// Configuration returns the configuration for the Backend
	Configuration() *bo.Options
	// Name returns the name of the Backend
	Name() string
	// HTTPClient will return the HTTP Client for this Backend
	HTTPClient() *http.Client
	// SetCache sets the Cache object the Backend will use when caching origin content
	SetCache(cache.Cache)
	// Router returns a Router that handles HTTP Requests for this Backend
	Router() http.Handler
	// Cache returns a handle to the Cache instance used by the Backend
	Cache() cache.Cache
	// BaseUpstreamURL returns the base URL for upstream requests
	BaseUpstreamURL() *url.URL
	// SetHealthCheckProbe sets the Health Check Status Prober for the Client
	SetHealthCheckProbe(healthcheck.DemandProbe)
	// HealthHandler executes a Health Check Probe when called
	HealthHandler(http.ResponseWriter, *http.Request)
	// DefaultHealthCheckConfig returns the default Health Check Config for the given Provider
	DefaultHealthCheckConfig() *ho.Options
	// HealthCheckHTTPClient returns the HTTP Client used for Health Checking
	HealthCheckHTTPClient() *http.Client
}

Backend is the primary interface for interoperating with backends

func New

func New(name string, o *bo.Options, registrar Registrar,
	router http.Handler, cache cache.Cache) (Backend, error)

New returns a new Backend

type Backends

type Backends map[string]Backend

Backends represents a map of Backends keyed by Name

func (Backends) Get

func (b Backends) Get(backendName string) Backend

Get returns the named origin

func (Backends) GetConfig

func (b Backends) GetConfig(backendName string) *bo.Options

GetConfig returns the named Backend's Configuration Options

func (Backends) GetRouter

func (b Backends) GetRouter(backendName string) http.Handler

GetRouter returns the named Backend's Request Router

func (Backends) StartHealthChecks

func (b Backends) StartHealthChecks(logger interface{}) (healthcheck.HealthChecker, error)

StartHealthChecks iterates the backends to fully configure health checkers and start up any intervaled health checks

type MergeableTimeseriesBackend

type MergeableTimeseriesBackend interface {
	// MergePaths should return a slice of HTTP Paths that are safe to merge with
	// other requests of the same path (e.g.,   /api/v1/query_range in prometheus)
	MergeablePaths() []string
}

MergeableTimeseriesBackend defines the interface for mergeable time series

type Registrar

type Registrar func(map[string]http.Handler)

Registrar defines a function that registers http.Handlers with a router

type TimeseriesBackend

type TimeseriesBackend interface {
	// RegisterHandlers registers the provided Handlers into the Router
	RegisterHandlers(map[string]http.Handler)
	// Handlers returns a map of the HTTP Handlers the Backend has registered
	Handlers() map[string]http.Handler
	// DefaultPathConfigs returns the default PathConfigs for the given Provider
	DefaultPathConfigs(*bo.Options) map[string]*po.Options
	// ParseTimeRangeQuery returns a timeseries.TimeRangeQuery based on the provided HTTP Request
	ParseTimeRangeQuery(*http.Request) (*timeseries.TimeRangeQuery, *timeseries.RequestOptions, bool, error)
	// Configuration returns the configuration for the Backend
	Configuration() *bo.Options
	// Name returns the name of the Backend
	Name() string
	// FastForwardRequest returns an *http.Request crafted to collect Fast Forward data
	// from the Origin, based on the provided HTTP Request. If the inbound request is
	// POST/PUT/PATCH, a Content-Type header and non-nil body with the query parameters
	// must be set, in lieu of updated url query values, in the returned request
	FastForwardRequest(*http.Request) (*http.Request, error)
	// SetExtent will update an upstream request's timerange
	// parameters based on the provided timeseries.Extent
	SetExtent(*http.Request, *timeseries.TimeRangeQuery, *timeseries.Extent)
	// HTTPClient will return the HTTP Client for this Backend
	HTTPClient() *http.Client
	// SetCache sets the Cache object the Backend will use when caching origin content
	SetCache(cache.Cache)
	// Cache returns a handle to the Cache object used by the Backend
	Cache() cache.Cache
	// Router returns a Router that handles HTTP Requests for this Backend
	Router() http.Handler
	// BaseUpstreamURL returns the base URL for upstream requests
	BaseUpstreamURL() *url.URL
	// Modeler returns the Modeler for converting between Datasets and wire documents
	Modeler() *timeseries.Modeler
	// DefaultHealthCheckConfig returns the default HealthCHeck Config for the given Provider
	DefaultHealthCheckConfig() *ho.Options
	// SetHealthCheckProbe sets the Health Check Status Prober for the Client
	SetHealthCheckProbe(healthcheck.DemandProbe)
	// HealthHandler executes a Health Check Probe when called
	HealthHandler(http.ResponseWriter, *http.Request)
	// HealthCheckHTTPClient returns the HTTP Client used for Health Checking
	HealthCheckHTTPClient() *http.Client
	// ProcessTransformations executes any provider-specific transformations, like injecting
	// labels into the dataset
	ProcessTransformations(timeseries.Timeseries)
}

TimeseriesBackend is the primary interface for interoperating with Trickster and upstream TSDB's

func NewTimeseriesBackend

func NewTimeseriesBackend(name string, o *bo.Options, registrar Registrar, router http.Handler,
	cache cache.Cache, modeler *timeseries.Modeler) (TimeseriesBackend, error)

NewTimeseriesBackend returns a new BaseTimeseriesBackend Instance

Directories

Path Synopsis
alb
Package alb implements the Application Load Balancer Backend
Package alb implements the Application Load Balancer Backend
pool
Package pool provides an application load balancer pool
Package pool provides an application load balancer pool
Package clickhouse provides the ClickHouse backend provider
Package clickhouse provides the ClickHouse backend provider
Package influxdb provides the InfluxDB Backend provider
Package influxdb provides the InfluxDB Backend provider
Package irondb provides proxy origin support for IRONdb databases.
Package irondb provides proxy origin support for IRONdb databases.
Package prometheus provides the Prometheus Backend provider
Package prometheus provides the Prometheus Backend provider
Package reverseproxy provides the HTTP Reverse Proxy (no caching) Backend provider
Package reverseproxy provides the HTTP Reverse Proxy (no caching) Backend provider
Package reverseproxycache provides the HTTP Reverse Proxy Cache Backend provider
Package reverseproxycache provides the HTTP Reverse Proxy Cache Backend provider

Jump to

Keyboard shortcuts

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