pub struct DMSCDeviceControlModule { /* private fields */ }Expand description
Main device control module for DMSC.
This module provides comprehensive smart device control functionality, including device discovery, control, and resource scheduling. It manages devices and their resources across distributed environments.
Implementations§
Source§impl DMSCDeviceControlModule
impl DMSCDeviceControlModule
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new device control module with default configuration.
§Returns
A new DMSCDeviceControlModule instance with default configuration
Sourcepub fn with_config(self, config: DMSCDeviceControlConfig) -> Self
pub fn with_config(self, config: DMSCDeviceControlConfig) -> Self
Sourcepub async fn discover_devices(&self) -> DMSCResult<DMSCDiscoveryResult>
pub async fn discover_devices(&self) -> DMSCResult<DMSCDiscoveryResult>
Discovers devices in the network/environment.
This method performs a device discovery scan if discovery is enabled, returning information about discovered, updated, and removed devices.
§Returns
A DMSCResult<DMSCDiscoveryResult> containing the discovery results
Sourcepub async fn allocate_resource(
&self,
request: DMSCResourceRequest,
) -> DMSCResult<Option<DMSCResourceAllocation>>
pub async fn allocate_resource( &self, request: DMSCResourceRequest, ) -> DMSCResult<Option<DMSCResourceAllocation>>
Allocates a device resource based on the given request.
This method finds a suitable device based on the requested device type and capabilities, allocates it using the device scheduler, and returns an allocation result if successful.
§Parameters
request: The resource allocation request
§Returns
A DMSCResult<Option<DMSCResourceAllocation>> containing the allocation result if successful,
or None if allocation failed or auto-scheduling is disabled
Sourcepub async fn release_resource(&self, allocation_id: &str) -> DMSCResult<()>
pub async fn release_resource(&self, allocation_id: &str) -> DMSCResult<()>
Sourcepub async fn get_device_status(&self) -> DMSCResult<Vec<DMSCDevice>>
pub async fn get_device_status(&self) -> DMSCResult<Vec<DMSCDevice>>
Gets the current status of all devices.
This method returns a list of all devices currently managed by the device controller.
§Returns
A DMSCResult<Vec<DMSCDevice>> containing all managed devices
Sourcepub fn get_resource_pool_status(
&self,
) -> HashMap<String, DMSCResourcePoolStatus>
pub fn get_resource_pool_status( &self, ) -> HashMap<String, DMSCResourcePoolStatus>
Gets the status of all resource pools.
This method returns a map of resource pool names to their current status.
§Returns
A HashMap<String, DMSCResourcePoolStatus> containing the status of all resource pools
Trait Implementations§
Source§impl DMSCModule for DMSCDeviceControlModule
impl DMSCModule for DMSCDeviceControlModule
Source§fn is_critical(&self) -> bool
fn is_critical(&self) -> bool
Indicates whether the device control module is critical.
The device control module is non-critical, meaning that if it fails to initialize or operate, it should not break the entire application. This allows the core functionality to continue even if device control features are unavailable.
§Returns
false since device control is non-critical
Source§fn init<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Initializes the device control module asynchronously.
This method performs the following steps:
- Loads configuration from the service context
- Initializes real device discovery based on system hardware
- Sets up resource scheduling and management
Source§fn before_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn after_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn before_shutdown<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_shutdown<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn shutdown<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn shutdown<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn after_shutdown<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn after_shutdown<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut DMSCServiceContext,
) -> Pin<Box<dyn Future<Output = DMSCResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl Default for DMSCDeviceControlModule
impl Default for DMSCDeviceControlModule
Source§impl<'py> IntoPyObject<'py> for DMSCDeviceControlModule
impl<'py> IntoPyObject<'py> for DMSCDeviceControlModule
Source§type Target = DMSCDeviceControlModule
type Target = DMSCDeviceControlModule
Source§type Output = Bound<'py, <DMSCDeviceControlModule as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <DMSCDeviceControlModule as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for DMSCDeviceControlModule
impl PyClass for DMSCDeviceControlModule
Source§impl PyClassImpl for DMSCDeviceControlModule
impl PyClassImpl for DMSCDeviceControlModule
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = c"Main device control module for DMSC.\n\nThis module provides comprehensive smart device control functionality, including device discovery,\ncontrol, and resource scheduling. It manages devices and their resources across distributed environments.\x00"
const RAW_DOC: &'static CStr = c"Main device control module for DMSC.\n\nThis module provides comprehensive smart device control functionality, including device discovery,\ncontrol, and resource scheduling. It manages devices and their resources across distributed environments.\x00"
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<DMSCDeviceControlModule>
type ThreadChecker = SendablePyClass<DMSCDeviceControlModule>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyMethods<DMSCDeviceControlModule> for PyClassImplCollector<DMSCDeviceControlModule>
impl PyMethods<DMSCDeviceControlModule> for PyClassImplCollector<DMSCDeviceControlModule>
fn py_methods(self) -> &'static PyClassItems
Source§impl PyTypeInfo for DMSCDeviceControlModule
impl PyTypeInfo for DMSCDeviceControlModule
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.Source§impl ServiceModule for DMSCDeviceControlModule
impl ServiceModule for DMSCDeviceControlModule
Source§fn is_critical(&self) -> bool
fn is_critical(&self) -> bool
Source§fn init(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
fn init(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
Source§fn start(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
fn start(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
Source§fn shutdown(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
fn shutdown(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
Source§fn before_start(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
fn before_start(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
Source§fn after_start(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
fn after_start(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
Source§fn before_shutdown(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
fn before_shutdown(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
Source§fn after_shutdown(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
fn after_shutdown(&mut self, _ctx: &mut DMSCServiceContext) -> DMSCResult<()>
impl DerefToPyAny for DMSCDeviceControlModule
impl ExtractPyClassWithClone for DMSCDeviceControlModule
Auto Trait Implementations§
impl Freeze for DMSCDeviceControlModule
impl !RefUnwindSafe for DMSCDeviceControlModule
impl Send for DMSCDeviceControlModule
impl Sync for DMSCDeviceControlModule
impl Unpin for DMSCDeviceControlModule
impl !UnwindSafe for DMSCDeviceControlModule
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more