matcher

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package matcher is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	InitWatchTimeout      time.Duration                `yaml:"initWatchTimeout"`
	RulesKVConfig         kv.OverrideConfiguration     `yaml:"rulesKVConfig"`
	NamespacesKey         string                       `yaml:"namespacesKey" validate:"nonzero"`
	RuleSetKeyFmt         string                       `yaml:"ruleSetKeyFmt" validate:"nonzero"`
	NamespaceTag          string                       `yaml:"namespaceTag" validate:"nonzero"`
	DefaultNamespace      string                       `yaml:"defaultNamespace" validate:"nonzero"`
	NameTagKey            string                       `yaml:"nameTagKey" validate:"nonzero"`
	MatchRangePast        *time.Duration               `yaml:"matchRangePast"`
	SortedTagIteratorPool pool.ObjectPoolConfiguration `yaml:"sortedTagIteratorPool"`
}

Configuration is config used to create a Matcher.

func (*Configuration) NewMatcher

func (cfg *Configuration) NewMatcher(
	cache cache.Cache,
	kvCluster client.Client,
	clockOpts clock.Options,
	instrumentOpts instrument.Options,
) (Matcher, error)

NewMatcher creates a Matcher.

func (*Configuration) NewNamespaces

func (cfg *Configuration) NewNamespaces(
	kvCluster client.Client,
	clockOpts clock.Options,
	instrumentOpts instrument.Options,
) (Namespaces, error)

NewNamespaces creates a matcher.Namespaces.

func (*Configuration) NewOptions

func (cfg *Configuration) NewOptions(
	kvCluster client.Client,
	clockOpts clock.Options,
	instrumentOpts instrument.Options,
) (Options, error)

NewOptions creates a Options.

type Matcher

type Matcher interface {
	// ForwardMatch matches rules against metric ID for time range [fromNanos, toNanos)
	// and returns the match result.
	ForwardMatch(id id.ID, fromNanos, toNanos int64) rules.MatchResult

	// Close closes the matcher.
	Close() error
}

Matcher matches rules against metric IDs.

func NewMatcher

func NewMatcher(cache cache.Cache, opts Options) (Matcher, error)

NewMatcher creates a new rule matcher.

type MockMatcher

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

MockMatcher is a mock of Matcher interface

func NewMockMatcher

func NewMockMatcher(ctrl *gomock.Controller) *MockMatcher

NewMockMatcher creates a new mock instance

func (*MockMatcher) Close

func (m *MockMatcher) Close() error

Close mocks base method

func (*MockMatcher) EXPECT

func (m *MockMatcher) EXPECT() *MockMatcherMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockMatcher) ForwardMatch

func (m *MockMatcher) ForwardMatch(arg0 id.ID, arg1, arg2 int64) rules.MatchResult

ForwardMatch mocks base method

type MockMatcherMockRecorder

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

MockMatcherMockRecorder is the mock recorder for MockMatcher

func (*MockMatcherMockRecorder) Close

func (mr *MockMatcherMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockMatcherMockRecorder) ForwardMatch

func (mr *MockMatcherMockRecorder) ForwardMatch(arg0, arg1, arg2 interface{}) *gomock.Call

ForwardMatch indicates an expected call of ForwardMatch

type Namespaces

type Namespaces interface {
	// Open opens the namespaces and starts watching runtime rule updates
	Open() error

	// Version returns the current version for a give namespace.
	Version(namespace []byte) int

	// ForwardMatch forward matches the matching policies for a given id in a given namespace
	// between [fromNanos, toNanos).
	ForwardMatch(namespace, id []byte, fromNanos, toNanos int64) rules.MatchResult

	// ReverseMatch reverse matches the matching policies for a given id in a given namespace
	// between [fromNanos, toNanos), taking into account the metric type and aggregation type for the given id.
	ReverseMatch(
		namespace, id []byte,
		fromNanos, toNanos int64,
		mt metric.Type,
		at aggregation.Type,
		isMultiAggregationTypesAllowed bool,
		aggTypesOpts aggregation.TypesOptions,
	) rules.MatchResult

	// Close closes the namespaces.
	Close()
}

Namespaces manages runtime updates to registered namespaces and provides API to match metic ids against rules in the corresponding namespaces.

func NewNamespaces

func NewNamespaces(key string, opts Options) Namespaces

NewNamespaces creates a new namespaces object.

