morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
connection_writer.hpp File Reference

What a transport hands RemoteServer to write to one connection, and the backlog bounds both sides apply. More...

#include <cstddef>
#include <cstdint>
#include <functional>
#include <string>

Go to the source code of this file.

Classes

struct  morph::backend::ConnectionWriter
 A transport's outbound side of one connection, for what the server sends unasked: events. More...

Typedefs

using morph::backend::ConnectionId = std::uint64_t
 Opaque id a transport uses to scope model registrations to one connection so RemoteServer::closeConnection can reclaim them.

Variables

constexpr std::size_t morph::backend::kEventBacklogHigh = std::size_t{1} << 20
 Backlog above which RemoteServer::post holds a connection's events back and owes it one resync instead: 1 MiB.
constexpr std::size_t morph::backend::kEventBacklogLow = std::size_t{256} << 10
 Backlog below which a transport reports a connection drained, by calling RemoteServer::connectionDrained: 256 KiB.

Detailed Description

What a transport hands RemoteServer to write to one connection, and the backlog bounds both sides apply.

Kept apart from remote.hpp so a transport's connection code, which both the client and the server role share, can use the bounds without compiling the server.

Definition in file connection_writer.hpp.

Typedef Documentation

◆ ConnectionId

using morph::backend::ConnectionId = std::uint64_t

Opaque id a transport uses to scope model registrations to one connection so RemoteServer::closeConnection can reclaim them.

0 is reserved and means unscoped: it is what the two-argument RemoteServer::handle()/handleInline() overloads pass. Non-zero values are minted by RemoteServer::openConnection().

Definition at line 25 of file connection_writer.hpp.

Variable Documentation

◆ kEventBacklogHigh

std::size_t morph::backend::kEventBacklogHigh = std::size_t{1} << 20
inlineconstexpr

Backlog above which RemoteServer::post holds a connection's events back and owes it one resync instead: 1 MiB.

Definition at line 46 of file connection_writer.hpp.

◆ kEventBacklogLow

std::size_t morph::backend::kEventBacklogLow = std::size_t{256} << 10
inlineconstexpr

Backlog below which a transport reports a connection drained, by calling RemoteServer::connectionDrained: 256 KiB.

Well under kEventBacklogHigh, so a reader hovering at the bound does not flip between held back and drained on every frame.

Definition at line 53 of file connection_writer.hpp.