Documentation
¶
Index ¶
- type MetricsDataSource
- func (fds *MetricsDataSource) AppendExtractor(_ plugin.Plugin) error
- func (fds *MetricsDataSource) Dispatch(_ context.Context, ep fwkdl.Endpoint) error
- func (fds *MetricsDataSource) SetErrors(errors map[types.NamespacedName]error)
- func (fds *MetricsDataSource) SetMetrics(metrics map[types.NamespacedName]*fwkdl.Metrics)
- func (fds *MetricsDataSource) TypedName() plugin.TypedName
- type NotificationSource
- func (m *NotificationSource) Collect(_ context.Context, _ fwkdl.Endpoint) error
- func (m *NotificationSource) Extractors() []string
- func (m *NotificationSource) GVK() schema.GroupVersionKind
- func (m *NotificationSource) Notify(_ context.Context, event fwkdl.NotificationEvent) (*fwkdl.NotificationEvent, error)
- func (m *NotificationSource) TypedName() plugin.TypedName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MetricsDataSource ¶
type MetricsDataSource struct {
CallCount int64
// contains filtered or unexported fields
}
MetricsDataSource is a test PollingDispatcher: on Dispatch it writes the preconfigured metrics into the endpoint and returns a sentinel error. The sentinel signals "test dispatch ran" without producing real Poll data.
func NewDataSource ¶
func NewDataSource(typedName plugin.TypedName) *MetricsDataSource
func (*MetricsDataSource) AppendExtractor ¶
func (fds *MetricsDataSource) AppendExtractor(_ plugin.Plugin) error
AppendExtractor is a no-op: this mock sets endpoint metrics directly in Dispatch instead of running extractors.
func (*MetricsDataSource) Dispatch ¶
Dispatch satisfies PollingDispatcher. Preserves the original mock side effect (write metrics into the endpoint when keyed by NamespacedName) and returns the sentinel error so tests can detect the dispatch ran.
func (*MetricsDataSource) SetErrors ¶
func (fds *MetricsDataSource) SetErrors(errors map[types.NamespacedName]error)
SetErrors replaces the errors map in a thread-safe manner.
func (*MetricsDataSource) SetMetrics ¶
func (fds *MetricsDataSource) SetMetrics(metrics map[types.NamespacedName]*fwkdl.Metrics)
SetMetrics replaces the metrics map in a thread-safe manner.
func (*MetricsDataSource) TypedName ¶
func (fds *MetricsDataSource) TypedName() plugin.TypedName
type NotificationSource ¶
type NotificationSource struct {
// contains filtered or unexported fields
}
NotificationSource implements DataSource + NotificationSource for testing.
func NewNotificationSource ¶
func NewNotificationSource(pluginType, name string, gvk schema.GroupVersionKind) *NotificationSource
func (*NotificationSource) Extractors ¶
func (m *NotificationSource) Extractors() []string
func (*NotificationSource) GVK ¶
func (m *NotificationSource) GVK() schema.GroupVersionKind
func (*NotificationSource) Notify ¶
func (m *NotificationSource) Notify(_ context.Context, event fwkdl.NotificationEvent) (*fwkdl.NotificationEvent, error)
func (*NotificationSource) TypedName ¶
func (m *NotificationSource) TypedName() plugin.TypedName