Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Backup Chain for BlyxNew to Visual Studio Code? Get it now.
Backup Chain for Blyx

Backup Chain for Blyx

Rahul Chaube

| (0) | Free
Require a base snapshot and contiguous increments before sealing a restorable backup chain.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Backup Chain

Run Backup Chain 0.2.0 examples

In a trusted workspace, choose Blyx: Run Installed Framework Example with Blyx Language 1.5.0 or later. Select Backup Chain, then the starter or batch example. The general Blyx CLI executes a temporary copy and compares stdout with the shipped expected output. A mismatch identifies the first differing line and column. Language editor

The task snippet Run bundled Backup Chain batch example (one task) also runs vendor/backup_chain/batch_example.blyx. Compare its terminal output against batch_example.expected.txt in the same directory.

Check Backup Chain in VS Code

This editor includes the exact Blyx framework source and its installation checks. Open a trusted desktop workspace with the general Blyx CLI, its native toolchain and a host linker available. The command below uses the general CLI's native-run command. CLI installation

  1. Create an empty .vscode/tasks.json. Choose Snippets: Fill File with Snippet and select Verify Backup Chain (workspace tasks). If you have a tasks array already, insert the Verify bundled Backup Chain (one task) snippet there.
  2. Choose Tasks: Run Task → Blyx: Verify bundled Backup Chain. On success the terminal prints backup_chain: installation checks passed. On failure the command reports the failed check and exits with code 1.
  3. To check a project copy, run nest add backup_chain@0.2.0 and choose the installed-package task matching your project's vendor or src/vendor directory.

The extension's starter directory is also a complete project. Copy it to a writable folder, open that folder in VS Code, and choose Tasks: Run Task → Blyx: Run supplied example. Compare the terminal output with expected.txt.

blyxc native-run vendor/backup_chain/verify_install.blyx

In a Blyx test, import vendor::backup_chain::verification and call backup_chain_verify_install(). The result is zero on success or the number of the first failed check. Package and source files

Green peafowl male

Require a base snapshot and contiguous increments before sealing a restorable backup chain.

Reliability and delivery · framework · 0.1.2

Framework bird: Green peafowl male.

Drive the workflow

Start with backup_chain_start(). For each event call backup_chain_step(snapshot, event, value), persist the returned snapshot, and dispatch backup_chain_command(snapshot) to your application’s adapter. The host owns I/O, event ordering, duplicate detection and durable command delivery. A matching event produces one command. Rejected events retain the phase and saved quantity. An invalid snapshot yields an empty vector.

The snapshot contains phase ID, saved quantity and last command ID. Event values are whole numbers from zero through one billion. In the table, x is the event value and r is the saved quantity. Rules match in listed order. To validate a whole history without running effects use backup_chain_replay(events, values). It returns the final snapshot or an empty vector on rejection.

Current phase Event Guard Next phase Command New quantity
idle base always copying copy_base x
copying verified x=r open accept_increment r
open increment x=r+1 open record_increment x
open seal x=r done publish_manifest r
open gap x>r+1 copying restart_from_base x

Phase IDs in order from zero: idle, copying, open, done.

Replay your own events

After installing the demo, run the following from its directory. Supply alternating event names and integer values. The command prints each requested action and exits with status 1 at the first rejected transition, or 2 for malformed arguments.

blyxc native-run main.blyx -- base 4 verified 4 increment 5 seal 5

Run this checkout

Run blyxc native-run main.blyx to reproduce expected.txt. Run blyxc native-run checks.blyx and compare the complete output with checks-expected.txt.

Try the published project

nest demo backup_chain@0.1.2
blyxc native-run backup_chain-demo/main.blyx

Install with nest add backup_chain@0.1.2 and import vendor::backup_chain::backup_chain.

Maintained by Rahul Chaube. Blyx · GitHub · LinkedIn · Sponsor

Editor snippets

Use this extension with the Blyx Language extension. In a .blyx file, type one of the following prefixes and invoke editor completion.

  • backup_chain_start
  • backup_chain_step
  • backup_chain_command
  • backup_chain_replay
  • use_backup_chain
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft