Fray Engine
Loading...
Searching...
No Matches
fray::routing Namespace Reference

Classes

class  NeighborMonitor
 Tracks neighbor liveness and health from what the router hears, and reports state transitions. Not thread safe: all calls and callbacks run on the router (engine message) thread. Never blocks or waits on a neighbor; the clock is injected so time-based rules (3s suspect/degraded, 10s down/unreachable) can be tested. It holds no readiness table itself; the owning router is the source of truth, read through the State callback. More...
class  OutgoingRouter
 The router thread's single source of truth about which neighbors are ready, plus the messages waiting for them. Nothing here is thread safe: only the router thread may touch it. Nothing waits on a neighbor either. A message for a neighbor that is not ready stays in its queue until the neighbor says it is ready, its time to live runs out, or the neighbor is declared down and its queue is discarded. More...

Enumerations

enum class  Destination { engine , relay , unsupported }
 Where an incoming message should be handled. More...
enum class  MonitorCommand { probe , ping }
 What the monitor asks its Send callback to transmit: probe = ask for readiness, ping = request a health report. More...
enum class  NeighborState {
  unknown , probing , ready , suspect ,
  degraded , down , unreachable
}
 Readiness of a neighbor process as seen by the router. unknown: nothing known yet; probing: readiness requested, no answer yet; ready: messages are delivered at once; suspect: quiet for a while; degraded: heard from but its health looks bad (stalled heartbeat, stuck queue or no report); down: silent too long, its queue is discarded; unreachable: never answered the initial probe. Only ready delivers immediately; every other state queues messages. More...

Functions

Destination routeMessage (const message::Prefix &prefix)
 Decides where an incoming message goes from its prefix destination. Pure apart from logging; may run on any thread.

Enumeration Type Documentation

◆ Destination

enum class fray::routing::Destination
strong

Where an incoming message should be handled.

Enumerator
engine 

Handle in this Engine.

relay 

Addressed to Electron Main or Renderer: the Engine stamps, logs and relays it, but does not handle it.

unsupported 

The destination kind is not one the Engine serves; the message is not handled.

Definition at line 18 of file message_router.hpp.

◆ MonitorCommand

enum class fray::routing::MonitorCommand
strong

What the monitor asks its Send callback to transmit: probe = ask for readiness, ping = request a health report.

Enumerator
probe 
ping 

Definition at line 16 of file neighbor_monitor.hpp.

◆ NeighborState

enum class fray::routing::NeighborState
strong

Readiness of a neighbor process as seen by the router. unknown: nothing known yet; probing: readiness requested, no answer yet; ready: messages are delivered at once; suspect: quiet for a while; degraded: heard from but its health looks bad (stalled heartbeat, stuck queue or no report); down: silent too long, its queue is discarded; unreachable: never answered the initial probe. Only ready delivers immediately; every other state queues messages.

Enumerator
unknown 
probing 
ready 
suspect 
degraded 
down 
unreachable 

Definition at line 27 of file outgoing_router.hpp.

Function Documentation

◆ routeMessage()

Destination fray::routing::routeMessage ( const message::Prefix & prefix)
inline

Decides where an incoming message goes from its prefix destination. Pure apart from logging; may run on any thread.

Parameters
prefixParsed message prefix whose destinationKind (and destinationId, for the log) is inspected.
Returns
Destination::engine for engine or broadcast destinations, Destination::relay for Electron Main or Renderer (the Engine is where a stamped message is logged before it reaches them); otherwise logs a warning and returns Destination::unsupported.

Definition at line 35 of file message_router.hpp.