group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
OutboundEntry Struct Reference

Bytes already framed (4-byte length prefix + payload) ready for the wire. More...

#include <OutboundQueue.hpp>

Public Attributes

uint8_t replaceKey = 0
 Replace-key.
Uint64 enqueuedNs = 0
 Microsecond timestamp at enqueue time, used for max-age culling.
std::shared_ptr< const std::vector< uint8_t > > framedBytes
 Pre-framed bytes including the 4-byte length prefix.

Detailed Description

Bytes already framed (4-byte length prefix + payload) ready for the wire.

PR-2 (server-perf-design): held via std::shared_ptr<const std::vector<uint8_t>> so a single broadcast snapshot can be fanned out to N clients with N pointer-copies and zero data copies. Pre-PR-2 the vector was held by value, paying an O(snapshot_size × N_clients) memcpy on every snapshot tick — the dominant per-broadcast cost in PR-1's profile (1.57 ms p50 at 50 bots).

const: once framed, no consumer mutates the buffer; only the producer fills it before share. Multiple readers ⇒ const-correct.

Member Data Documentation

◆ enqueuedNs

Uint64 OutboundEntry::enqueuedNs = 0

Microsecond timestamp at enqueue time, used for max-age culling.

◆ framedBytes

std::shared_ptr<const std::vector<uint8_t> > OutboundEntry::framedBytes

Pre-framed bytes including the 4-byte length prefix.

Shared across clients on broadcast paths (PR-2). nullptr represents an already-consumed entry pending pop.

◆ replaceKey

uint8_t OutboundEntry::replaceKey = 0

Replace-key.

0 means "always append" (events: KILL, PARTICLE, PONG, ASSIGN_CLIENT_ID). Non-zero means "replace any existing entry with the same key before pushing" — used for snapshot-style state where only the latest is meaningful.


The documentation for this struct was generated from the following file: