Skip to main content

StoreWireReplica

Struct StoreWireReplica 

Source
pub struct StoreWireReplica<B: StoreBackend> { /* private fields */ }
Expand description

Cross-boundary NV02 wire replica pairing a NodeStore::replica, WireDecoder, and reusable ChangeSet with any StoreBackend.

Implementations§

Source§

impl<B: StoreBackend> StoreWireReplica<B>

Source

pub fn new(backend: B, realization_order: RealizationOrder) -> Self

Creates a new replica wrapping backend with the given realization_order.

Source

pub fn reset_epoch(&self) -> u64

Monotonically increasing counter incremented every time Self::reset clears the replica store (e.g. on frame == 1, explicit submit_nv02_keyframe, or mid-frame decode error).

Source

pub fn needs_keyframe(&self) -> bool

Returns true after a mid-frame decode failure reset the replica; subsequent deltas are rejected with BackendError::NeedsKeyframe until a frame == 1 keyframe succeeds.

Source

pub fn store(&self) -> &NodeStore

Source

pub fn last_changes(&self) -> &ChangeSet

Source

pub fn backend(&self) -> &B

Source

pub fn backend_mut(&mut self) -> &mut B

Source

pub fn store_and_backend_mut(&mut self) -> (&NodeStore, &mut B)

Source

pub fn edit_and_commit<R>( &mut self, f: impl FnOnce(&mut Transaction<'_>) -> R, ) -> Result<(R, bool), BackendError>

Runs an in-place nativeview_store::Transaction over the replica store (e.g. per-frame crate::FrameTickHook mutations) and commits any resulting changes into backend, reusing the replica’s ChangeSet buffer with zero steady-state allocations.

Returns (closure_result, did_commit_changes).

Source

pub fn into_parts(self) -> (NodeStore, B)

Consumes the replica, returning its decoded NodeStore and committed backend.

Source

pub fn submit_nv02_frame( &mut self, wire_bytes: &[u8], ) -> Result<BackendApplyStats, BackendError>

Decodes one NV02 wire frame into the replica NodeStore and commits it to backend.

Validates the NV02 header before resetting on frame == 1 (preventing corrupt packets from wiping live state), and resets the replica cleanly if mid-frame decoding fails so partial uncommitted mutations can never leak into live state.

Source

pub fn submit_nv02_keyframe( &mut self, wire_bytes: &[u8], ) -> Result<BackendApplyStats, BackendError>

Decodes a full SceneKeyframe NV02 payload, unconditionally resetting prior replica state (even when the NV02 header carries frame > 1) once the header validates.

Source

pub fn submit_nv02_frame_with_hint( &mut self, wire_bytes: &[u8], node_count_hint: usize, ) -> Result<BackendApplyStats, BackendError>

Like Self::submit_nv02_frame, additionally pre-sizing NodeStore and ChangeSet for node_count_hint nodes before decoding a Frame-0 keyframe (frame == 1).

Source

pub fn commit_changes( &mut self, changes: &ChangeSet, ) -> Result<BackendApplyStats, BackendError>

Commits an explicit ChangeSet against the replica NodeStore into backend.

Source

pub fn map_backend<B2: StoreBackend>( self, f: impl FnOnce(B) -> B2, ) -> StoreWireReplica<B2>

Transforms the wrapped backend in place while preserving the decoded replica NodeStore.

Source

pub fn reset(&mut self)

Resets both the replica NodeStore and underlying backend.

Auto Trait Implementations§

§

impl<B> Forget for StoreWireReplica<B>

§

impl<B> Freeze for StoreWireReplica<B>

§

impl<B> Move for StoreWireReplica<B>

§

impl<B> RefUnwindSafe for StoreWireReplica<B>

§

impl<B> Send for StoreWireReplica<B>
where B: Send, RawVecInner: Send, &'static TableDesc: Send, Arc<OwnedTableDesc>: Send, OnceLock<TypeId>: Send, RawTable<((u64, u64), ResourceId)>: Send,

§

impl<B> Sync for StoreWireReplica<B>
where B: Sync, RawVecInner: Sync, Arc<OwnedTableDesc>: Sync, OnceLock<TypeId>: Sync, RawTable<((u64, u64), ResourceId)>: Sync,

§

impl<B> Unpin for StoreWireReplica<B>
where B: Unpin, *const u8 is !null: Unpin, &'static TableDesc: Unpin, Arc<OwnedTableDesc>: Unpin, Align4<u32>: Unpin, *const (): Unpin,

§

impl<B> UnsafeUnpin for StoreWireReplica<B>

§

impl<B> UnwindSafe for StoreWireReplica<B>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.