In this project, a new discrete-event network simulator, called Days, has been implemented. It uses process-based simulation, and models each process to be simulated as a coroutine in Rust.
src/contains the Rust crate. Key modules live insrc/flows/,src/schedulers/,src/switches/,src/topos/,src/utils/, and optional layer-2 protocol implementations insrc/l2/.lean/contains Lean code that checks several protocols, including DCQCN and PFC, for conformance to their protocol specifications.src/main.rsis the CLI entry point;src/lib.rsexposes the library API.tests/holds integration tests, with.tomlfixtures alongside test files (for exampletests/wrr.rs+tests/wrr_seed.toml).configs/stores example simulation configs;examples/anddocs/docs/examples/show runnable scenarios.docs/contains the MkDocs site (docs/mkdocs.yml, content underdocs/docs/, e.g.docs/docs/design-notes/l2.md).logs/andtarget/are generated artifacts and should stay uncommitted.
cargo buildbuilds the default simulator.cargo build --features l2,l2_pfcenables L2/PFC support (still controlled by config at runtime).cargo run --release --bin days -- configs/simple.tomlruns a sample simulation from the repo.RUST_LOG=debug days configs/simple.tomlruns the installed binary with verbose logging.cargo fmt --allformats Rust code;cargo clippy --all-featuresruns linting.cargo test --features test -- --show-outputruns unit + integration tests.cargo nextest run --all-features --no-captureis the preferred faster test runner if installed.
- Follow
rustfmt(style edition 2024 perrustfmt.toml); use 4-space indentation and no tabs. - Rust naming:
snake_casefor files/modules/functions,PascalCasefor types,SCREAMING_SNAKE_CASEfor constants. - Keep config examples in TOML under
configs/ortests/*.tomlwhen they back a test.
- New behavior should include a
tests/*.rsintegration test and any required TOML fixtures. - Name tests after the feature they validate (e.g.,
tests/wfq.rs,tests/drop_red.rs). - Run
cargo test --features test -- --show-outputbefore submitting changes.
- Recent commits use short, imperative, capitalized subjects, often with backticks for commands and optional PR refs like
(#77). - Keep commit subjects focused; include related issue/PR references when applicable.
- PRs should describe the change, list test commands run, and note any config files used to reproduce results or output changes.
- Simulation behavior is driven by TOML configs; prefer adding new examples under
configs/and referencing them in docs/tests. - Use
log_pathin configs to keep output contained, and avoid committing large logs.