pub struct ReplicationFrameBuilder {
pub limits: ReplicationFrameLimits,
}Expand description
Builds concrete replication frames from a core replication plan.
Fields§
§limits: ReplicationFrameLimitsBuilder limits.
Implementations§
Source§impl ReplicationFrameBuilder
impl ReplicationFrameBuilder
Sourcepub const fn new(limits: ReplicationFrameLimits) -> Self
pub const fn new(limits: ReplicationFrameLimits) -> Self
Creates a frame builder with explicit limits.
Sourcepub fn binary_capacity_hint(
&self,
plan: &ReplicationPlan,
selection: &ComponentSelection,
) -> usize
pub fn binary_capacity_hint( &self, plan: &ReplicationPlan, selection: &ComponentSelection, ) -> usize
Returns a bounded initial byte-capacity hint for direct binary encoding.
The planner estimate supplements fixed wire metadata and is clamped by the active entity, component, and component-byte limits. The result is a hint rather than an encoded-size guarantee because dirty/missing components are resolved during encoding.
Sourcepub fn sampled_binary_capacity_hint(
&self,
station: &Station,
plan: &ReplicationPlan,
components: &ComponentStore,
selection: &ComponentSelection,
) -> usize
pub fn sampled_binary_capacity_hint( &self, station: &Station, plan: &ReplicationPlan, components: &ComponentStore, selection: &ComponentSelection, ) -> usize
Returns a dense-dirty-data initial capacity hint from at most four
uniformly distributed entities in plan.
Sampling avoids a full metadata prepass. If any sample has no encodable dirty component, this conservatively returns zero and lets the output buffer grow normally. Nonzero estimates remain bounded by active limits.
Sourcepub fn build(
&self,
client_id: ClientId,
server_tick: Tick,
station: &Station,
plan: &ReplicationPlan,
components: &ComponentStore,
selection: &ComponentSelection,
) -> ReplicationFrameBuild
pub fn build( &self, client_id: ClientId, server_tick: Tick, station: &Station, plan: &ReplicationPlan, components: &ComponentStore, selection: &ComponentSelection, ) -> ReplicationFrameBuild
Builds a frame from a station plan and component store.
Sourcepub fn encode_binary_into(
&self,
client_id: ClientId,
server_tick: Tick,
station: &Station,
plan: &ReplicationPlan,
components: &ComponentStore,
selection: &ComponentSelection,
out: &mut Vec<u8>,
) -> Result<ReplicationFrameBuildStats, BinaryEncodeError>
pub fn encode_binary_into( &self, client_id: ClientId, server_tick: Tick, station: &Station, plan: &ReplicationPlan, components: &ComponentStore, selection: &ComponentSelection, out: &mut Vec<u8>, ) -> Result<ReplicationFrameBuildStats, BinaryEncodeError>
Builds and appends one binary replication frame directly into out.
This preserves the same limits, dirty-component filtering, statistics,
and wire shape as Self::build followed by BinaryFrameEncoder,
without allocating an intermediate entity/component delta tree or
cloning component payloads. Existing bytes in out are retained.
Sourcepub fn encode_binary_bounded_into(
&self,
client_id: ClientId,
server_tick: Tick,
station: &Station,
plan: &ReplicationPlan,
components: &ComponentStore,
selection: &ComponentSelection,
max_frame_bytes: usize,
out: &mut Vec<u8>,
) -> Result<ReplicationFrameBuildStats, BinaryEncodeError>
pub fn encode_binary_bounded_into( &self, client_id: ClientId, server_tick: Tick, station: &Station, plan: &ReplicationPlan, components: &ComponentStore, selection: &ComponentSelection, max_frame_bytes: usize, out: &mut Vec<u8>, ) -> Result<ReplicationFrameBuildStats, BinaryEncodeError>
Builds and appends one replication frame under a concrete wire-byte budget.
The budget applies only to bytes appended by this frame. If the next entity would exceed it, that entity is rolled back and planning stops.
Trait Implementations§
Source§impl Clone for ReplicationFrameBuilder
impl Clone for ReplicationFrameBuilder
Source§fn clone(&self) -> ReplicationFrameBuilder
fn clone(&self) -> ReplicationFrameBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more