pub struct Roles {Show 16 fields
pub validate: Core,
pub fold: Core,
pub init: Core,
pub view: Core,
pub state_ty: Ty,
pub event_ty: Ty,
pub command_ty: Ty,
pub proposals_name: Arc<str>,
pub events_name: Arc<str>,
pub state_name: Arc<str>,
pub page_name: Arc<str>,
pub inlined: Vec<Arc<str>>,
pub shared: Vec<Arc<str>>,
pub states: Vec<StateRole>,
pub view_is_per_session: bool,
pub view_reads_presence: bool,
}Expand description
The five things the runtime needs, each a Core value it can call.
This is deliberately still five: a runtime that drives one log, one accumulator and one page is what Phase 1 built and what Phase 3 has not replaced. What changed is that these are now derived from the graph — fusing several folds, inlining or sharing intermediate signals — so the shape of the program and the shape of the runtime are no longer required to be the same.
Fields§
§validate: Core(state, proposal) -> Result[list[Event], Rejection] — the authority chokepoint.
fold: Core(state, Envelope[Event]) -> state — the replay-pure fold.
init: CoreThe fold’s initial accumulator.
view: Core(state, session, presence) -> Html — the client-placed view, with intermediate signals
inlined or shared.
Three parameters whether or not the program reads the third: a role the runtime calls has one arity, and a view that ignores its presence argument is cheaper than two code paths that could disagree about which one it has.
state_ty: Ty§event_ty: Ty§command_ty: Ty§proposals_name: Arc<str>Names, for beck explain and for the report.
events_name: Arc<str>§state_name: Arc<str>§page_name: Arc<str>§inlined: Vec<Arc<str>>Signals that were inlined into the view rather than surviving as their own node.
Signals read by more than one consumer, and therefore bound once in the sliced view rather than recomputed per use. §5.3’s shared prefix, at compile time.
states: Vec<StateRole>The durable folds, in declaration order. One entry for the ordinary program; several when the accumulator is fused.
view_is_per_session: bool§view_reads_presence: boolWhether the page reads presence(), and therefore has an input the log does not contain.