Documentation ¶
Overview ¶
Package event defines Lucifer events and a function for running Lucifer with an event handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbortWhenDone ¶
func AbortWhenDone(ctx context.Context, path string) context.CancelFunc
AbortWhenDone forwards an abort message to an abort socket when provided context is Done().
This function spawns a goroutine that is cleaned up when the returned CancelFunc is called.
Types ¶
type Event ¶
type Event string
Event is a string enum type for valid events to pass to Send and SendWithMsg. Handler functions should be able to handle all of these.
const ( // Starting indicates that the task is beginning to run. Starting Event = "starting" // The following events indicate task status. The handler may // use these to track task status. Provisioning Event = "provisioning" Running Event = "running" Gathering Event = "gathering" Parsing Event = "parsing" Aborted Event = "aborted" // Completed indicates that the task has completed. The // handler may run any post-task logic on receiving this // event. Completed Event = "completed" )
Task status events.
const ( // HostClean indicates that the host is ready to run tests and // that it is clean. The handler should mark the host as not // dirty if the handler is tracking host dirtiness. HostClean // should be considered a superset of HostReady. HostClean Event = "host_clean" HostFailedRepair Event = "host_failed_repair" HostNeedsCleanup Event = "host_needs_cleanup" HostNeedsRepair Event = "host_needs_repair" HostNeedsReset Event = "host_needs_reset" // HostReady indicates that the host is ready to run tests. // HostReady should not be sent together with HostClean. HostReady Event = "host_ready" // HostReadyToRun indicates that the host is ready to run // tests, after provisioning and before running tests as part // of a Lucifer task. This is a transitory state, not a final // state like HostReady. HostReadyToRun Event = "host_ready_to_run" // HostRunning indicates that the host is running a test. The // handler may mark the host as dirty if the handler is // tracking host dirtiness. HostRunning Event = "host_running" // NeedsDeploy indicates that the host fails the deploy task and needs // to be deployed again. HostNeedsDeploy Event = "host_needs_deploy" // HostNeedsManualRepair indicates that the host required manual attention to be fixed HostNeedsManualRepair Event = "host_needs_manual_repair" // HostNeedsReplacement indicates that the host is not fixable due issues with hardware and has to be replaced HostNeedsReplacement Event = "host_needs_replacement" )
Host status events.
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
Forwarder encapsulates cleanup for ForwardAbortSignal.
func ForwardAbortSignal ¶
ForwardAbortSignal catches termination signals and forwards them as abort messages to an abort socket. This function spawns a goroutine and modifies the process signal handlers. Both of these are cleaned up when the returned Forwarder is closed.