MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / append_binary_message

Method append_binary_message

crates/client-api/src/routes/subscribe.rs:1597–1613  ·  view source on GitHub ↗

Append one v2 server message to the binary websocket payload currently being accumulated.

(
        &mut self,
        message: ws_v2::ServerMessage,
        message_rows: Option<usize>,
        message_bytes: usize,
        total_rows: &mut Option<usize>,
        total_bytes: &mut usize,

Source from the content-addressed store, hash-verified

1595
1596 /// Append one v2 server message to the binary websocket payload currently being accumulated.
1597 fn append_binary_message(
1598 &mut self,
1599 message: ws_v2::ServerMessage,
1600 message_rows: Option<usize>,
1601 message_bytes: usize,
1602 total_rows: &mut Option<usize>,
1603 total_bytes: &mut usize,
1604 ) {
1605 if let Some(message_rows) = message_rows {
1606 // Payload metrics are emitted at websocket-payload granularity.
1607 // In v3, one payload can contain several logical messages, so row
1608 // counts are accumulated across the coalesced payload.
1609 *total_rows.get_or_insert(0) += message_rows;
1610 }
1611 self.binary_server_messages.push(message);
1612 *total_bytes += message_bytes;
1613 }
1614
1615 /// Encode and forward the accumulated binary payload, then reset its counters.
1616 async fn flush_binary_payload(

Callers 1

encode_binary_batchMethod · 0.80

Calls 2

get_or_insertMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected