Documentation
¶
Index ¶
- func AddNotificationSocketFlag(flags *pflag.FlagSet)
- func GetNotificationSocketPath() string
- func PrepareNotificationSocketPath(rootDir string, socketNamePrefix string) (string, error)
- type CleanupStartedNotification
- type Notification
- type NotificationKind
- type NotificationSource
- type NotificationSubscription
- type NotifySubscribersFunc
- type PerftraceRequestNotification
- type UnixSocketNotificationSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNotificationSocketPath ¶
func GetNotificationSocketPath() string
func PrepareNotificationSocketPath ¶
A helper function that ensures the notification socket can be created in a folder that is writable only by the current user, and that the path is reasonably unique to the calling process. If the `rootDir` is empty, it will use the user's cache directory.
Types ¶
type CleanupStartedNotification ¶
type CleanupStartedNotification struct{}
func (*CleanupStartedNotification) Kind ¶
func (n *CleanupStartedNotification) Kind() NotificationKind
type Notification ¶
type Notification interface {
Kind() NotificationKind
}
type NotificationKind ¶
type NotificationKind string
const ( NotificationKindCleanupStarted NotificationKind = "cleanup-started" NotificationKindPerftraceRequest NotificationKind = "perftrace-request" NotificationSocketPathFlagName = "notification-socket" )
type NotificationSource ¶
type NotificationSource interface {
NotifySubscribers(n Notification) error
}
NotificationSource is a thing capable of sending notifications to subscribers.
type NotificationSubscription ¶
type NotificationSubscription interface {
Active() bool // True if the subscription is active and receiving notifications.
}
NotificationSubscription represents a subscription to notifications.
func NewNotificationSubscription ¶
func NewNotificationSubscription( lifetimeCtx context.Context, socketPath string, log logr.Logger, callback func(Notification), ) (NotificationSubscription, error)
NewNotificationSubscription creates a new notification subscription that will result in the callback being called whenever a notification is received from the socket.
type NotifySubscribersFunc ¶
type NotifySubscribersFunc func(n Notification) error
func (NotifySubscribersFunc) NotifySubscribers ¶
func (f NotifySubscribersFunc) NotifySubscribers(n Notification) error
type PerftraceRequestNotification ¶
func (*PerftraceRequestNotification) Kind ¶
func (n *PerftraceRequestNotification) Kind() NotificationKind
type UnixSocketNotificationSource ¶
type UnixSocketNotificationSource interface {
NotificationSource
SocketPath() string
}
func NewNotificationSource ¶
Click to show internal directories.
Click to hide internal directories.