relay

package
v0.0.0-...-decdc4a Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProcessEndpoint relayHandlerFunc = (*HTTP).processEndpoint
View Source
var ProcessUnknown relayHandlerFunc = (*HTTP).processUnknown

Functions

func InfluxEncode

func InfluxEncode(points models.Points) (*bytes.Buffer, error)

func InfluxEncodePrecision

func InfluxEncodePrecision(points models.Points, precision string) (*bytes.Buffer, error)

func InitClusters

func InitClusters() error

func SetConfig

func SetConfig(cfg *config.Config)

func SetLogdir

func SetLogdir(ld string)

Types

type HTTP

type HTTP struct {
	Endpoints []*HTTPEndPoint
	// contains filtered or unexported fields
}

HTTP is a relay for HTTP influxdb writes

func NewHTTP

func NewHTTP(cfg *config.HTTPConfig) (*HTTP, error)

NewHTTP creates a new HTTP relay This relay will most likely be tied to a RelayService and manage a set of HTTPBackends

func (*HTTP) Name

func (h *HTTP) Name() string

Name is the name of the HTTP relay a default name might be generated if it is not specified in the configuration file

func (*HTTP) Release

func (h *HTTP) Release()

func (*HTTP) Run

func (h *HTTP) Run() error

Run actually launch the HTTP endpoint

func (*HTTP) ServeHTTP

func (h *HTTP) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is the function that handles the different route The response is a JSON object describing the state of the operation

func (*HTTP) Stop

func (h *HTTP) Stop() error

Stop actually stops the HTTP endpoint

type HTTPEndPoint

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

func NewHTTPEndpoint

func NewHTTPEndpoint(cfg *config.Endpoint, l *zerolog.Logger) (*HTTPEndPoint, error)

func (*HTTPEndPoint) ProcessInput

func (e *HTTPEndPoint) ProcessInput(w http.ResponseWriter, r *http.Request) bool

func (*HTTPEndPoint) ProcessRead

func (e *HTTPEndPoint) ProcessRead(w http.ResponseWriter, r *http.Request, p *backend.InfluxParams)

func (*HTTPEndPoint) ProcessWrite

func (e *HTTPEndPoint) ProcessWrite(w http.ResponseWriter, r *http.Request, p *backend.InfluxParams)

func (*HTTPEndPoint) Release

func (e *HTTPEndPoint) Release()

type HTTPRoute

type HTTPRoute struct {
	DecodeFmt config.EndPSFormat
	Type      config.EndPType

	DecodeData func(w http.ResponseWriter, r *http.Request) (int, models.Points, error)
	// contains filtered or unexported fields
}

func NewHTTPRoute

func NewHTTPRoute(cfg *config.Route, mode config.EndPType, l *zerolog.Logger, format config.EndPSFormat) (*HTTPRoute, error)

func (*HTTPRoute) DecodeInflux

func (rt *HTTPRoute) DecodeInflux(w http.ResponseWriter, r *http.Request) (int, models.Points, error)

func (*HTTPRoute) DecodePrometheus

func (rt *HTTPRoute) DecodePrometheus(w http.ResponseWriter, r *http.Request) (int, models.Points, error)

func (*HTTPRoute) HandleHTTPResponse

func (rt *HTTPRoute) HandleHTTPResponse(w http.ResponseWriter, r *http.Request)

func (*HTTPRoute) MatchFilter

func (rt *HTTPRoute) MatchFilter(params *backend.InfluxParams) bool

return true if any of its condition match c1 or c2 or c3 or c4

func (*HTTPRoute) ProcessRules

func (rt *HTTPRoute) ProcessRules(w http.ResponseWriter, r *http.Request, p *backend.InfluxParams)

func (*HTTPRoute) Release

func (rt *HTTPRoute) Release()

type RouteFilter

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

func NewRouteFilter

func NewRouteFilter(cfg *config.Filter, l *zerolog.Logger) (*RouteFilter, error)

func (*RouteFilter) Match

func (rf *RouteFilter) Match(params *backend.InfluxParams) bool

func (*RouteFilter) Release

func (rf *RouteFilter) Release()

type RouteRule

type RouteRule struct {
	Type  config.EndPType
	Level config.RouteLevel

	Process func(w http.ResponseWriter, r *http.Request, p *backend.InfluxParams) []*backend.ResponseData
	// contains filtered or unexported fields
}

func NewRouteRule

func NewRouteRule(cfg *config.Rule, mode config.EndPType, l *zerolog.Logger, routelevel config.RouteLevel) (*RouteRule, error)

func (*RouteRule) ActionDropData

func (rr *RouteRule) ActionDropData(w http.ResponseWriter, r *http.Request, params *backend.InfluxParams) []*backend.ResponseData

func (*RouteRule) ActionRenameData

func (rr *RouteRule) ActionRenameData(w http.ResponseWriter, r *http.Request, params *backend.InfluxParams) []*backend.ResponseData

RENAME DATA PARAMETERS

func (*RouteRule) ActionRenameHTTP

func (rr *RouteRule) ActionRenameHTTP(w http.ResponseWriter, r *http.Request, params *backend.InfluxParams) []*backend.ResponseData

func (*RouteRule) ActionRouteDBFromData

func (rr *RouteRule) ActionRouteDBFromData(w http.ResponseWriter, r *http.Request, params *backend.InfluxParams) []*backend.ResponseData

func (*RouteRule) ActionRouteData

func (rr *RouteRule) ActionRouteData(w http.ResponseWriter, r *http.Request, params *backend.InfluxParams) []*backend.ResponseData

func (*RouteRule) ActionRouteHTTP

func (rr *RouteRule) ActionRouteHTTP(w http.ResponseWriter, r *http.Request, params *backend.InfluxParams) []*backend.ResponseData

func (*RouteRule) Release

func (rr *RouteRule) Release()

func (*RouteRule) RouteSinc

func (rr *RouteRule) RouteSinc() []*backend.ResponseData

Jump to

Keyboard shortcuts

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