A blue-green deployment keeps the old environment available while a new one is verified, switched into service, and drained.
Design a BlueGreenCutoverAuditor:
- The constructor receives the number of long-lived connections already attached to blue.
firstUnsafeEvent(events) returns the first unsafe event index, or -1.isComplete(events) returns true only when a valid trace has green active and blue retired.
Recognized events:
"DEPLOY_GREEN" creates the green environment."SMOKE_PASS" records successful smoke tests after deployment."SCHEMA_COMPATIBLE" confirms the shared database works with both versions."SWITCH_GREEN" sends new traffic to green after all readiness gates pass."DRAIN_BLUE" closes one pre-existing blue connection after the switch."ROLLBACK_BLUE" returns new traffic to retained blue."RETIRE_BLUE" removes blue after green is active and every old connection has drained.
Setup events may occur only once. A rolled-back trace is valid but incomplete. Green remains deployed and may be switched to again.
Example 1:
Input:
Output:
Example 2:
Input:
Output:
Constraints
0 <= activeBlueConnections <= 10^40 <= events.length <= 10^5- Event names are case-sensitive.
- At most
100 total method calls are made.