routing

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package routing is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockPolicyConfig

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

MockPolicyConfig is a mock of PolicyConfig interface.

func NewMockPolicyConfig

func NewMockPolicyConfig(ctrl *gomock.Controller) *MockPolicyConfig

NewMockPolicyConfig creates a new mock instance.

func (*MockPolicyConfig) EXPECT

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

func (*MockPolicyConfig) TrafficTypes

func (m *MockPolicyConfig) TrafficTypes() map[string]uint64

TrafficTypes mocks base method.

type MockPolicyConfigMockRecorder

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

MockPolicyConfigMockRecorder is the mock recorder for MockPolicyConfig.

func (*MockPolicyConfigMockRecorder) TrafficTypes

func (mr *MockPolicyConfigMockRecorder) TrafficTypes() *gomock.Call

TrafficTypes indicates an expected call of TrafficTypes.

type MockPolicyHandler

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

MockPolicyHandler is a mock of PolicyHandler interface.

func NewMockPolicyHandler

func NewMockPolicyHandler(ctrl *gomock.Controller) *MockPolicyHandler

NewMockPolicyHandler creates a new mock instance.

func (*MockPolicyHandler) Close

func (m *MockPolicyHandler) Close()

Close mocks base method.

func (*MockPolicyHandler) EXPECT

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

func (*MockPolicyHandler) GetTrafficTypes

func (m *MockPolicyHandler) GetTrafficTypes() map[string]uint64

GetTrafficTypes mocks base method.

func (*MockPolicyHandler) Subscribe

func (m *MockPolicyHandler) Subscribe(arg0 PolicyUpdateListener) int

Subscribe mocks base method.

func (*MockPolicyHandler) Unsubscribe

func (m *MockPolicyHandler) Unsubscribe(arg0 int)

Unsubscribe mocks base method.

type MockPolicyHandlerMockRecorder

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

MockPolicyHandlerMockRecorder is the mock recorder for MockPolicyHandler.

func (*MockPolicyHandlerMockRecorder) Close

Close indicates an expected call of Close.

func (*MockPolicyHandlerMockRecorder) GetTrafficTypes

func (mr *MockPolicyHandlerMockRecorder) GetTrafficTypes() *gomock.Call

GetTrafficTypes indicates an expected call of GetTrafficTypes.

func (*MockPolicyHandlerMockRecorder) Subscribe

func (mr *MockPolicyHandlerMockRecorder) Subscribe(arg0 interface{}) *gomock.Call

Subscribe indicates an expected call of Subscribe.

func (*MockPolicyHandlerMockRecorder) Unsubscribe

func (mr *MockPolicyHandlerMockRecorder) Unsubscribe(arg0 interface{}) *gomock.Call

Unsubscribe indicates an expected call of Unsubscribe.

type PolicyConfig

type PolicyConfig interface {
	TrafficTypes() map[string]uint64
}

PolicyConfig contains information for how to route metrics to a consumer service.

func NewPolicyConfig

func NewPolicyConfig(trafficTypes map[string]uint64) PolicyConfig

NewPolicyConfig creates a new policy config.

func NewPolicyConfigFromValue

func NewPolicyConfigFromValue(v kv.Value) (PolicyConfig, error)

NewPolicyConfigFromValue creates a new policy from a value, where the value is a protobuf message of RoutingPolicyConfig.

type PolicyHandler

type PolicyHandler interface {
	// Close closes the policy watcher.
	Close()
	// GetTrafficTypes returns the traffic types.
	GetTrafficTypes() map[string]uint64
	// Subscribe adds a listener that will be called when the policy updates.
	// Returns a subscription ID that can be used to unsubscribe.
	Subscribe(listener PolicyUpdateListener) int
	// Unsubscribe removes a listener by its subscription ID.
	Unsubscribe(id int)
}

PolicyHandler handles dynamic routing policy updates from a KV store.

func NewRoutingPolicyHandler

func NewRoutingPolicyHandler(opts PolicyHandlerOptions) (PolicyHandler, error)

NewRoutingPolicyHandler creates a new routing policy handler.

type PolicyHandlerOptions

type PolicyHandlerOptions interface {
	WithKVClient(kvClient client.Client) PolicyHandlerOptions
	KVClient() client.Client

	WithKVOverrideOptions(kvOverrideOptions kv.OverrideOptions) PolicyHandlerOptions
	KVOverrideOptions() kv.OverrideOptions

	WithKVKey(kvKey string) PolicyHandlerOptions
	KVKey() string

	Validate() error
}

PolicyHandlerOptions provides options for creating a PolicyHandler.

func NewPolicyHandlerOptions

func NewPolicyHandlerOptions() PolicyHandlerOptions

NewPolicyHandlerOptions creates a new PolicyHandlerOptions.

type PolicyUpdateListener

type PolicyUpdateListener func(PolicyConfig)

PolicyUpdateListener is called when the policy configuration changes.

Jump to

Keyboard shortcuts

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