pub enum ShutdownWatcherRegisterRequest {
RegisterWatcher {
watcher: ClientEnd<ShutdownWatcherMarker>,
responder: ShutdownWatcherRegisterRegisterWatcherResponder,
},
RegisterTerminalStateWatcher {
watcher: ClientEnd<TerminalStateWatcherMarker>,
responder: ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder,
},
#[non_exhaustive] _UnknownMethod {
ordinal: u64,
control_handle: ShutdownWatcherRegisterControlHandle,
method_type: MethodType,
},
}Expand description
Allows components to register a callback that will be executed when reboots or shutdowns occur. The main purpose of this protocol is to be able to track shutdown reasons and provide signals to critical platform components that cannot rely on Component Framework’s orderly shutdown. Before relying on this protocol, consider using Component Framework’s orderly shutdown pattern or component lifecycle hooks.
Variants§
RegisterWatcher
Registers a watcher to be notified when the Admin.Shutdown method is called.
Once the watcher has been successfully registered with the server, then the request will be completed and the ShutdownWatcherRegister channel will be left open (though a client is free to close it at this time).
If there is an error in registering the watcher, then the ShutdownWatcherRegister channel will be closed without completing the request.
The provided watcher channel will be used at most once to notify the
watcher of an impending shutdown and allow it the chance to respond.
Watchers can unregister by closing their ShutdownWatcher channel.
Fields
watcher: ClientEnd<ShutdownWatcherMarker>RegisterTerminalStateWatcher
Registers a watcher to be notified when the system begins a transition to a terminal state regardless of the trigger.
The [TerminalStateWatcher] is notified for all reboots, power-offs, and kernel-initiated
shutdowns. It does not provide reasons or options.
Once the watcher has been successfully registered with the server, then the request will be completed and the ShutdownWatcherRegister channel will be left open (though a client is free to close it at this time).
If there is an error in registering the watcher, then the ShutdownWatcherRegister channel will be closed without completing the request.
The provided watcher channel will be used at most once to notify the
watcher of an impending shutdown and allow it the chance to respond.
Watchers can unregister by closing their TerminalStateWatcher channel.
Fields
watcher: ClientEnd<TerminalStateWatcherMarker>#[non_exhaustive]_UnknownMethod
An interaction was received which does not match any known method.
Fields
This variant is marked as non-exhaustive
control_handle: ShutdownWatcherRegisterControlHandlemethod_type: MethodTypeImplementations§
Source§impl ShutdownWatcherRegisterRequest
impl ShutdownWatcherRegisterRequest
pub fn into_register_watcher( self, ) -> Option<(ClientEnd<ShutdownWatcherMarker>, ShutdownWatcherRegisterRegisterWatcherResponder)>
pub fn into_register_terminal_state_watcher( self, ) -> Option<(ClientEnd<TerminalStateWatcherMarker>, ShutdownWatcherRegisterRegisterTerminalStateWatcherResponder)>
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL