pub struct Providers { /* private fields */ }Expand description
The OTA Requestor’s provider registry: the persistent, fabric-scoped
DefaultOTAProviders list (at most one entry per fabric) and a transient
cache of providers learned via AnnounceOTAProvider.
Modeled on the Binding cluster’s registry: the default list is persisted as a
single TLV blob under OTA_PROVIDERS_KEY; announced providers are never
persisted. wait_changed signals the application when
the set changes (an admin write or an announcement).
Implementations§
Source§impl Providers
impl Providers
Sourcepub const fn new() -> Providers
pub const fn new() -> Providers
Create an empty registry. Prefer Self::init for a large MAX_FABRICS.
Sourcepub fn load_persist<S>(&self, store: S, buf: &mut [u8]) -> Result<(), Error>where
S: KvBlobStore,
pub fn load_persist<S>(&self, store: S, buf: &mut [u8]) -> Result<(), Error>where
S: KvBlobStore,
Re-hydrate the default provider list from store.
Called on startup via the LifecycleOp::Startup lifecycle operation
delivered to the OtaRequestorHandler borrowing this registry.
Sourcepub fn reset_persist<S>(&self, store: S, buf: &mut [u8]) -> Result<(), Error>where
S: KvBlobStore,
pub fn reset_persist<S>(&self, store: S, buf: &mut [u8]) -> Result<(), Error>where
S: KvBlobStore,
Reset the registry - both the persisted default provider list and the
transient announced-provider cache - and remove the persisted blob from
store (under OTA_PROVIDERS_KEY).
Called on factory reset via the LifecycleOp::FactoryReset lifecycle
operation delivered to the OtaRequestorHandler borrowing this registry.
Sourcepub fn remove_for_fabric(&self, fab_idx: NonZero<u8>) -> bool
pub fn remove_for_fabric(&self, fab_idx: NonZero<u8>) -> bool
Drop the default and announced providers belonging to fab_idx,
returning whether anything was removed. Signals
wait_changed when so.
Called on fabric removal via the LifecycleOp::FabricRemoval
lifecycle operation delivered to the OtaRequestorHandler borrowing
this registry. Idempotent.
Sourcepub fn get(&self, index: usize) -> Option<Provider>
pub fn get(&self, index: usize) -> Option<Provider>
The index-th default provider, cloned out so the registry lock is not
held across the caller’s subsequent (likely async) work.
Sourcepub fn announced_len(&self) -> usize
pub fn announced_len(&self) -> usize
The number of cached announced providers.
Sourcepub fn announced(&self, index: usize) -> Option<Provider>
pub fn announced(&self, index: usize) -> Option<Provider>
The index-th announced provider, cloned out.
Sourcepub fn clear_announced(&self)
pub fn clear_announced(&self)
Drop all cached announced providers (e.g. once the app has queried them).
Sourcepub fn take_announced(
&self,
) -> Vec<Provider, rs_matter::::dm::clusters::ota_req::{impl#2}::take_announced::{constant#0}>
pub fn take_announced( &self, ) -> Vec<Provider, rs_matter::::dm::clusters::ota_req::{impl#2}::take_announced::{constant#0}>
Atomically remove and return all cached announced providers.
Prefer this to iterating announced and then calling
clear_announced in an update loop: providers
learned via AnnounceOTAProvider while the loop is busy processing this
batch land in a fresh announced set (and re-arm wait_changed)
instead of being discarded unprocessed by a trailing clear.
Sourcepub async fn wait_changed(&self)
pub async fn wait_changed(&self)
Wait until the provider set changes (a DefaultOTAProviders write or an
AnnounceOTAProvider command).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Providers
impl !RefUnwindSafe for Providers
impl !Sync for Providers
impl Send for Providers
impl Unpin for Providers
impl UnsafeUnpin for Providers
impl UnwindSafe for Providers
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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