class

FSnapshotSync

Module
GameNet
Header
#include "GameNet/SnapshotSync.h"
Namespace
Mowo

Properties

TypeNameDescription
std::function<void(const std::string& state, uint64_t version)>OnStateFired when a snapshot is accepted (in order). The payload is the server state verbatim — this class never interprets it.
std::function<void(uint64_t localId, const std::string& reason)>OnRollbackFired when the server rejects an intent: roll the optimistic render back to the last accepted snapshot.

Public functions

ReturnsNameDescription
boolApplySnapshotReturns false (and drops) when the snapshot is stale or duplicate: versions are totally ordered and the server pushes whole states, so anything <= the last accepted version carries no information.
voidOnRejectThe reject names the oldest in-flight intent (this protocol answers intents in order).
uint64_tQueueIntentQueue an intent for sending.
std::vector<FPendingIntent>TakeSendableEverything ready to go on the wire.
voidClearInflightThroughA snapshot acknowledges every intent the server has folded in: with whole-state pushes there is no per-intent ack, so acceptance = the next accepted snapshot.
voidOnDisconnected
voidOnConnected
boolConsumeResyncRequestTrue once after a (re)connect: the caller sends a resync envelope and the gateway answers with full current state.
uint64_tGetVersion
boolHasState
boolIsConnected
size_tOutboxSize
size_tInflightSize

Function details

ApplySnapshot

C++
bool ApplySnapshot(uint64_t version, const std::string& state)

Returns false (and drops) when the snapshot is stale or duplicate: versions are totally ordered and the server pushes whole states, so anything <= the last accepted version carries no information.

OnReject

C++
void OnReject(const std::string& reason)

The reject names the oldest in-flight intent (this protocol answers intents in order). Everything queued after it stays queued — the caller decides whether to also drop dependents.

QueueIntent

C++
uint64_t QueueIntent(std::string payload)

Queue an intent for sending. Returns the local correlation id.

TakeSendable

C++
std::vector<FPendingIntent> TakeSendable()

Everything ready to go on the wire. Empty while disconnected — the outbox holds, nothing is dropped. Sent intents move to the in-flight list until the matching snapshot (acceptance) or reject arrives.

ClearInflightThrough

C++
void ClearInflightThrough(uint64_t version)

A snapshot acknowledges every intent the server has folded in: with whole-state pushes there is no per-intent ack, so acceptance = the next accepted snapshot. Call after ApplySnapshot returns true.

OnDisconnected

C++
void OnDisconnected()

OnConnected

C++
void OnConnected()

ConsumeResyncRequest

C++
bool ConsumeResyncRequest()

True once after a (re)connect: the caller sends a resync envelope and the gateway answers with full current state.

GetVersion

C++
uint64_t GetVersion() const

HasState

C++
bool HasState() const

IsConnected

C++
bool IsConnected() const

OutboxSize

C++
size_t OutboxSize() const

InflightSize

C++
size_t InflightSize() const
Generated from GameNet/SnapshotSync.h via gamenet.json · Oct 26, 2026Version 1.0.0