pub struct NamespaceFaultConfig {
    pub recv_changed_namespace: Receiver<NamespaceChange>,
}Expand description
A fault config to trigger spurious namespace change notifications from the controller.
The fault controller listens on the provided channel for notifications containing
a u32 value representing the NSID (Namespace Identifier) that has changed.
This does not actually modify the namespace; instead, it triggers the controller
to process a namespace change notification. The fault is modeled as an
RPC, which the controller completes once it has processed the change and sent
the corresponding Asynchronous Event Notification (AEN).
As per NVMe spec: If multiple namespace changes are notified, only the first triggers an AEN.
Subsequent changes do not trigger additional AENs until the driver issues a
GET_LOG_PAGE command. For implementation simplicity, namespace fault is not
gated by the fault_active flag. Since only test code can send
notifications on the fault channel, it is safe to bypass this check.
§Example
Send a namespace change notification for NSID 1 and wait for it to be processed.
use mesh::CellUpdater;
use nvme_resources::fault::NamespaceChange;
use nvme_resources::fault::FaultConfiguration;
use nvme_resources::fault::NamespaceFaultConfig;
use nvme_resources::NvmeFaultControllerHandle;
use guid::Guid;
use mesh::rpc::RpcSend;
pub async fn send_namespace_change_fault() {
    let mut fault_start_updater = CellUpdater::new(false);
    let (ns_change_send, ns_change_recv) = mesh::channel::<NamespaceChange>();
    let fault_configuration = FaultConfiguration::new(fault_start_updater.cell())
        .with_namespace_fault(
            NamespaceFaultConfig::new(ns_change_recv),
        );
    // Complete setup
    let fault_controller_handle = NvmeFaultControllerHandle {
        subsystem_id: Guid::new_random(),
        msix_count: 10,
        max_io_queues: 10,
        namespaces: vec![
            // Define `NamespaceDefinitions` here
        ],
        fault_config: fault_configuration,
    };
    // Send the namespace change notification and await processing.
    ns_change_send.call(NamespaceChange::ChangeNotification, 1).await.unwrap();
}Fields§
§recv_changed_namespace: Receiver<NamespaceChange>Receiver for changed namespace notifications
Implementations§
Source§impl NamespaceFaultConfig
 
impl NamespaceFaultConfig
Sourcepub fn new(recv_changed_namespace: Receiver<NamespaceChange>) -> Self
 
pub fn new(recv_changed_namespace: Receiver<NamespaceChange>) -> Self
Creates a new NamespaceFaultConfig with a fresh channel.
Trait Implementations§
Source§impl DefaultEncoding for NamespaceFaultConfig
 
impl DefaultEncoding for NamespaceFaultConfig
Source§impl<'encoding> StructDecodeMetadata<'encoding, Resource> for NamespaceFaultConfig
 
impl<'encoding> StructDecodeMetadata<'encoding, Resource> for NamespaceFaultConfig
Source§impl StructEncodeMetadata<Resource> for NamespaceFaultConfig
 
impl StructEncodeMetadata<Resource> for NamespaceFaultConfig
Auto Trait Implementations§
impl Freeze for NamespaceFaultConfig
impl !RefUnwindSafe for NamespaceFaultConfig
impl Send for NamespaceFaultConfig
impl Sync for NamespaceFaultConfig
impl Unpin for NamespaceFaultConfig
impl !UnwindSafe for NamespaceFaultConfig
Blanket Implementations§
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>
§impl<T> MeshField for T
 
impl<T> MeshField for T
§impl<T> MeshPayload for T
 
impl<T> MeshPayload for T
§impl<T> SerializeMessage for Twhere
    T: 'static + MeshPayload + Send,
 
impl<T> SerializeMessage for Twhere
    T: 'static + MeshPayload + Send,
§fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
 
fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
MessageEncode::compute_message_size].§fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
 
fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
MessageEncode::write_message].