-
Notifications
You must be signed in to change notification settings - Fork 2
Chaos features #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Chaos features #45
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
3fdd624
Added node endpoint for crashing individual actors
Brian-1402 e058887
Actor crashing implemented
Brian-1402 bbf2aa2
Removing clone for NodeHandle
Brian-1402 b2e1130
Client side code done for dupl, loss
Aman-Hassan 1f4cf7a
Actor side ChaosManager completed
Aman-Hassan 0547830
WIP review changes
Aman-Hassan c0b5e35
Global Chaos Implemented (Untested)
Aman-Hassan 2ee82ae
added delay chaos
satyamjay-iitd 450c4c0
Actor Restarts implemented (Untested)
Aman-Hassan e9ef0f8
Stop chaos endpoint added (Untested)
Aman-Hassan db86db1
Merge branch 'chaos' into chaos-delay
Brian-1402 e470301
Merge pull request #51 from satyamjay-iitd/chaos-delay
Brian-1402 84bc909
Fixed merge compile errors, incomplete UnsetMsgDelay endpoint
Brian-1402 910522c
Disable delay chaos added (Untested)
Aman-Hassan 9e04d48
Added paxos to examples
Brian-1402 e98661d
debugged delay
satyamjay-iitd 4a68267
Merged master (#53)
satyamjay-iitd 2d39978
added paxos to ci
satyamjay-iitd 69abfcf
Merge branch 'master' of github.com:satyamjay-iitd/reactor into chaos
satyamjay-iitd 6e16f62
merged with master
satyamjay-iitd 10dc530
fixed makefile
satyamjay-iitd 5e71999
formatting
satyamjay-iitd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| use rand::Rng; | ||
|
|
||
| #[derive(Debug)] | ||
| pub struct ChaosManager { | ||
| pub msg_loss_probability: Option<f32>, | ||
| pub msg_duplication_factor: Option<u32>, | ||
| pub msg_duplication_probability: Option<f32>, | ||
| } | ||
|
|
||
| impl ChaosManager { | ||
| pub fn new() -> Self { | ||
| ChaosManager { | ||
| msg_loss_probability: None, | ||
| msg_duplication_factor: None, | ||
| msg_duplication_probability: None, | ||
| } | ||
| } | ||
|
|
||
| pub fn set_msg_loss(&mut self, probability: f32) { | ||
| self.msg_loss_probability = Some(probability); | ||
| } | ||
|
|
||
| pub fn set_msg_duplication(&mut self, factor: u32, probability: f32) { | ||
| self.msg_duplication_factor = Some(factor); | ||
| self.msg_duplication_probability = Some(probability); | ||
| } | ||
|
|
||
| // pub fn unset_msg_loss(&mut self) { | ||
| // self.msg_loss_probability = None; | ||
| // } | ||
|
|
||
| // pub fn unset_msg_duplication(&mut self) { | ||
| // self.msg_duplication_factor = None; | ||
| // self.msg_duplication_probability = None; | ||
| // } | ||
|
|
||
| pub fn apply_chaos<T: Clone>(&self, msg: T) -> Vec<T> { | ||
| let mut rng = rand::rng(); | ||
|
|
||
| if self | ||
| .msg_loss_probability | ||
| .is_some_and(|p| rng.random_bool(p as f64)) | ||
| { | ||
| return vec![]; | ||
| } | ||
|
|
||
| let mut result = vec![msg.clone()]; | ||
Aman-Hassan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if let (Some(factor), Some(prob)) = ( | ||
| self.msg_duplication_factor, | ||
| self.msg_duplication_probability, | ||
| ) { | ||
| if rng.random_bool(prob as f64) { | ||
| for _ in 1..factor { | ||
| result.push(msg.clone()); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| result | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.