The last snapshots sent to one client, and the ones it acknowledged.
More...
#include </__w/project-rtype/project-rtype/server/include/rtype/snapshot_history.hpp>
|
| void | sent (std::shared_ptr< const Snapshot > snapshot, std::span< const std::uint16_t > sequences) |
| | Records a snapshot sent to the client, forgetting the oldest beyond capacity.
|
| |
| void | acknowledge (std::uint16_t ack, std::uint32_t ack_bits) noexcept |
| | Records the acknowledgements of a datagram received from the client.
|
| |
| const Snapshot * | latest_acknowledged () const noexcept |
| | The most recent snapshot the client acknowledged, among those kept.
|
| |
| const Snapshot * | find (std::uint32_t tick) const noexcept |
| | A snapshot kept, acknowledged or not.
|
| |
| bool | acknowledged (std::uint32_t tick) const noexcept |
| | Tells whether the client acknowledged a snapshot.
|
| |
| std::size_t | size () const noexcept |
| | Number of snapshots kept.
|
| |
|
| static constexpr std::size_t | capacity = 32 |
| | Snapshots kept per client.
|
| |
The last snapshots sent to one client, and the ones it acknowledged.
A client acknowledges a snapshot by the ack and ack_bits fields of the datagrams it sends (RFC section 5.1): a snapshot is acknowledged once every datagram that carried it is. Only the last capacity snapshots sent are kept, as possible baselines of the next ones.
◆ acknowledge()
| void rtype::SnapshotHistory::acknowledge |
( |
std::uint16_t |
ack, |
|
|
std::uint32_t |
ack_bits |
|
) |
| |
|
noexcept |
Records the acknowledgements of a datagram received from the client.
- Parameters
-
| ack | Its ack field: the latest sequence of the server it received. |
| ack_bits | Its ack_bits field: bit n set if it received ack - n - 1. |
◆ acknowledged()
| bool rtype::SnapshotHistory::acknowledged |
( |
std::uint32_t |
tick | ) |
const |
|
noexcept |
Tells whether the client acknowledged a snapshot.
- Parameters
-
- Returns
true if a snapshot of that tick is kept and acknowledged.
◆ find()
| const Snapshot * rtype::SnapshotHistory::find |
( |
std::uint32_t |
tick | ) |
const |
|
noexcept |
A snapshot kept, acknowledged or not.
- Parameters
-
- Returns
- The snapshot, or
nullptr if none of that tick is kept.
◆ latest_acknowledged()
| const Snapshot * rtype::SnapshotHistory::latest_acknowledged |
( |
| ) |
const |
|
noexcept |
The most recent snapshot the client acknowledged, among those kept.
- Returns
- The snapshot of the highest tick acknowledged, or
nullptr if none is.
◆ sent()
| void rtype::SnapshotHistory::sent |
( |
std::shared_ptr< const Snapshot > |
snapshot, |
|
|
std::span< const std::uint16_t > |
sequences |
|
) |
| |
Records a snapshot sent to the client, forgetting the oldest beyond capacity.
- Parameters
-
| snapshot | Snapshot sent, shared with the histories of the other clients. |
| sequences | Sequences of the datagrams that carried it. |
◆ size()
| std::size_t rtype::SnapshotHistory::size |
( |
| ) |
const |
|
noexcept |
Number of snapshots kept.
- Returns
- From 0 to capacity.
◆ capacity
| constexpr std::size_t rtype::SnapshotHistory::capacity = 32 |
|
staticconstexpr |
Snapshots kept per client.
The documentation for this class was generated from the following file: