Documentation
¶
Overview ¶
Package bus provides access to a singleton instance of an event bus (provided by the calling application). These events can provide static information, but also have an object as a payload for which the consumer can poll for updates.
Note that the singleton instance is only allowed to publish events and not subscribe to them --this is intentional. Internal library interactions should continue to use traditional in-execution-path approaches for data sharing (e.g. function returns and channels) and not depend on bus subscriptions for critical interactions (e.g. one part of the lib publishes an event and another part of the lib subscribes and reacts to that event). The bus is provided only as a means for consumers to observe events emitted from the library (such as to provide a rich UI) and not to allow consumers to augment or otherwise change execution.
Index ¶
Constants ¶
const ( StartScanTryFetchImageID EventType = "start-scan-fetch-image-id" NewVersionAvailable EventType = "new-version-event" NewMessageDetected EventType = "new-message-event" NewErrorDetected EventType = "new-error-event" NewCollectLayers EventType = "new-collect-layers" ScanStarted EventType = "image-scanning-started-event" ScanFinished EventType = "image-scanning-finished-event" PrintSBOM EventType = "print-sbom-event" PrintPayload EventType = "print-payload-event" ValidateFinishedWithViolations EventType = "validate-finished-with-violations" ValidateFinishedSuccessfully EventType = "validate-finished-successfully" PullDockerImage = EventType(stereoevent.PullDockerImage) FetchImage = EventType(stereoevent.FetchImage) ReadImage = EventType(stereoevent.ReadImage) ReadLayer = EventType(stereoevent.ReadLayer) CatalogerStarted = EventType(syftevent.PackageCatalogerStarted) )
All the event types for the bus.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorEvent ¶
type ErrorEvent struct { Event // contains filtered or unexported fields }
ErrorEvent is the NewErrorDetected type event.
func NewErrorEvent ¶
func NewErrorEvent(err error) *ErrorEvent
NewErrorEvent returns a NewErrorDetected type event.
func (ErrorEvent) ExitCode ¶
func (e ErrorEvent) ExitCode() int
ExitCode returns the exit code of the error of the event.
type Event ¶
Event is the interface for the message in the bus.
func NewMessageEvent ¶
NewMessageEvent returns a NewMessageDetected type event.
func NewVersionEvent ¶
NewVersionEvent returns a NewVersionAvailable type event.