Skip to main content

ReportContext

Struct ReportContext 

Source
pub struct ReportContext<'a, 's, B, const N: usize>
where B: Buffers<Vec<u8, rs_matter::::transport::exchange::Buffer::{constant#0}>> + 'a,
{ /* private fields */ }
Expand description

Per-subscription context for an in-progress report.

Implementations§

Source§

impl<'a, 's, B, const N: usize> ReportContext<'a, 's, B, N>
where B: Buffers<Vec<u8, rs_matter::::transport::exchange::Buffer::{constant#0}>> + 'a,

Source

pub fn subscription(&self) -> &Subscription

Return a reference to the subscription being reported on.

Source

pub fn rx(&self) -> &[u8]

Return a reference to the RX buffer associated with the subscription being reported on.

Source

pub fn should_send_if_empty(&self) -> bool

Return true if the report should be sent even if it turns out to be empty (i.e. no attributes or events to report), or false if it can be skipped in that case.

Source

pub fn should_report_attr( &self, endpoint_id: u16, cluster_id: u32, attr_id: u32, ) -> bool

Return true if the subscription should report the attribute identified by the given triple, or false if it can skip it.

Source

pub fn max_seen_event_number(&self) -> u64

Return the maximum event number the subscription has seen so far.

Source

pub fn next_max_seen_event_number(&self) -> u64

Return the next maximum event number to be updated into the subscription upon returning it to the table.

Source

pub fn set_keep(&mut self)

Mark the subscription to be kept in the table after the report completes, meaning the other peer acknowledged our report.

Source

pub fn set_keep_retry(&mut self)

Keep the subscription in the table after a failed send to the peer, so it retries — with a back-off, and without advancing its watermarks or its last-success timestamp.

Three things happen, each of which matters:

  • Watermarks are preserved. Self::set_keep is only correct after a delivered report: report() captured the current change/event watermarks as “what this report covers”, and committing them would mark the still-unsent changes/events as seen — they would then never be reported. We restore the last actually-reported values so the pending data is re-attempted.
  • reported_at is preserved (not advanced to now). is_expired measures max_int from reported_at, so keeping it pinned to the last successful report means a run of failures eventually expires the subscription instead of retrying it forever.
  • A back-off is scheduled. retry_at is pushed to a growing (capped) delay from now, so an unreachable peer is retried with exponential back-off rather than in a tight loop that would flood the network.

Trait Implementations§

Source§

impl<'a, 's, B, const N: usize> Drop for ReportContext<'a, 's, B, N>
where B: Buffers<Vec<u8, rs_matter::::transport::exchange::Buffer::{constant#0}>> + 'a,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a, 's, B, const N: usize> !RefUnwindSafe for ReportContext<'a, 's, B, N>

§

impl<'a, 's, B, const N: usize> !Send for ReportContext<'a, 's, B, N>

§

impl<'a, 's, B, const N: usize> !Sync for ReportContext<'a, 's, B, N>

§

impl<'a, 's, B, const N: usize> !UnwindSafe for ReportContext<'a, 's, B, N>

§

impl<'a, 's, B, const N: usize> Freeze for ReportContext<'a, 's, B, N>
where <B as Buffers<Vec<u8, 1583>>>::Buffer<'a>: Freeze,

§

impl<'a, 's, B, const N: usize> Unpin for ReportContext<'a, 's, B, N>
where <B as Buffers<Vec<u8, 1583>>>::Buffer<'a>: Unpin,

§

impl<'a, 's, B, const N: usize> UnsafeUnpin for ReportContext<'a, 's, B, N>
where <B as Buffers<Vec<u8, 1583>>>::Buffer<'a>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, E> Init<T, E> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, I> IntoFallibleInit<T> for I
where I: Init<T>,

Source§

fn into_fallible<E>(self) -> impl Init<T, E>

Convert the infallible initializer to a fallible one.
Source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

Source§

type Error = <Target as OctetsFrom<Source>>::Error

Source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
Source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
Source§

impl<T, E> PinInit<T, E> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), E>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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