Go to file
Mahmut Bulut 821672cd82
Change license to use Apache-2.0/MIT
2019-08-26 23:45:57 +02:00
.github Workflow fix 2019-07-28 17:00:49 +02:00
benches Refactor supervisors to carry out context to share data between children 2019-08-21 00:06:49 +02:00
examples Refactor supervisors to carry out context to share data between children 2019-08-21 00:06:49 +02:00
img Initial commit 2019-07-21 22:38:07 +02:00
src Remove leftover debug point 2019-08-21 00:06:49 +02:00
tests Refactor supervisors to carry out context to share data between children 2019-08-21 00:06:49 +02:00
.appveyor.yml File extension it seems 2019-08-20 14:09:47 +02:00
.gitignore Workflow fix 2019-07-28 17:00:49 +02:00
.travis.yml Multi OS builds 2019-08-20 23:44:40 +02:00
Cargo.toml Change license to use Apache-2.0/MIT 2019-08-26 23:45:57 +02:00
LICENSE-APACHE Change license to use Apache-2.0/MIT 2019-08-26 23:45:57 +02:00
LICENSE-MIT Change license to use Apache-2.0/MIT 2019-08-26 23:45:57 +02:00
README.md Remove nightly feature usage warning from README 2019-08-21 00:02:31 +02:00

README.md



Bastion: Fault-tolerant Runtime for Rust applications

The breeze of the cold winter had come. This time of the year, Crashers arrive in the village. These are the giants who can't be evaded. They born to destroy and take people to the Paniks Heights. Suddenly, The developer descried the blurry silhouettes of Crashers from afar.

With cold and cracked voice, he whispered:

It is time to go to Bastion Fort.


Latest Release Crates.io
License Crates.io
Build Status (Linux / MacOS) travis build status
Build Status (Windows) appveyor build status
Downloads Crates.io
Gitter
Caffeine Donate using Liberapay

Bastion is a Fault-tolerant Runtime for Rust applications. It detect panics during runs of your code and serves a runtime to prevent abrupt exits. Also, it enables you to continue serving in case of a failure. You can select your own recovery scenario, scale your workers and define whole application on top of it.


Usage

Bastion comes with a default one-for-one strategy root supervisor. You can use this to launch automatically supervised tasks.

Check root supervisor example in examples.

Examples cover all the use cases in the frame of the crate.

Include bastion to your project with:

bastion = "0.1"

In most simple way you can use Bastion like here:

use bastion::prelude::*;

fn main() {
    Bastion::platform();

    // Define, calculate or prepare messages to be sent to the processes. 
    let message = String::from("Some message to be passed");

    Bastion::spawn(
        |context, msg: Box<dyn Message>| {
            // Message can be selected with receiver here. Take action!
            receive! { msg,
                String => |e| { println!("Received string :: {}", e)},
                i32 => |e| {println!("Received i32 :: {}", e)},
                _ => println!("No message as expected. Default")
            }

            // Do some processing in body
            println!("root supervisor - spawn_at_root - 1");

            // Rebind to the system
            context.hook();
        },
        message,
    );

    Bastion::start()
}

Structure of the Runtime

Runtime is structured by the user. Only root supervision comes in batteries-included fashion. Worker code, worker group redundancy, supervisors and their supervision strategies are defined by the user.

You can see overall architecture of the framework here:

License

License is MIT

Documentation

Official documentation is hosted on docs.rs.

Getting Help

Please head to our Gitter or use StackOverflow

Discussion and Development

We use Gitter for development discussions. Also please don't hesitate to open issues on GitHub ask for features, report bugs, comment on design and more! More interaction and more ideas are better!

Contributing to Bastion Open Source Helpers

All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome.

A detailed overview on how to contribute can be found in the CONTRIBUTING guide on GitHub.

Thanks

Thanks to my dear mom (Günnur Bulut) who is an artist with many things to do but spending her efforts without any hesitation on small things that I requested (Like this logo). My shining star.

Also, thanks to my friend Berkan Yavri who helped to the idea of making this. Debated over the approaches that I took, spent time on thinking about this project with me.