rio-rs
Distributed stateful services inspired by Orleans
This crate provides a framework for scalable, distributed and stateful services based on message passing between objects
Application
Most of your application code will be written in forms of ServiceObjects and Messages
use async_trait;
use *;
use ;
use Arc;
Running Server
To run your application you need to spin up your servers, the Server
TODO: Include example of other databases
use *;
use SqliteMembersStorage;
use SqliteObjectPlacementProvider;
async
Client
Communicating with the cluster is just a matter of sending the serialized known messages via TCP.
The [client] module provides an easy way of achieving this:
use *;
use SqliteMembersStorage;
async
Roadmap
There are a few things that must be done before v0.1.0:
Next
- Improve error message for ManagedState macro when the struct doesn't implement ServiceObject
- Improve error message for ManagedState when the storage is not in the context
- Improve error message for when the services are not added to the registry (server)
- Remove the need for two types of concurrent hashmap (papaya and dashmap)
- Client doesn't need to have a access to the cluster backend if we implement an HTTP API
- Create server from config
- Bypass clustering for self messages
- [~] Bypass networking for local messages
- Move all the client to user tower
- Remove the need to pass the StateSaver to
ObjectStateManager::save_state - Include registry configuration in Server builder
- Create a getting started tutorial
- Cargo init
- Add deps (rio-rs, tokio, async_trait, serde, sqlx - optional)
- Write a server
- Write a client
- Add service and messages
- Cargo run --bin server
- Cargo run --bin client
- Life cycle
- Life cycle depends on app_data(StateLoader + StateSaver)
- Cargo test?
- MySQL support for sql backends
- Add pgsql jsonb support
- Client/server keep alive
- Placement strategies (nodes work with different sets of trait objects)
- Supervision
- Ephemeral objects (aka regular - local - actors)
- Remove magic numbers
- Object TTL
- Code of conduct
- Metrics and Tracing
- Deny allocations based on system resources
- Dockerized examples
- [?] Reduce static lifetimes
Version 0.2.0
- Support 'typed' message/response on client (TODO define what this means)
- Ability to hook up own custom errors on message handlers
- Allow
ServiceObjecttrait without state persistence - Add more extensive tests to client/server integration
- Increase public API test coverage
- Add all SQL storage behind a feature flag (sqlite, mysql, pgsql, etc)
- Matrix test with different backends
- Replace prints with logging
Version 0.1.0
- Naive server/client protocol
- Basic cluster support
- Basic placement support
- Object self shutdown
- Naive object persistence
- Public API renaming
- Reduce Boxed objects
- Create a Server builder
- Remove need to use
add_static_fn(FromId::from_id)-> Removed in favour ofRegistry::add_type - Support service background task
- Pub/sub
- Examples covering most use cases
- Background async task on a service
- Background blocking task on a service (see black-jack)
- Pub/sub (see black-jack)
- Re-organize workspace
- Support ephemeral port
- Remove the need for an
Option<T>value formanaged_stateattributes (as long as it has a 'Default') -
ServiceObject::sendshouldn't need a type for the member storage - Handle panics on messages handling
- Error and panic handling on life cycle hooks (probably kill the object)
- Create a test or example to show re-allocation when servers dies
- Sqlite support for sql backends
- PostgreSQL support for sql backends
- Redis support for members storage
- Redis support for state backend (loader and saver)
- Redis support for object placement