# Objective - Part of #20115 We want to encapsulate each part of `ScheduleGraph` into its own specific struct to make parts of it easier to reuse and maintain. ## Solution - Pulled `ScheduleGraph::systems` and `ScheduleGraph::system_conditions` into a `Systems` struct and added a field for this new struct to `ScheduleGraph` - Broke up `ScheduleGraph::uninit` into `Systems::uninit` and `SystemSets::uninit` to eliminate `ScheduleGraph`'s direct field access of these types - Removed node and condition accessors from `ScheduleGraph`; the same operations are now available on `Systems` and `SystemSets` instead (accessible via their `pub` fields on `ScheduleGraph`) - Moved `Systems`, `SystemSets`, `SystemNode`, `SystemWithAccess`, and `ConditionWithAccess` into a separate file. ## Testing Added two new tests covering the API surface of `Systems` and `SystemSets`, respectively. --------- Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
2.0 KiB
2.0 KiB
| title | pull_requests | ||
|---|---|---|---|
| Schedule API Cleanup |
|
In order to support removing systems from schedules, Vecs storing Systems and
SystemSets have been replaced with SlotMaps which allow safely removing nodes and
reusing indices. The maps are respectively keyed by SystemKeys and SystemSetKeys.
The following signatures were changed:
NodeId::System: Now stores aSystemKeyinstead of a plainusizeNodeId::Set: Now stores aSystemSetKeyinstead of a plainusizeScheduleBuildPass::collapse_set: Now takes the type-specific keys. Wrap them back into aNodeIdif necessary.- The following functions now return the type-specific keys. Wrap them back into a
NodeIdif necessary.Schedule::systemsScheduleGraph::conflicting_systems
The following functions were replaced. Those that took or returned NodeId now
take or return SystemKey or SystemSetKey. Wrap/unwrap them as necessary.
ScheduleGraph::contains_set: UseScheduleGraph::system_setsandSystemSets::contains.ScheduleGraph::get_set_at: UseScheduleGraph::system_setsandSystemSets::get.ScheduleGraph::set_at: UseScheduleGraph::system_setsandSystemSets::index(system_sets[key]).ScheduleGraph::get_set_conditions_at: UseScheduleGraph::system_setsandSystemSets::get_conditions.ScheduleGraph::system_sets: UseScheduleGraph::system_setsandSystemSets::iter.ScheduleGraph::get_system_at: UseScheduleGraph::systemsandSystems::get.ScheduleGraph::system_at: UseScheduleGraph::systemsandSystems::index(systems[key]).ScheduleGraph::systems: UseScheduleGraph::systemsandSystems::iter.
The following functions were removed:
NodeId::index: You should match on and use theSystemKeyandSystemSetKeyinstead.NodeId::cmp: Use thePartialOrdandOrdtraits instead.ScheduleGraph::set_conditions_at: If needing to check presence of conditions, useScheduleGraph::system_setsandSystemSets::has_conditions. Otherwise, useSystemSets::get_conditions.