Registry / Framework

framework · v0.1.2
Alias Cutover
Keep a canonical URL active until the replacement target passes a probe for the same revision.
Use Alias Cutover
use vendor::alias_cutover::alias_cutover;
Run the example
nest demo alias_cutover@0.1.2
blyxc native-run alias_cutover-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::alias_cutover::alias_cutover;
fn main() {
let arguments = cli_args();
if args_len(arguments) > 0 {
if args_len(arguments) % 2 != 0 {
stderr_line("Expected event and value pairs");
process_exit(2);
}
let mut live = alias_cutover_start();
let mut i = 0;
while i < args_len(arguments) {
let input = args_at(arguments, i + 1);
if !text_is_number(input) {
stderr_line("Expected a whole numeric event value");
process_exit(2);
}
live = alias_cutover_step(live, args_at(arguments, i), text_number(input));
let command = alias_cutover_command(live);
println!(command);
if command == "reject" { process_exit(1); }
i += 2;
}
return;
}
let mut state = alias_cutover_start();
state = alias_cutover_step(state, "propose", 9.0);
println!(alias_cutover_command(state));
state = alias_cutover_step(state, "passed", 8.0);
println!(alias_cutover_command(state));
state = alias_cutover_step(state, "passed", 9.0);
println!(alias_cutover_command(state));
state = alias_cutover_step(state, "switch", 9.0);
println!(alias_cutover_command(state));
state = alias_cutover_step(state, "rollback", 9.0);
println!(alias_cutover_command(state));
}
Expected output
probe_target
reject
stage_redirect
enable_redirect
restore_canonical
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.2 | Download ZIP · Browse files | 4bb68d534c | 6bd55f425b61336e6ee7f613c5fb517225e9afcb7849f486f830cacbd0bbb462 |
| 0.1.1 | Download ZIP · Browse files | 154b24cc56 | bc1e62dc0062ba24732e43792edc367befbe50fd5545e7b7090ff4fdce603e7b |
| 0.1.0 | Download ZIP · Browse files | 6349f23784 | 4d83b1b2afef517d6b429e32dadd98d8740790aecd789b6d3ec753dd676999d1 |