Skip to main content

Instance

Struct Instance 

Source
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<'_>

Source

pub fn smf_state(&mut self) -> Result<String, InstanceSmfStateError>

Get the current SMF state of this instance.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn smf_restart(&mut self) -> Result<(), InstanceOpError>

Restart this instance.

§Errors

Fails if called under an IsolatedConfigd testing setup.

Source

pub fn smf_restore(&mut self) -> Result<(), InstanceOpError>

Restore this instance.

§Errors

Fails if called under an IsolatedConfigd testing setup.

Source§

impl<'a> Instance<'a>

Source

pub fn name(&self) -> &str

The name of this instance.

Source

pub fn fmri(&self) -> &str

The full FMRI of this instance.

Source

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.

Source

pub fn snapshot(&self, name: &str) -> Result<Option<Snapshot<'_>>, LookupError>

Look up a snapshot in this instance by name.

Source

pub fn snapshots(&self) -> Result<Snapshots<'_>, IterError>

Get an iterator over all Snapshots in this instance.

Trait Implementations§

Source§

impl<'a> Debug for Instance<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl EditPropertyGroups for Instance<'_>

Source§

fn add_property_group( &mut self, name: &str, pg_type: PropertyGroupType, flags: AddPropertyGroupFlags, ) -> Result<PropertyGroup<'_, PropertyGroupDirect>, PropertyGroupAddError>

Add a new property group.
Source§

fn ensure_property_group( &mut self, name: &str, pg_type: PropertyGroupType, flags: AddPropertyGroupFlags, ) -> Result<PropertyGroup<'_, PropertyGroupDirect>, PropertyGroupAddError>

Ensure a property group exists. Read more
Source§

fn delete_property_group( &mut self, name: &str, ) -> Result<DeletePropertyGroupResult, PropertyGroupDeleteError>

Delete a property group by name.
Source§

impl HasComposedPropertyGroups for Instance<'_>

Source§

fn property_group_composed( &self, name: &str, ) -> Result<Option<PropertyGroup<'_, PropertyGroupComposed>>, LookupError>

Look up a composed property group by name.
Source§

fn property_groups_composed( &self, ) -> Result<PropertyGroups<'_, PropertyGroupComposed>, IterError>

Iterate over all composed property groups.
Source§

impl HasDirectPropertyGroups for Instance<'_>

Source§

fn property_group_direct( &self, name: &str, ) -> Result<Option<PropertyGroup<'_, PropertyGroupDirect>>, LookupError>

Look up a direct-attached property group by name.
Source§

fn property_groups_direct( &self, ) -> Result<PropertyGroups<'_, PropertyGroupDirect>, IterError>

Iterate over all direct-attached property groups.
Source§

impl ToEntityDescription for Instance<'_>

Source§

fn to_entity_description(&self) -> ScfEntityDescription

Get the description of this entity.

Auto Trait Implementations§

§

impl<'a> Freeze for Instance<'a>

§

impl<'a> RefUnwindSafe for Instance<'a>

§

impl<'a> !Send for Instance<'a>

§

impl<'a> !Sync for Instance<'a>

§

impl<'a> Unpin for Instance<'a>

§

impl<'a> UnsafeUnpin for Instance<'a>

§

impl<'a> UnwindSafe for Instance<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V