validator

package
v1.17.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCacheSize int = 1024

DefaultCacheSize defines the default size of the LRU cache used by the validator

Variables

This section is empty.

Functions

func New

func New(name string, filterName string, opts ...Option) validator

New returns a new Validator

Types

type HashableProtoMessage

type HashableProtoMessage interface {
	protoiface.MessageV1
	Hash(hasher hash.Hash64) (uint64, error)
}

HashableProtoMessage defines a ProtoMessage that can be hashed. Useful when passing different ProtoMessages objects that need to be hashed.

type Option

type Option func(*config)

func WithCacheSize

func WithCacheSize(size int) Option

func WithCounters

func WithCounters(cacheHits, cacheMisses *stats.Int64Measure) Option

type Validator

type Validator interface {
	// ValidateConfig validates the given envoy config and returns any out and error from envoy. Returns nil if the envoy binary is not found.
	ValidateConfig(ctx context.Context, config HashableProtoMessage) error

	// CacheLength returns the returns the number of items in the cache
	CacheLength() int
}

Validator validates an envoy config by running it by envoy in validate mode. This requires the envoy binary to be present at $ENVOY_BINARY_PATH (defaults to /usr/local/bin/envoy). Results are cached via an LRU cache for performance

Jump to

Keyboard shortcuts

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