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>
impl<B: StoreBackend> StoreWireReplica<B>
Sourcepub fn new(backend: B, realization_order: RealizationOrder) -> Self
pub fn new(backend: B, realization_order: RealizationOrder) -> Self
Creates a new replica wrapping backend with the given realization_order.
Sourcepub fn reset_epoch(&self) -> u64
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).
Sourcepub fn needs_keyframe(&self) -> bool
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.
pub fn store(&self) -> &NodeStore
pub fn last_changes(&self) -> &ChangeSet
pub fn backend(&self) -> &B
pub fn backend_mut(&mut self) -> &mut B
pub fn store_and_backend_mut(&mut self) -> (&NodeStore, &mut B)
Sourcepub fn edit_and_commit<R>(
&mut self,
f: impl FnOnce(&mut Transaction<'_>) -> R,
) -> Result<(R, bool), BackendError>
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).
Sourcepub fn into_parts(self) -> (NodeStore, B)
pub fn into_parts(self) -> (NodeStore, B)
Consumes the replica, returning its decoded NodeStore and committed backend.
Sourcepub fn submit_nv02_frame(
&mut self,
wire_bytes: &[u8],
) -> Result<BackendApplyStats, BackendError>
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.
Sourcepub fn submit_nv02_keyframe(
&mut self,
wire_bytes: &[u8],
) -> Result<BackendApplyStats, BackendError>
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.
Sourcepub fn submit_nv02_frame_with_hint(
&mut self,
wire_bytes: &[u8],
node_count_hint: usize,
) -> Result<BackendApplyStats, BackendError>
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).
Sourcepub fn commit_changes(
&mut self,
changes: &ChangeSet,
) -> Result<BackendApplyStats, BackendError>
pub fn commit_changes( &mut self, changes: &ChangeSet, ) -> Result<BackendApplyStats, BackendError>
Commits an explicit ChangeSet against the replica NodeStore into backend.
Sourcepub fn map_backend<B2: StoreBackend>(
self,
f: impl FnOnce(B) -> B2,
) -> StoreWireReplica<B2>
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.