matcher

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 29 Imported by: 8

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 {
	rules.ActiveSet

	// 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, optionally with a cache.

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, arg3 rules.MatchOptions) (rules.MatchResult, error)

ForwardMatch mocks base method.

func (*MockMatcher) LatestRollupRules added in v1.4.2

func (m *MockMatcher) LatestRollupRules(arg0 []byte, arg1 int64) ([]view.RollupRule, error)

LatestRollupRules 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, arg3 interface{}) *gomock.Call

ForwardMatch indicates an expected call of ForwardMatch.

func (*MockMatcherMockRecorder) LatestRollupRules added in v1.4.2

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

LatestRollupRules indicates an expected call of LatestRollupRules.

type Namespaces

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

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

	// 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

	// SetNamespaceResolver sets the NamespaceResolver.
	SetNamespaceResolver(value namespace.Resolver) Options

	// NamespaceResolver returns the namespace Resolver.
	NamespaceResolver() namespace.Resolver

	// 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

	// SetRequireNamespaceWatchOnInit sets the flag to ensure matcher is initialized with a loaded namespace watch.
	SetRequireNamespaceWatchOnInit(value bool) Options

	// RequireNamespaceWatchOnInit returns the flag to ensure matcher is initialized with a loaded namespace watch.
	RequireNamespaceWatchOnInit() bool

	// InterruptedCh returns the interrupted channel.
	InterruptedCh() <-chan struct{}

	// SetInterruptedCh sets the interrupted channel.
	SetInterruptedCh(value <-chan struct{}) Options
}

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.ActiveSet

	// 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
Package namespace provides namespace functionality for the matcher.
Package namespace provides namespace functionality for the matcher.

Jump to

Keyboard shortcuts

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