Registry / Framework

framework · v0.1.2
Schema Shadow
Protect a shadow-table cutover until the declared row backfill and an explicit consistency check finish.
Use Schema Shadow
use vendor::schema_shadow::schema_shadow;
Run the example
nest demo schema_shadow@0.1.2
blyxc native-run schema_shadow-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::schema_shadow::schema_shadow;
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 = schema_shadow_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 = schema_shadow_step(live, args_at(arguments, i), text_number(input));
let command = schema_shadow_command(live);
println!(command);
if command == "reject" { process_exit(1); }
i += 2;
}
return;
}
let mut state = schema_shadow_start();
state = schema_shadow_step(state, "stage", 4.0);
println!(schema_shadow_command(state));
state = schema_shadow_step(state, "copied", 4.0);
println!(schema_shadow_command(state));
state = schema_shadow_step(state, "mismatch", 2.0);
println!(schema_shadow_command(state));
state = schema_shadow_step(state, "copied", 2.0);
println!(schema_shadow_command(state));
state = schema_shadow_step(state, "match", 0.0);
println!(schema_shadow_command(state));
state = schema_shadow_step(state, "switch", 0.0);
println!(schema_shadow_command(state));
}
Expected output
create_shadow
compare_tables
recopy_rows
compare_tables
lock_cutover
rename_tables
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.2 | Download ZIP · Browse files | fde375e752 | c7dd36c5abbd231160d6d79a5416186688a562403e2bd39bcbcb16caba395cd7 |
| 0.1.1 | Download ZIP · Browse files | 521251777f | 0f01198761b5637fca047384f598efbe01e265e958f767276737be0fb9d07d37 |
| 0.1.0 | Download ZIP · Browse files | 6349f23784 | e6c88929439fa8f2d651278b4e6f6bce8eec5769ad57cc3b33ef3b383951d3ef |