Documentation ¶
Overview ¶
Package restart implements requesting restarts from any part of the code that has access to state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearReboot ¶
ClearReboot clears state information about tracking requested reboots.
func Init ¶
Init initializes the support for restarts requests. It takes the current boot id to track and verify reboots and a Handler that handles the actual requests and reacts to reboot happening. It must be called with the state lock held.
func ReplaceBootID ¶
func Request ¶
func Request(st *state.State, t RestartType)
Request asks for a restart of the managing process. The state needs to be locked to request a restart.
Types ¶
type Handler ¶
type Handler interface { HandleRestart(t RestartType) // RebootIsFine is called early when either a reboot was // requested by snapd and happened or no reboot was expected at all. RebootIsFine(st *state.State) error // RebootIsMissing is called early instead when a reboot was // requested by snapd but did not happen. RebootIsMissing(st *state.State) error }
Handler can handle restart requests and whether expected reboots happen.
type RestartType ¶
type RestartType int
const ( RestartUnset RestartType = iota RestartDaemon RestartSystem // RestartSystemNow is like RestartSystem but action is immediate RestartSystemNow // RestartSocket will restart the daemon so that it goes into // socket activation mode. RestartSocket // Stop just stops the daemon (used with image pre-seeding) StopDaemon // RestartSystemHaltNow will shutdown --halt the system asap RestartSystemHaltNow // RestartSystemPoweroffNow will shutdown --poweroff the system asap RestartSystemPoweroffNow RestartServiceFailure RestartCheckFailure )
func FakePending ¶
func FakePending(st *state.State, restarting RestartType) RestartType
Click to show internal directories.
Click to hide internal directories.