Skip to content

Commit 95158a5

Browse files
committed
feat(state_machine): add access to execution history using tracker
1 parent 77c6853 commit 95158a5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

mfm_machine/src/state_machine/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::anyhow;
44

55
use crate::state::{context::ContextWrapper, StateResult, States};
66

7-
use self::tracker::{HashMapTracker, Index, Tracker};
7+
use self::tracker::{HashMapTracker, Index, Tracker, TrackerHistory};
88

99
pub mod tracker;
1010

@@ -56,6 +56,10 @@ impl StateMachine {
5656
}
5757
}
5858

59+
pub fn track_history(&self) -> TrackerHistory {
60+
self.tracker.history()
61+
}
62+
5963
fn has_state(&self, state_index: usize) -> bool {
6064
self.states.len() > state_index
6165
}

mfm_machine/tests/retry_workflow_state_machine_test.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@ fn test_retry_workflow_state_machine() {
2424

2525
let result = state_machine.execute(context);
2626

27+
println!(
28+
"state machine execution history: \n{:?}",
29+
state_machine.track_history()
30+
);
31+
2732
assert!(result.is_ok());
2833
}

0 commit comments

Comments
 (0)