Bastion – A Highly-Available Distributed Fault-Tolerant Runtime for Rust
github.com
github.com
I read through this and their documentation and literally have no idea what this feels like to the developer or how to start.
0: https://github.com/bastion-rs/bastion/blob/master/src/bastio...
1: https://github.com/bastion-rs/bastion/tree/master/src/bastio...
I have a hard time framing what this does exactly even with the examples and need subtitles. :)
Some follow up questions for me would be around the messaging guarantee (AMO) and what sort of effort is required to, say, implement OTP semantics in Bastion.
Here is Erlang OTP's doc with code snippets for your comparative reference:
But maybe I should? Maybe that example would help? :)
Here are two good starting points (since Bastion is the same type of platform): https://learnyousomeerlang.com/what-is-otp
https://dockyard.com/blog/2018/07/18/all-for-reliability-ref...
That first link has what you want: examples. But note how many pieces are involved and that it is not a 5 minute read :)
Top level, a project like this needs to communicate to the intended audiance -- here, people who are building F/T distributed actor systems -- what the project brings to the table, and imo they did a good job in that regard.
Example:
use bastion::prelude::\*;
#[fort::root]
async fn main(_: BastionContext) -> Result<(), ()> {
println!("Running in Bastion runtime!");
Ok(())
}Crash Course with Bastion— Mahmut Bulut https://www.youtube.com/watch?v=IsBNjJBlA1E
edit: good reads https://www.reddit.com/r/rust/comments/flf2ld/how_does_rusts...
past discussion: https://news.ycombinator.com/item?id=22403713
It'd be nice to have a few code snippets geared at newbies in the README as well as a pointer to blog posts explaining why actor-based systems are great.
I want to investigate this, but I don't have the time to research any of this right now, and none of that information is right in front of me.
I am going to reason about this. It's me thinking aloud here.
I already know that JS callbacks and promises are somewhat equivalent to continuations. A continuation is something which is to be done later and which is passed as a value to functions which then directly or indirectly invoke the continuation or not if it is decided not to do the thing encapsulated in the continuation (for example if something failed and the algorithm is trying to bail out such that it doesn't make sense to continue with the continuation).
I also know that JS async/await is equivalent to generators. Koa version 1 used generators and Koa 2 switched to async/await.
I also know that Rust futures are or were based on generators. Rust generators are not stable and the last time I looked they were a bit left behind by futures. For me it seems that futures rely on some compiler magic such that they work even if generators are not stable.
Therefore Rust futures are somewhat equivalent to continuations.
There's a difference as far as I know, however. Continuations seem to be strictly more powerful than generators. In other words, you can implement generators by continuations but not the other way around.
It looks like the proactive IO in Bastion is using Rust's async/await, which I know nothing about, but in most languages async/await exists as sugar to make CPS look like linear flow.
Roughly:
When you want to read from files reactively, you run "select" with these files as arguments in a loop. The return value will tell you, which file is ready to be read.
In proactive IO, you instead supply a buffer to the read operation and get a handle back, that will notify you when the read operation is finished. Windows IO Completion Ports (IOCPs) are an example of this.
(I almost can’t believe I just made this metric up.)
Bastion ratio = (3 million/1953) = 1500
Rust ratio = (9 million/52700) = 180
Bastion sales source (2015) -https://www.supergiantgames.com/blog/transistor-earns-60-ind...
Rust sales source (2019) - https://facepunch.com/news/2019
The metric isn’t perfect. It should probably decay the popularity of older games and unmaintained repos.