Documentation
¶
Index ¶
- type BusType
- type Notification
- type NotificationType
- type Publisher
- type Subscriber
- type VersionManager
- func (m *VersionManager) ClearConsoleNotification(ctx context.Context, orgId uuid.UUID, name string) error
- func (m *VersionManager) NotifyConsole(ctx context.Context, orgId uuid.UUID, name string) error
- func (m *VersionManager) NotifyEnrollmentHooks(ctx context.Context, orgId uuid.UUID, name string) error
- func (m *VersionManager) Start(ctx context.Context) error
- func (m *VersionManager) StoreAndNotify(ctx context.Context, orgId uuid.UUID, name string, renderedVersion string) error
- func (m *VersionManager) SubscribeEnrollmentHooks(orgId uuid.UUID, name string) (<-chan Notification, func())
- func (m *VersionManager) WaitForEnrollmentHooksNotification(ctx context.Context, orgId uuid.UUID, name string) (bool, error)
- func (m *VersionManager) WaitForNotification(ctx context.Context, orgId uuid.UUID, name string, knownRenderedVersion string) (Notification, bool, error)
- func (m *VersionManager) WaitOnEnrollmentHooksChannel(ctx context.Context, ch <-chan Notification) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notification ¶ added in v1.3.0
type Notification struct {
Type NotificationType
RenderedVersion string // only populated for NotificationTypeSpecUpdated
}
Notification is the internal signal sent over the pub/sub channel to unblock a waiting GetRenderedDevice long-poll on the API server.
type NotificationType ¶ added in v1.3.0
type NotificationType string
NotificationType distinguishes between different kinds of notifications that wake a device agent's long-poll. It is intentionally decoupled from the persisted auditing Event system (api/core/v1beta1).
const ( NotificationTypeSpecUpdated NotificationType = "spec-updated" NotificationTypeConsole NotificationType = "console" NotificationTypeEnrollmentHooks NotificationType = "enrollment-hooks" )
type Publisher ¶
type Subscriber ¶
type Subscriber interface {
Subscribe(ctx context.Context, handler func(ctx context.Context, orgId uuid.UUID, name string, n Notification) error) error
}
func NewSubscriber ¶
type VersionManager ¶
type VersionManager struct {
// contains filtered or unexported fields
}
func (*VersionManager) ClearConsoleNotification ¶ added in v1.3.0
func (m *VersionManager) ClearConsoleNotification(ctx context.Context, orgId uuid.UUID, name string) error
ClearConsoleNotification removes the console-pending KV flag after the agent has been woken.
func (*VersionManager) NotifyConsole ¶ added in v1.3.0
NotifyConsole sets the console-pending KV flag and publishes a console notification so that a waiting GetRenderedDevice long-poll is unblocked immediately.
func (*VersionManager) NotifyEnrollmentHooks ¶ added in v1.4.0
func (m *VersionManager) NotifyEnrollmentHooks(ctx context.Context, orgId uuid.UUID, name string) error
NotifyEnrollmentHooks publishes an EnrollmentHooks notification so a waiting WatchEnrollmentHooks stream is unblocked immediately.
func (*VersionManager) StoreAndNotify ¶
func (*VersionManager) SubscribeEnrollmentHooks ¶ added in v1.4.0
func (m *VersionManager) SubscribeEnrollmentHooks(orgId uuid.UUID, name string) (<-chan Notification, func())
SubscribeEnrollmentHooks registers a buffered EnrollmentHooks notifier for the lifetime of a watch. The caller must invoke the returned cancel function.
func (*VersionManager) WaitForEnrollmentHooksNotification ¶ added in v1.4.0
func (m *VersionManager) WaitForEnrollmentHooksNotification(ctx context.Context, orgId uuid.UUID, name string) (bool, error)
WaitForEnrollmentHooksNotification blocks until an EnrollmentHooks notification arrives or the wait times out. Returns (true, nil) when a notification was received, (false, nil) on timeout.
func (*VersionManager) WaitForNotification ¶ added in v1.3.0
func (m *VersionManager) WaitForNotification(ctx context.Context, orgId uuid.UUID, name string, knownRenderedVersion string) (Notification, bool, error)
WaitForNotification blocks until a Notification occurs, then returns it. Returns (Notification{}, false, nil) on timeout — caller should return 204.
func (*VersionManager) WaitOnEnrollmentHooksChannel ¶ added in v1.4.0
func (m *VersionManager) WaitOnEnrollmentHooksChannel(ctx context.Context, ch <-chan Notification) (bool, error)
WaitOnEnrollmentHooksChannel blocks until a notification arrives on ch or the wait times out. Returns (true, nil) when a notification was received, (false, nil) on timeout.