Compare commits

..

3 Commits

Author SHA1 Message Date
cuddle-please
bdcd04716b chore(release): 0.2.1
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-08-07 10:09:47 +00:00
7c08d7a5df
docs: add a small readme
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
2024-08-07 12:08:21 +02:00
6b481ba2af chore(release): v0.2.0 (#2)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
### Added
- with ctrl-c signal

Co-authored-by: cuddle-please <bot@cuddle.sh>
Reviewed-on: #2
2024-08-07 11:41:29 +02:00
3 changed files with 49 additions and 1 deletions

View File

@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.2.1] - 2024-08-07
### Docs
- add a small readme
## [0.2.0] - 2024-08-07
### Added

View File

@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"
[workspace.package]
version = "0.2.0"
version = "0.2.1"
[workspace.dependencies]
mad = { path = "crates/mad" }

43
README.md Normal file
View File

@ -0,0 +1,43 @@
# MAD
Mad is a life-cycle manager for long running rust operations.
- Webservers
- Queue bindings
- gRPC servers etc
- Cron runners
It is supposed to be the main thing the application runs, and everything from it is spawned and managed by it.
```rust
struct WaitServer {}
#[async_trait]
impl Component for WaitServer {
fn name(&self) -> Option<String> {
Some("NeverEndingRun".into())
}
async fn run(&self, cancellation: CancellationToken) -> Result<(), mad::MadError> {
let millis_wait = rand::thread_rng().gen_range(50..1000);
// Simulates a server running for some time. Is normally supposed to be futures blocking indefinitely
tokio::time::sleep(std::time::Duration::from_millis(millis_wait)).await;
Ok(())
}
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
Mad::builder()
.add(WaitServer {})
.add(WaitServer {})
.add(WaitServer {})
.run()
.await?;
Ok(())
}
```