CAPITAN
Distributed systems on a whim
I've worked in distributed systems for a while, and most of my time has been spent writing boilerplate, debugging little implementation errors and chasing down stream deadlocks (two streams are receiving at the same time) This library was built to combat the boilerplate that comes with writing these kinds of applications and only write meaningful code, in a way that is guaranteed to work and avoid stream deadlocks.
This library provides macros and traits to help build highly-available services with various features in as little lines of code as possible.
This library is supposed to be protocol-agnostic, but is mostly designed to work around the master/server architecture.
quick intro to Capitan
SERVICES
// first off, there's services, which are highly available functions.
// they cannot crash unless the init or the fallback processes fail.
;
// to initialize a service you create a reactor with it.
// this will run the LB service
capitan!
EVENTS
type SteerMetadata = AtomicU32;
// events are message-based communication
// which are guaranteed not to have stream deadlocks
// they have to implement various traits to be able to be sent
// through the steer! macro
// this allows for easy encryption
// you can define the encryption algorithm.
// the respond trait defines how to respond to each event.
// this trait must be implemented
// The event trait defines which event to create.
// having once implemented all traits, you can now use
// the steer macro for simple, safe, deadlock-guaranteed
// message passthrough.
steer!
// this will create two async methods for the steer struct
// async fn master_event()
// and
// async fn peer_event()
let stream = connect.await?;
let mut steer = new.await;
steer.master_event.await?;
// on the peer you run
// steer.peer_event().await?;