pub struct Instance<'a> { /* private fields */ }Expand description
Handle to an SMF instance.
Instances may be obtained by way of their parent service
(Service::instance()), by direct-FMRI lookup
(Scf::instance_from_fmri()), or by direct-FMRI lookup for the current
process assuming it is running under SMF
(Scf::self_instance_from_env()).
For processes that want to read their own effective configuration, the
recommended path is to obtain the self instance via
Scf::self_instance_from_env() and then obtain the running snapshot via
Instance::snapshot("running").
Implementations§
Source§impl Instance<'_>
impl Instance<'_>
Sourcepub fn smf_state(&mut self) -> Result<String, InstanceSmfStateError>
pub fn smf_state(&mut self) -> Result<String, InstanceSmfStateError>
Get the current SMF state of this instance.
Sourcepub fn smf_degrade(
&mut self,
flags: Option<SmfDegradeFlags>,
) -> Result<(), InstanceOpError>
pub fn smf_degrade( &mut self, flags: Option<SmfDegradeFlags>, ) -> Result<(), InstanceOpError>
Put this instance into the degraded state.
§Errors
Fails if called under an IsolatedConfigd testing setup.
Sourcepub fn smf_disable(
&mut self,
flags: Option<SmfEnableDisableFlags>,
comment: Option<&str>,
) -> Result<(), InstanceOpError>
pub fn smf_disable( &mut self, flags: Option<SmfEnableDisableFlags>, comment: Option<&str>, ) -> Result<(), InstanceOpError>
Put this instance into the disabled state.
§Errors
Fails if called under an IsolatedConfigd testing setup.
Sourcepub fn smf_enable(
&mut self,
flags: Option<SmfEnableDisableFlags>,
comment: Option<&str>,
) -> Result<(), InstanceOpError>
pub fn smf_enable( &mut self, flags: Option<SmfEnableDisableFlags>, comment: Option<&str>, ) -> Result<(), InstanceOpError>
Put this instance into the enabled state.
§Errors
Fails if called under an IsolatedConfigd testing setup.
Sourcepub fn smf_maintain(
&mut self,
flags: Option<SmfMaintainFlags>,
) -> Result<(), InstanceOpError>
pub fn smf_maintain( &mut self, flags: Option<SmfMaintainFlags>, ) -> Result<(), InstanceOpError>
Put this instance into the maintenance state.
§Errors
Fails if called under an IsolatedConfigd testing setup.
Sourcepub fn smf_restart(&mut self) -> Result<(), InstanceOpError>
pub fn smf_restart(&mut self) -> Result<(), InstanceOpError>
Sourcepub fn smf_restore(&mut self) -> Result<(), InstanceOpError>
pub fn smf_restore(&mut self) -> Result<(), InstanceOpError>
Source§impl<'a> Instance<'a>
impl<'a> Instance<'a>
Sourcepub fn smf_refresh(&mut self) -> Result<(), InstanceOpError>
pub fn smf_refresh(&mut self) -> Result<(), InstanceOpError>
Refresh this instance.
This is equivalent to running svcadm refresh THIS_INSTANCE; i.e.,
it will both update the "running" snapshot to match any property
changes made since the last time the instance was refreshed and will
invoke the instance’s SMF refresh method.