Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultCompressibleTypes() []string
- func NewErrInvalidALBOptions(albName, backendName string) error
- func NewErrInvalidBackendName(backendName string) error
- func NewErrInvalidCacheName(cacheName, backendName string) error
- func NewErrInvalidNegativeCacheName(cacheName string) error
- func NewErrInvalidRewriterName(rewriterName, backendName string) error
- func NewErrInvalidRuleName(ruleName, backendName string) error
- func NewErrMissingOriginURL(backendName string) error
- func NewErrMissingProvider(backendName string) error
- func ValidateBackendName(name string) error
- type ErrInvalidALBOptions
- type ErrInvalidBackendName
- type ErrInvalidCacheName
- type ErrInvalidNegativeCacheName
- type ErrInvalidRewriterName
- type ErrInvalidRuleName
- type ErrMissingOriginURL
- type ErrMissingProvider
- type Lookup
- type Options
Constants ¶
const ( // DefaultTimeseriesTTLMS is the default Cache TTL for Time Series Objects DefaultTimeseriesTTLMS = 21600000 // DefaultFastForwardTTLMS is the default Cache TTL for Time Series Fast Forward Objects DefaultFastForwardTTLMS = 15000 // DefaultMaxTTLMS is the default Maximum TTL of any cache object DefaultMaxTTLMS = 86400000 // DefaultRevalidationFactor is the default Cache Object Freshness Lifetime to TTL multiplier DefaultRevalidationFactor = 2 // DefaultMaxObjectSizeBytes is the default Max Size of any Cache Object DefaultMaxObjectSizeBytes = 524288 // DefaultBackendTRF is the default Timeseries Retention Factor for Time Series-based Backends DefaultBackendTRF = 1024 // DefaultBackendTEM is the default Timeseries Eviction Method for Time Series-based Backends DefaultBackendTEM = evictionmethods.EvictionMethodOldest // DefaultBackendTEMName is the default Timeseries Eviction Method name for Time Series-based Backends DefaultBackendTEMName = "oldest" // DefaultBackendTimeoutMS is the default Upstream Request Timeout for Backends DefaultBackendTimeoutMS = 180000 // DefaultBackendCacheName is the default Cache Name for Backends DefaultBackendCacheName = "default" // DefaultBackendNegativeCacheName is the default Negative Cache Name for Backends DefaultBackendNegativeCacheName = "default" // DefaultTracingConfigName is the default Tracing Config Name for Backends DefaultTracingConfigName = "default" // DefaultBackfillToleranceMS is the default Backfill Tolerance setting for Backends DefaultBackfillToleranceMS = 0 // DefaultBackfillTolerancePoints is the default Backfill Tolerance setting for Backends DefaultBackfillTolerancePoints = 0 // DefaultKeepAliveTimeoutMS is the default Keep Alive Timeout for Backends' upstream client pools DefaultKeepAliveTimeoutMS = 300000 // DefaultMaxIdleConns is the default number of Idle Connections in Backends' upstream client pools DefaultMaxIdleConns = 20 // DefaultForwardedHeaders defines which class of 'Forwarded' headers are attached to upstream requests DefaultForwardedHeaders = "standard" // DefaullALBMechansimName defines the default ALB Mechanism Name DefaullALBMechansimName = "rr" // round robin )
Variables ¶
var ErrInvalidMetadata = errors.New("invalid options metadata")
ErrInvalidMetadata is an error for invalid metadata
Functions ¶
func DefaultCompressibleTypes ¶
func DefaultCompressibleTypes() []string
DefaultCompressibleTypes returns a list of types that Trickster should compress before caching
func NewErrInvalidALBOptions ¶
NewErrInvalidALBOptions returns a new invalid ALB Options error
func NewErrInvalidBackendName ¶
NewErrInvalidBackendName returns a new invalid backend name error
func NewErrInvalidCacheName ¶
NewErrInvalidCacheName returns a new invalid cache name error
func NewErrInvalidNegativeCacheName ¶
NewErrInvalidNegativeCacheName returns a new invalid negative cache name error
func NewErrInvalidRewriterName ¶
NewErrInvalidRewriterName returns a new missing invalid rewriter name error
func NewErrInvalidRuleName ¶
NewErrInvalidRuleName returns a new invalid rule name error
func NewErrMissingOriginURL ¶
NewErrMissingOriginURL returns a new missing origin URL error
func NewErrMissingProvider ¶
NewErrMissingProvider returns a new missing provider error
func ValidateBackendName ¶
ValidateBackendName ensures the backend name is permitted against the dictionary of restricted words
Types ¶
type ErrInvalidALBOptions ¶
type ErrInvalidALBOptions struct {
// contains filtered or unexported fields
}
ErrInvalidALBOptions is an error type for invalid ALB Options
type ErrInvalidBackendName ¶
type ErrInvalidBackendName struct {
// contains filtered or unexported fields
}
ErrInvalidBackendName is an error type for invalid backend name
type ErrInvalidCacheName ¶
type ErrInvalidCacheName struct {
// contains filtered or unexported fields
}
ErrInvalidCacheName is an error type for invalid cache name
type ErrInvalidNegativeCacheName ¶
type ErrInvalidNegativeCacheName struct {
// contains filtered or unexported fields
}
ErrInvalidNegativeCacheName is an error type for invalid negative cache name
type ErrInvalidRewriterName ¶
type ErrInvalidRewriterName struct {
// contains filtered or unexported fields
}
ErrInvalidRewriterName is an error type for invalid rewriter name
type ErrInvalidRuleName ¶
type ErrInvalidRuleName struct {
// contains filtered or unexported fields
}
ErrInvalidRuleName is an error type for invalid rule name
type ErrMissingOriginURL ¶
type ErrMissingOriginURL struct {
// contains filtered or unexported fields
}
ErrMissingOriginURL is an error type for missing origin URL
type ErrMissingProvider ¶
type ErrMissingProvider struct {
// contains filtered or unexported fields
}
ErrMissingProvider is an error type for missing provider
type Lookup ¶
Lookup is a map of Options
func (Lookup) ValidateConfigMappings ¶
ValidateConfigMappings ensures that named config mappings from within origin configs (e.g., backends.cache_name) are valid
func (Lookup) ValidateTLSConfigs ¶
ValidateTLSConfigs iterates the map and validates any Options that use TLS
type Options ¶
type Options struct { // HTTP and Proxy Configurations // // Hosts identifies the frontend hostnames this backend should handle (virtual hosting) Hosts []string `yaml:"hosts,omitempty"` // Provider describes the type of backend (e.g., 'prometheus') Provider string `yaml:"provider,omitempty"` // OriginURL provides the base upstream URL for all proxied requests to this Backend. // it can be as simple as http://example.com or as complex as https://example.com:8443/path/prefix OriginURL string `yaml:"origin_url,omitempty"` // TimeoutMS defines how long the HTTP request will wait for a response before timing out TimeoutMS int64 `yaml:"timeout_ms,omitempty"` // KeepAliveTimeoutMS defines how long an open keep-alive HTTP connection remains idle before closing KeepAliveTimeoutMS int64 `yaml:"keep_alive_timeout_ms,omitempty"` // MaxIdleConns defines maximum number of open keep-alive connections to maintain MaxIdleConns int `yaml:"max_idle_conns,omitempty"` // CacheName provides the name of the configured cache where the backend client will store it's cache data CacheName string `yaml:"cache_name,omitempty"` // CacheKeyPrefix defines the cache key prefix the backend will use when writing objects to the cache CacheKeyPrefix string `yaml:"cache_key_prefix,omitempty"` // HealthCheck is the health check options reference for this backend HealthCheck *ho.Options `yaml:"healthcheck,omitempty"` // Object Proxy Cache and Delta Proxy Cache Configurations // TimeseriesRetentionFactor limits the maximum the number of chronological // timestamps worth of data to store in cache for each query TimeseriesRetentionFactor int `yaml:"timeseries_retention_factor,omitempty"` // TimeseriesEvictionMethodName specifies which methodology ("oldest", "lru") is used to identify //timeseries to evict from a full cache object TimeseriesEvictionMethodName string `yaml:"timeseries_eviction_method,omitempty"` // BackfillToleranceMS prevents values with timestamps newer than the provided number of // milliseconds from being cached. this allows propagation of upstream backfill operations // that modify recently-cached data BackfillToleranceMS int64 `yaml:"backfill_tolerance_ms,omitempty"` // BackfillTolerancePoints is similar to the MS version, except that it's final value is dependent // on the query step value to determine the relative duration of backfill tolerance per-query // When both are set, the higher of the two values is used BackfillTolerancePoints int `yaml:"backfill_tolerance_points,omitempty"` // PathList is a list of Path Options that control the behavior of the given paths when requested Paths map[string]*po.Options `yaml:"paths,omitempty"` // NegativeCacheName provides the name of the Negative Cache Config to be used by this Backend NegativeCacheName string `yaml:"negative_cache_name,omitempty"` // TimeseriesTTLMS specifies the cache TTL of timeseries objects TimeseriesTTLMS int `yaml:"timeseries_ttl_ms,omitempty"` // TimeseriesTTLMS specifies the cache TTL of fast forward data FastForwardTTLMS int `yaml:"fastforward_ttl_ms,omitempty"` // MaxTTLMS specifies the maximum allowed TTL for any cache object MaxTTLMS int `yaml:"max_ttl_ms,omitempty"` // RevalidationFactor specifies how many times to multiply the object freshness lifetime // by to calculate an absolute cache TTL RevalidationFactor float64 `yaml:"revalidation_factor,omitempty"` // MaxObjectSizeBytes specifies the max objectsize to be accepted for any given cache object MaxObjectSizeBytes int `yaml:"max_object_size_bytes,omitempty"` // CompressibleTypeList specifies the HTTP Object Content Types that will be compressed internally // when stored in the Trickster cache or served to clients with a compatible 'Accept-Encoding' header CompressibleTypeList []string `yaml:"compressible_types,omitempty"` // TracingConfigName provides the name of the Tracing Config to be used by this Backend TracingConfigName string `yaml:"tracing_name,omitempty"` // RuleName provides the name of the rule config to be used by this backend. // This is only effective if the Backend provider is 'rule' RuleName string `yaml:"rule_name,omitempty"` // ReqRewriterName is the name of a configured Rewriter that will modify the request prior to // processing by the backend client ReqRewriterName string `yaml:"req_rewriter_name,omitempty"` // ALBOptions holds the options for ALBs ALBOptions *ao.Options `yaml:"alb,omitempty"` // Prometheus holds options specific to prometheus backends Prometheus *prop.Options `yaml:"prometheus,omitempty"` // TLS is the TLS Configuration for the Frontend and Backend TLS *to.Options `yaml:"tls,omitempty"` // ForwardedHeaders indicates the class of 'Forwarded' header to attach to upstream requests ForwardedHeaders string `yaml:"forwarded_headers,omitempty"` // IsDefault indicates if this is the d.Default backend for any request not matching a configured route IsDefault bool `yaml:"is_default,omitempty"` // FastForwardDisable indicates whether the FastForward feature should be disabled for this backend FastForwardDisable bool `yaml:"fast_forward_disable,omitempty"` // PathRoutingDisabled, when true, will bypass /backendName/path route registrations PathRoutingDisabled bool `yaml:"path_routing_disabled,omitempty"` // RequireTLS, when true, indicates this Backend Config's paths must only be registered with the TLS Router RequireTLS bool `yaml:"require_tls,omitempty"` // MultipartRangesDisabled, when true, indicates that if a downstream client requests multiple ranges // in a single request, Trickster will instead request and return a 200 OK with the full object body MultipartRangesDisabled bool `yaml:"multipart_ranges_disabled,omitempty"` // DearticulateUpstreamRanges, when true, indicates that when Trickster requests multiple ranges from // the backend, that they be requested as individual upstream requests instead of a single request that // expects a multipart response // this optimizes Trickster to request as few bytes as possible when // fronting backends that only support single range requests DearticulateUpstreamRanges bool `yaml:"dearticulate_upstream_ranges,omitempty"` // Synthesized Configurations // These configurations are parsed versions of those defined above, and are what Trickster uses internally // // Name is the Name of the backend, taken from the Key in the Backends map[string]*BackendOptions Name string `yaml:"-"` // Router is a mux.Router containing this backend's Path Routes; it is set during route registration Router *mux.Router `yaml:"-"` // Timeout is the time.Duration representation of TimeoutMS Timeout time.Duration `yaml:"-"` // BackfillTolerance is the time.Duration representation of BackfillToleranceMS BackfillTolerance time.Duration `yaml:"-"` // ValueRetention is the time.Duration representation of ValueRetentionSecs ValueRetention time.Duration `yaml:"-"` // Scheme is the layer 7 protocol indicator (e.g. 'http'), derived from OriginURL Scheme string `yaml:"-"` // Host is the upstream hostname/IP[:port] the backend client will connect to when fetching uncached data, // derived from OriginURL Host string `yaml:"-"` // PathPrefix provides any prefix added to the front of the requested path when constructing the upstream // request url, derived from OriginURL PathPrefix string `yaml:"-"` // NegativeCache provides a map for the negative cache, with TTLs converted to time.Durations NegativeCache negative.Lookup `yaml:"-"` // TimeseriesRetention when subtracted from time.Now() represents the oldest allowable timestamp in a // timeseries when EvictionMethod is 'oldest' TimeseriesRetention time.Duration `yaml:"-"` // TimeseriesEvictionMethod is the parsed value of TimeseriesEvictionMethodName TimeseriesEvictionMethod evictionmethods.TimeseriesEvictionMethod `yaml:"-"` // TimeseriesTTL is the parsed value of TimeseriesTTLMS TimeseriesTTL time.Duration `yaml:"-"` // FastForwardTTL is the parsed value of FastForwardTTL FastForwardTTL time.Duration `yaml:"-"` // FastForwardPath is the paths.Options to use for upstream Fast Forward Requests FastForwardPath *po.Options `yaml:"-"` // MaxTTL is the parsed value of MaxTTLMS MaxTTL time.Duration `yaml:"-"` // HTTPClient is the Client used by Trickster to communicate with the origin HTTPClient *http.Client `yaml:"-"` // CompressibleTypes is the map version of CompressibleTypeList for fast lookup CompressibleTypes map[string]interface{} `yaml:"-"` // RuleOptions is the reference to the Rule Options as indicated by RuleName RuleOptions *ro.Options `yaml:"-"` // ReqRewriter is the rewriter handler as indicated by RuleName ReqRewriter rewriter.RewriteInstructions // contains filtered or unexported fields }
Options is a collection of configurations for Trickster backends
func New ¶
func New() *Options
New will return a pointer to a Backend Options with the default configuration settings
func SetDefaults ¶
func SetDefaults( name string, o *Options, metadata yamlx.KeyLookup, crw map[string]rewriter.RewriteInstructions, backends Lookup, activeCaches map[string]interface{}, ) (*Options, error)
SetDefaults iterates a YAML Config
func (*Options) CloneYAMLSafe ¶
CloneYAMLSafe returns a copy of the Options that is safe to export to YAML without exposing credentials (by masking known credential fields with "*****")