Skip to main content

Module system

Module system 

Source
Expand description

DataSystem — invariant systems of the Data layer.

A DataSystem is a pure function over &mut World that runs every tick at a declared TickPhase. They are the home of the Data layer’s self-maintenance work — hierarchy fix-ups (e.g. transform_propagation), storage compaction, deferred cleanup — i.e. invariants that must hold before the CLAD descent runs.

Systems are auto-discovered at link time via inventory. Adding a new invariant is a matter of one file plus an inventory::submit!: zero changes are required in the engine, scheduler, or any agent.

§Example

use khora_data::ecs::{DataSystemRegistration, TickPhase, World};

pub fn my_system(world: &mut World) {
    // ...
}

inventory::submit! {
    DataSystemRegistration {
        name: "my_system",
        phase: TickPhase::PostSimulation,
        run: my_system,
        order_hint: 0,
        runs_after: &[],
    }
}

§Phases

See TickPhase for the available phases and their intended use.

Structs§

DataSystemRegistration
Registration entry for a [DataSystem].

Enums§

TickPhase
Tick phases at which [DataSystem]s are dispatched.