Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# 1.85 is the MSRV.
rust-version: ["1.85", "stable"]
# 1.88 is the MSRV.
rust-version: ["1.88", "stable"]
fail-fast: false
env:
RUSTFLAGS: -D warnings
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This file provides guidance to LLMs when working with code in this repository.
- **Feature powerset verification**: `just powerset check` or `just powerset nextest run` (uses `cargo hack --feature-powerset`; CI runs this)
- **Build docs**: `just rustdoc`

CI runs clippy and tests against the full feature powerset on both MSRV (1.85) and stable. `RUSTFLAGS=-D warnings` is enforced.
CI runs clippy and tests against the full feature powerset on both MSRV (1.88) and stable. `RUSTFLAGS=-D warnings` is enforced.

## Project overview

Expand Down Expand Up @@ -83,5 +83,5 @@ Converts push-based events into pull-based `EventReport`s. Uses a `petgraph::DiG
## Style notes

- `rustfmt.toml` uses `max_width = 80` and `use_small_heuristics = "max"`.
- Rust edition 2024, MSRV 1.85.
- Rust edition 2024, MSRV 1.88.
- Optional feature: `schemars08` for JSON Schema generation.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [
[workspace.package]
edition = "2024"
license = "MPL-2.0"
rust-version = "1.85"
rust-version = "1.88"
repository = "https://github.com/oxidecomputer/oxide-update-engine"

[workspace.lints.rust]
Expand Down
2 changes: 1 addition & 1 deletion crates/oxide-update-engine-display/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![License: MPL-2.0](https://img.shields.io/crates/l/oxide-update-engine-display.svg?)
[![crates.io](https://img.shields.io/crates/v/oxide-update-engine-display.svg?logo=rust)](https://crates.io/crates/oxide-update-engine-display)
[![docs.rs](https://img.shields.io/docsrs/oxide-update-engine-display.svg?logo=docs.rs)](https://docs.rs/oxide-update-engine-display)
[![Rust: ^1.85.0](https://img.shields.io/badge/rust-^1.85.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
[![Rust: ^1.88.0](https://img.shields.io/badge/rust-^1.88.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
<!-- cargo-sync-rdme ]] -->
<!-- cargo-sync-rdme rustdoc [[ -->
Displayers for the update engine.
Expand Down
24 changes: 12 additions & 12 deletions crates/oxide-update-engine-display/src/group_display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ impl<K: Eq + Ord, W: std::io::Write, S: EngineSpec> GroupDisplay<K, W, S> {
if let Some(state) = self.single_states.get_mut(key) {
let result = state.add_event_report(event_report);
// Set self.start_sw to the max of root_total_elapsed and the current value.
if let Some(root_total_elapsed) = result.root_total_elapsed {
if self.start_sw.elapsed() < root_total_elapsed {
self.start_sw =
TokioSw::with_elapsed_started(root_total_elapsed);
}
if let Some(root_total_elapsed) = result.root_total_elapsed
&& self.start_sw.elapsed() < root_total_elapsed
{
self.start_sw =
TokioSw::with_elapsed_started(root_total_elapsed);
}

self.stats.apply_result(result);
Expand Down Expand Up @@ -500,13 +500,13 @@ impl<S: EngineSpec> SingleState<S> {
event_buffer: &mut EventBuffer<S>,
event_report: EventReport<S>,
) -> ApplyReportResult {
if let Some(root_execution_id) = event_buffer.root_execution_id() {
if event_report.root_execution_id != Some(root_execution_id) {
// The report is for a different execution ID -- assume that
// this event is completed and mark our current execution as
// completed.
return ApplyReportResult::Overwritten;
}
if let Some(root_execution_id) = event_buffer.root_execution_id()
&& event_report.root_execution_id != Some(root_execution_id)
{
// The report is for a different execution ID -- assume
// that this event is completed and mark our current
// execution as completed.
return ApplyReportResult::Overwritten;
}

event_buffer.add_event_report(event_report);
Expand Down
2 changes: 1 addition & 1 deletion crates/oxide-update-engine-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![License: MPL-2.0](https://img.shields.io/crates/l/oxide-update-engine-types.svg?)
[![crates.io](https://img.shields.io/crates/v/oxide-update-engine-types.svg?logo=rust)](https://crates.io/crates/oxide-update-engine-types)
[![docs.rs](https://img.shields.io/docsrs/oxide-update-engine-types.svg?logo=docs.rs)](https://docs.rs/oxide-update-engine-types)
[![Rust: ^1.85.0](https://img.shields.io/badge/rust-^1.85.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
[![Rust: ^1.88.0](https://img.shields.io/badge/rust-^1.88.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
<!-- cargo-sync-rdme ]] -->
<!-- cargo-sync-rdme rustdoc [[ -->
Types for `oxide-update-engine`.
Expand Down
132 changes: 64 additions & 68 deletions crates/oxide-update-engine-types/src/buffer/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,28 +406,26 @@ impl<S: EngineSpec> EventStore<S> {
}
}

if let Some(key) = actions.progress_key {
if let Some(value) = self.map.get_mut(&key) {
// Set progress *before* adding the step event so that it can
// transition to the running state if it isn't there already.
if let Some(current_progress) = event.progress_event() {
value.set_progress(current_progress);
}
if let Some(key) = actions.progress_key
&& let Some(value) = self.map.get_mut(&key)
{
// Set progress *before* adding the step event so that it
// can transition to the running state if it isn't there
// already.
if let Some(current_progress) = event.progress_event() {
value.set_progress(current_progress);
}
}

if let Some(key) = actions.step_key {
if let Some(value) = self.map.get_mut(&key) {
match event.kind.priority() {
StepEventPriority::High => {
value.add_high_priority_step_event(event);
}
StepEventPriority::Low => {
value.add_low_priority_step_event(
event,
max_low_priority,
);
}
if let Some(key) = actions.step_key
&& let Some(value) = self.map.get_mut(&key)
{
match event.kind.priority() {
StepEventPriority::High => {
value.add_high_priority_step_event(event);
}
StepEventPriority::Low => {
value.add_low_priority_step_event(event, max_low_priority);
}
}
}
Expand All @@ -439,10 +437,10 @@ impl<S: EngineSpec> EventStore<S> {
return;
}

if let Some(key) = Self::step_key_for_progress_event(&event) {
if let Some(value) = self.map.get_mut(&key) {
value.set_progress(event);
}
if let Some(key) = Self::step_key_for_progress_event(&event)
&& let Some(value) = self.map.get_mut(&key)
{
value.set_progress(event);
}
}

Expand Down Expand Up @@ -705,18 +703,17 @@ impl<S: EngineSpec> EventStore<S> {
let mut dfs =
DfsPostOrder::new(&self.event_tree, EventTreeNode::Step(root_key));
while let Some(key) = dfs.next(&self.event_tree) {
if let EventTreeNode::Step(key) = key {
if key != root_key {
if let Some(value) = self.map.get_mut(&key) {
value.mark_completed(
CompletionReason::ParentCompleted {
parent_step: root_key,
parent_info: info.clone(),
},
root_event_index,
);
}
}
if let EventTreeNode::Step(key) = key
&& key != root_key
&& let Some(value) = self.map.get_mut(&key)
{
value.mark_completed(
CompletionReason::ParentCompleted {
parent_step: root_key,
parent_info: info.clone(),
},
root_event_index,
);
}
}
}
Expand All @@ -741,31 +738,30 @@ impl<S: EngineSpec> EventStore<S> {
EventTreeNode::Root(root_key.execution_id),
);
while let Some(key) = dfs.next(&self.event_tree) {
if let EventTreeNode::Step(key) = key {
if key != root_key {
if let Some(value) = self.map.get_mut(&key) {
// There's two kinds of nodes reachable from
// EventTreeNode::Root that could be marked as
// completed: subsequent steps within the same
// execution, and steps in child executions.
if key.execution_id == root_key.execution_id {
value.mark_completed(
CompletionReason::SubsequentStarted {
later_step: root_key,
root_total_elapsed: info.root_total_elapsed,
},
root_event_index,
);
} else {
value.mark_completed(
CompletionReason::ParentCompleted {
parent_step: root_key,
parent_info: info.clone(),
},
root_event_index,
);
}
}
if let EventTreeNode::Step(key) = key
&& key != root_key
&& let Some(value) = self.map.get_mut(&key)
{
// There's two kinds of nodes reachable from
// EventTreeNode::Root that could be marked as
// completed: subsequent steps within the same
// execution, and steps in child executions.
if key.execution_id == root_key.execution_id {
value.mark_completed(
CompletionReason::SubsequentStarted {
later_step: root_key,
root_total_elapsed: info.root_total_elapsed,
},
root_event_index,
);
} else {
value.mark_completed(
CompletionReason::ParentCompleted {
parent_step: root_key,
parent_info: info.clone(),
},
root_event_index,
);
}
}
}
Expand Down Expand Up @@ -886,10 +882,10 @@ impl<S: EngineSpec> EventStore<S> {
let mut dfs =
DfsPostOrder::new(&self.event_tree, EventTreeNode::Step(root_key));
while let Some(key) = dfs.next(&self.event_tree) {
if let EventTreeNode::Step(key) = key {
if let Some(value) = self.map.get_mut(&key) {
(cb)(value, MarkStepFailedImplKind::Descendant);
}
if let EventTreeNode::Step(key) = key
&& let Some(value) = self.map.get_mut(&key)
{
(cb)(value, MarkStepFailedImplKind::Descendant);
}
}

Expand All @@ -901,10 +897,10 @@ impl<S: EngineSpec> EventStore<S> {
EventTreeNode::Root(root_key.execution_id),
);
while let Some(key) = dfs.next(&self.event_tree) {
if let EventTreeNode::Step(key) = key {
if let Some(value) = self.map.get_mut(&key) {
(cb)(value, MarkStepFailedImplKind::Subsequent);
}
if let EventTreeNode::Step(key) = key
&& let Some(value) = self.map.get_mut(&key)
{
(cb)(value, MarkStepFailedImplKind::Subsequent);
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions crates/oxide-update-engine-types/tests/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,17 +382,17 @@ impl BufferTestContext {
})
.unwrap();

if let Event::Step(event) = event {
if event_added {
check_last_root_event_index(event, &buffer).with_context(
|| {
format!(
"{description}, at index {i}: \
error with last root event index"
)
},
)?;
}
if let Event::Step(event) = event
&& event_added
{
check_last_root_event_index(event, &buffer).with_context(
|| {
format!(
"{description}, at index {i}: \
error with last root event index"
)
},
)?;
}

receive_buffer.add_event_report(report.clone());
Expand Down
2 changes: 1 addition & 1 deletion crates/oxide-update-engine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
![License: MPL-2.0](https://img.shields.io/crates/l/oxide-update-engine.svg?)
[![crates.io](https://img.shields.io/crates/v/oxide-update-engine.svg?logo=rust)](https://crates.io/crates/oxide-update-engine)
[![docs.rs](https://img.shields.io/docsrs/oxide-update-engine.svg?logo=docs.rs)](https://docs.rs/oxide-update-engine)
[![Rust: ^1.85.0](https://img.shields.io/badge/rust-^1.85.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
[![Rust: ^1.88.0](https://img.shields.io/badge/rust-^1.88.0-93450a.svg?logo=rust)](https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field)
<!-- cargo-sync-rdme ]] -->
<!-- cargo-sync-rdme rustdoc [[ -->
An engine for declaring and executing sequential update steps with
Expand Down
15 changes: 6 additions & 9 deletions e2e-example/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,12 @@ fn register_nested_write_steps<'a>(
{
// Only send progress up to 50% to demonstrate
// not receiving full progress.
if let Event::Progress(event) = &event {
if let Some(counter) = event.kind.progress_counter()
{
if let Some(total) = counter.total {
if counter.current > total / 2 {
break;
}
}
}
if let Event::Progress(event) = &event
&& let Some(counter) = event.kind.progress_counter()
&& let Some(total) = counter.total
&& counter.current > total / 2
{
break;
}

buffer.add_event(event);
Expand Down