events

package
v1.1.152 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// WatchTopicFilterTypeCreated filter type name
	WatchTopicFilterTypeCreated = "created"
	// WatchTopicFilterTypeUpdated filter type name
	WatchTopicFilterTypeUpdated = "updated"
	// WatchTopicFilterTypeDeleted filter type name
	WatchTopicFilterTypeDeleted = "deleted"
)

Variables

This section is empty.

Functions

func GetWatchTopic

func GetWatchTopic(cfg config.CentralConfig, client APIClient) (*management.WatchTopic, error)

GetWatchTopic retrieves a watch topic based on the agent config. Creates a watch topic if one does not exist.

Types

type APIClient

type APIClient interface {
	ExecuteAPI(method, url string, queryParam map[string]string, buffer []byte) ([]byte, error)
	GetResource(url string) (*apiv1.ResourceInstance, error)
	CreateResourceInstance(ri apiv1.Interface) (*apiv1.ResourceInstance, error)
	DeleteResourceInstance(ri apiv1.Interface) error
	GetAPIV1ResourceInstances(map[string]string, string) ([]*apiv1.ResourceInstance, error)
}

type EventListener

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

EventListener holds the various caches to save events into as they get written to the source channel.

func NewEventListener

func NewEventListener(ctx context.Context, cancel context.CancelCauseFunc, source chan *proto.Event, client APIClient, baseURL string, sequenceManager SequenceProvider, handlersByKind map[string][]handler.Handler, opts ...ListenerOpts) *EventListener

NewEventListener creates a new EventListener to process events based on the provided Handlers, indexed by the resource Kind they should be dispatched for.

func (*EventListener) Listen

func (em *EventListener) Listen()

Listen starts a loop that will process events as they are sent on the channel

func (*EventListener) Stop

func (em *EventListener) Stop()

type Listener

type Listener interface {
	Listen()
	Stop()
}

type ListenerOpts added in v1.1.152

type ListenerOpts func(el *EventListener)

func WithProvisioningWorkerCount added in v1.1.152

func WithProvisioningWorkerCount(plc int) ListenerOpts

func WithRegularWorkerCount added in v1.1.152

func WithRegularWorkerCount(rwc int) ListenerOpts

func WithWorkerBuffer added in v1.1.152

func WithWorkerBuffer(wb int) ListenerOpts

type NewListenerFunc

type NewListenerFunc func(ctx context.Context, cancel context.CancelCauseFunc, source chan *proto.Event, client APIClient, baseURL string, sequenceManager SequenceProvider, handlersByKind map[string][]handler.Handler, opts ...ListenerOpts) *EventListener

type NewRequestQueueFunc added in v1.1.105

type NewRequestQueueFunc func(ctx context.Context, cancel context.CancelCauseFunc, requestCh chan *proto.Request) RequestQueue

NewRequestQueueFunc type for creating a new request queue

type RequestQueue added in v1.1.105

type RequestQueue interface {
	Start()
	Write(request *proto.Request) error
	Stop()
	IsActive() bool
}

func NewRequestQueue added in v1.1.105

func NewRequestQueue(ctx context.Context, cancel context.CancelCauseFunc, requestCh chan *proto.Request) RequestQueue

NewRequestQueue creates a new queue for the requests to be sent for watch subscription

type SequenceProvider

type SequenceProvider interface {
	GetSequence() int64
	SetSequence(sequenceID int64)
}

SequenceProvider - Interface to provide event sequence ID to harvester client to fetch events

func NewSequenceProvider

func NewSequenceProvider(cacheManager agentcache.Manager, watchTopicName string) SequenceProvider

NewSequenceProvider creates a new SequenceProvider

type WatchTopicValues

type WatchTopicValues struct {
	Name        string
	Title       string
	Description string
	Kinds       []kindValues
}

WatchTopicValues values to populate the watch topic template

func NewComplianceWatchTopic added in v1.1.115

func NewComplianceWatchTopic(name, scope string, agentResourceGroupKind v1.GroupKind, features watchTopicFeatures) WatchTopicValues

NewComplianceWatchTopic creates a WatchTopic template string

func NewDiscoveryWatchTopic

func NewDiscoveryWatchTopic(name, scope string, agentResourceGroupKind v1.GroupKind, features watchTopicFeatures) WatchTopicValues

NewDiscoveryWatchTopic creates a WatchTopic template string. Using a template instead of unmarshalling into a struct to avoid sending a request with empty fields

func NewTraceWatchTopic

func NewTraceWatchTopic(name, scope string, agentResourceGroupKind v1.GroupKind, features watchTopicFeatures) WatchTopicValues

NewTraceWatchTopic creates a WatchTopic template string

Jump to

Keyboard shortcuts

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