belliottsmith commented on code in PR #4220: URL: https://github.com/apache/cassandra/pull/4220#discussion_r2218918746
########## test/simulator/main/org/apache/cassandra/simulator/ActionSchedule.java: ########## @@ -73,7 +73,65 @@ public class ActionSchedule implements CloseableIterator<Object>, LongConsumer { private static final Logger logger = LoggerFactory.getLogger(ActionList.class); - public enum Mode { TIME_LIMITED, STREAM_LIMITED, TIME_AND_STREAM_LIMITED, FINITE, UNLIMITED } + public enum Mode + { + /** + * Definition: Runs the simulation for a specific duration (specified by {@link Work#runForNanos}) + * Behavior: After the time limit is reached, cancels both daemon tasks and stream actions + * Use cases: + * <ul> + * <li>Testing system behavior for a specific duration</li> + * <li>Ensuring tests complete within time boundaries</li> + * <li>Simulating time-constrained scenarios</li> + * </ul> + */ + TIME_LIMITED, + /** + * Definition: Runs until all finite streams are processed ({@link #activeFiniteStreamCount} reaches 0) + * Behavior: Once all finite streams complete, cancels daemon tasks + * Use cases: + * <ul> + * <li>Ensuring all finite operations complete</li> + * <li>Testing scenarios where operation completion is more important than time</li> + * <li>Validating behavior after all finite operations finish</li> + * </ul> + */ + STREAM_LIMITED, + /** + * Definition: Combines both time and stream limitations + * Behavior: Cancels daemon tasks if either all finite streams complete OR the time limit is reached + * Use cases: + * <ul> + * <li>Tests that should terminate on whichever condition happens first</li> + * <li>Flexible scenarios requiring either completion or timeout</li> + * <li>Testing resilience against both completion and time constraints</li> + * </ul> + */ + TIME_AND_STREAM_LIMITED, + /** + * Definition: Does not allow stream actions at all + * Behavior: Throws IllegalStateException if stream actions are added; no special handling for daemon tasks Review Comment: Is the relevant fact that we throw ISE, or that this mode is intended to be used with a FINITE provision of actions, whereas a STREAM is intended to provide an unlimited supply of actions? ISE is simply verification that this is sensible usage. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org