type OnNamespaceAddedFn

type OnNamespaceAddedFn func(namespace []byte, ruleSet RuleSet)

OnNamespaceAddedFn is called when a namespace is added.

type OnNamespaceRemovedFn

type OnNamespaceRemovedFn func(namespace []byte)

OnNamespaceRemovedFn is called when a namespace is removed.

type OnRuleSetUpdatedFn

type OnRuleSetUpdatedFn func(namespace []byte, ruleSet RuleSet)

OnRuleSetUpdatedFn is called when a ruleset is updated.

type Options

type Options interface {
	// SetClockOptions sets the clock options.
	SetClockOptions(value clock.Options) Options

	// ClockOptions returns the clock options.
	ClockOptions() clock.Options

	// SetInstrumentOptions sets the instrument options.
	SetInstrumentOptions(value instrument.Options) Options

	// InstrumentOptions returns the instrument options.
	InstrumentOptions() instrument.Options

	// SetRuleSetOptions sets the ruleset options.
	SetRuleSetOptions(value rules.Options) Options

	// RuleSetOptions returns the ruleset options.
	RuleSetOptions() rules.Options

	// SetInitWatchTimeout sets the initial watch timeout.
	SetInitWatchTimeout(value time.Duration) Options

	// InitWatchTimeout returns the initial watch timeout.
	InitWatchTimeout() time.Duration

	// SetKVStore sets the kv store.
	SetKVStore(value kv.Store) Options

	// KVStore returns the kv store.
	KVStore() kv.Store

	// SetNamespacesKey sets the key for the full list of namespaces.
	SetNamespacesKey(value string) Options

	// NamespacesKey returns the key for the full list of namespaces.
	NamespacesKey() string

	// SetRuleSetKeyFn sets the function to generate ruleset keys.
	SetRuleSetKeyFn(value RuleSetKeyFn) Options

	// RuleSetKeyFn returns the function to generate ruleset keys.
	RuleSetKeyFn() RuleSetKeyFn

	// SetNamespaceTag sets the namespace tag.
	SetNamespaceTag(value []byte) Options

	// NamespaceTag returns the namespace tag.
	NamespaceTag() []byte

	// SetDefaultNamespace sets the default namespace for ids without a namespace.
	SetDefaultNamespace(value []byte) Options

	// DefaultNamespace returns the default namespace for ids without a namespace.
	DefaultNamespace() []byte

	// SetMatchRangePast sets the limit on the earliest time eligible for rule matching.
	SetMatchRangePast(value time.Duration) Options

	// MatchRangePast returns the limit on the earliest time eligible for rule matching.
	MatchRangePast() time.Duration

	// SetOnNamespaceAddedFn sets the function to be called when a namespace is added.
	SetOnNamespaceAddedFn(value OnNamespaceAddedFn) Options

	// OnNamespaceAddedFn returns the function to be called when a namespace is added.
	OnNamespaceAddedFn() OnNamespaceAddedFn

	// SetOnNamespaceRemovedFn sets the function to be called when a namespace is removed.
	SetOnNamespaceRemovedFn(value OnNamespaceRemovedFn) Options

	// OnNamespaceRemovedFn returns the function to be called when a namespace is removed.
	OnNamespaceRemovedFn() OnNamespaceRemovedFn

	// SetOnRuleSetUpdatedFn sets the function to be called when a ruleset is updated.
	SetOnRuleSetUpdatedFn(value OnRuleSetUpdatedFn) Options

	// OnRuleSetUpdatedFn returns the function to be called when a ruleset is updated.
	OnRuleSetUpdatedFn() OnRuleSetUpdatedFn
}

Options provide a set of options for the matcher.

func NewOptions

func NewOptions() Options

NewOptions creates a new set of options.

type RuleSet

type RuleSet interface {
	runtime.Value
	rules.Matcher

	// Namespace returns the namespace of the ruleset.
	Namespace() []byte

	// Version returns the current version of the ruleset.
	Version() int

	// CutoverNanos returns the cutover time of the ruleset.
	CutoverNanos() int64

	// Tombstoned returns whether the ruleset is tombstoned.
	Tombstoned() bool
}

RuleSet manages runtime updates to registered rules and provides API to match metic ids against rules in the corresponding ruleset.

type RuleSetKeyFn

type RuleSetKeyFn func(namespace []byte) string

RuleSetKeyFn generates the ruleset key for a given namespace.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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