Publish ready (#7)
* Refactor overwatch to overwatch-rs * Update readmes and licenses * Add badges * Added release action * Fix tests after refactor * On push tags on release pipeline * Add missing jobs to release ci * Fmt * Named release job * Fix invalid tag again
This commit is contained in:
parent
d73637eccd
commit
32e6e59377
|
@ -0,0 +1,18 @@
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*.*.*
|
||||
|
||||
name: CI
|
||||
|
||||
jobs:
|
||||
release:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: katyo/publish-crates@v1
|
||||
with:
|
||||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
@ -698,7 +698,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
|
||||
|
||||
[[package]]
|
||||
name = "overwatch"
|
||||
name = "overwatch-derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "overwatch-rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
|
@ -711,18 +723,6 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "overwatch-derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
version = "0.1.2"
|
||||
|
@ -1296,8 +1296,8 @@ dependencies = [
|
|||
"async-trait",
|
||||
"bincode",
|
||||
"clap 4.0.18",
|
||||
"overwatch",
|
||||
"overwatch-derive",
|
||||
"overwatch-rs",
|
||||
"rand",
|
||||
"serde",
|
||||
"tokio",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[workspace]
|
||||
|
||||
members = [
|
||||
"overwatch",
|
||||
"overwatch-rs",
|
||||
"overwatch-derive",
|
||||
"examples/waku-chat"
|
||||
]
|
||||
|
|
|
@ -10,7 +10,7 @@ tokio = { version = "1", features = ["rt"] }
|
|||
waku = { git = "https://github.com/waku-org/waku-rust-bindings" }
|
||||
serde = "1"
|
||||
bincode = "1"
|
||||
overwatch = { path = "../../overwatch" }
|
||||
overwatch-rs = { path = "../../overwatch-rs" }
|
||||
overwatch-derive = { path = "../../overwatch-derive" }
|
||||
tracing = "*"
|
||||
async-trait = "0.1"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crate::network::*;
|
||||
use async_trait::async_trait;
|
||||
use overwatch::services::handle::ServiceStateHandle;
|
||||
use overwatch::services::relay::{NoMessage, OutboundRelay};
|
||||
use overwatch::services::state::{NoOperator, NoState};
|
||||
use overwatch::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use overwatch_rs::services::handle::ServiceStateHandle;
|
||||
use overwatch_rs::services::relay::{NoMessage, OutboundRelay};
|
||||
use overwatch_rs::services::state::{NoOperator, NoState};
|
||||
use overwatch_rs::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::mpsc::channel;
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ mod chat;
|
|||
use chat::*;
|
||||
use clap::Parser;
|
||||
use network::*;
|
||||
use overwatch::{overwatch::*, services::handle::ServiceHandle};
|
||||
use overwatch_derive::*;
|
||||
use overwatch_rs::{overwatch::*, services::handle::ServiceHandle};
|
||||
|
||||
/// Simple program to greet a person
|
||||
#[derive(Parser, Debug)]
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
pub mod waku;
|
||||
use async_trait::async_trait;
|
||||
use overwatch::services::handle::ServiceStateHandle;
|
||||
use overwatch::services::relay::RelayMessage;
|
||||
use overwatch::services::state::{NoOperator, NoState};
|
||||
use overwatch::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use overwatch_rs::services::handle::ServiceStateHandle;
|
||||
use overwatch_rs::services::relay::RelayMessage;
|
||||
use overwatch_rs::services::state::{NoOperator, NoState};
|
||||
use overwatch_rs::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use std::fmt::Debug;
|
||||
use tokio::sync::mpsc::Sender;
|
||||
|
||||
|
|
|
@ -5,6 +5,17 @@ edition = "2021"
|
|||
authors = [
|
||||
"Daniel Sanchez Quiros <danielsq@status.im>"
|
||||
]
|
||||
license-file = "LICENSE"
|
||||
homepage = "https://github.com/logos-co/Overwatch"
|
||||
repository = "https://github.com/logos-co/Overwatch"
|
||||
description = "Overwatch derive macros"
|
||||
readme = "README.md"
|
||||
keywords = ["async", "services"]
|
||||
categories = ["Asynchronous"]
|
||||
exclude = [
|
||||
"./tests",
|
||||
".github",
|
||||
]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[lib]
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# Overwatch
|
||||
|
||||
[<img alt="github" src="https://img.shields.io/badge/github-logos-co/overwatch-derive-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/logos-co/Overwatch)
|
||||
[<img alt="crates.io" src="https://img.shields.io/crates/v/overwatch-derive.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/overwatch-derive)
|
||||
[<img alt="docs.rs" src="https://img.shields.io/badge/doc/overwatch-derive-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs" height="20">](https://docs.rs/overwatch-derive)
|
||||
[<img alt="build status" src="https://img.shields.io/github/workflow/logos-co/Overwatch/CI/master?style=for-the-badge" height="20">](https://github.com/logos-co/Overwatch/actions?query=branch%3Amaster)
|
||||
|
||||
|
||||
Overwatch is a framework to easily construct applications that requires of several independent
|
||||
parts that needs communication between them.
|
||||
Everything is self-contained, and it matches somewhat the advantages of microservices.
|
||||
|
||||
## Overwatch derive
|
||||
|
||||
This crate contains the **derive** utilities for [Overwatch](https://crates.io/crates/overwatch-rs)
|
|
@ -65,7 +65,7 @@ fn generate_services_settings(
|
|||
let service_name = field.ident.as_ref().expect("A named struct attribute");
|
||||
let _type = utils::extract_type_from(&field.ty);
|
||||
|
||||
quote!(pub #service_name: <#_type as ::overwatch::services::ServiceData>::Settings)
|
||||
quote!(pub #service_name: <#_type as ::overwatch_rs::services::ServiceData>::Settings)
|
||||
});
|
||||
let services_settings_identifier = service_settings_identifier_from(services_identifier);
|
||||
quote! {
|
||||
|
@ -83,7 +83,7 @@ fn generate_assert_unique_identifiers(
|
|||
let services_ids = fields.iter().map(|field| {
|
||||
let _type = utils::extract_type_from(&field.ty);
|
||||
quote! {
|
||||
<#_type as ::overwatch::services::ServiceData>::SERVICE_ID
|
||||
<#_type as ::overwatch_rs::services::ServiceData>::SERVICE_ID
|
||||
}
|
||||
});
|
||||
let services_ids_check = format_ident!(
|
||||
|
@ -92,7 +92,7 @@ fn generate_assert_unique_identifiers(
|
|||
);
|
||||
|
||||
quote! {
|
||||
const #services_ids_check: () = assert!(::overwatch::utils::const_checks::unique_ids(&[#( #services_ids ),*]));
|
||||
const #services_ids_check: () = assert!(::overwatch_rs::utils::const_checks::unique_ids(&[#( #services_ids ),*]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ fn generate_services_impl(
|
|||
let impl_update_settings = generate_update_settings_impl(fields);
|
||||
|
||||
quote! {
|
||||
impl ::overwatch::overwatch::Services for #services_identifier {
|
||||
impl ::overwatch_rs::overwatch::Services for #services_identifier {
|
||||
type Settings = #services_settings_identifier;
|
||||
|
||||
#impl_new
|
||||
|
@ -143,7 +143,7 @@ fn generate_new_impl(fields: &Punctuated<Field, Comma>) -> proc_macro2::TokenStr
|
|||
quote! {
|
||||
#field_identifier: {
|
||||
let manager =
|
||||
::overwatch::services::handle::ServiceHandle::<#service_type>::new(
|
||||
::overwatch_rs::services::handle::ServiceHandle::<#service_type>::new(
|
||||
#settings_field_identifier, overwatch_handle.clone(),
|
||||
);
|
||||
manager
|
||||
|
@ -152,7 +152,7 @@ fn generate_new_impl(fields: &Punctuated<Field, Comma>) -> proc_macro2::TokenStr
|
|||
});
|
||||
|
||||
quote! {
|
||||
fn new(settings: Self::Settings, overwatch_handle: ::overwatch::overwatch::handle::OverwatchHandle) -> Self {
|
||||
fn new(settings: Self::Settings, overwatch_handle: ::overwatch_rs::overwatch::handle::OverwatchHandle) -> Self {
|
||||
let Self::Settings {
|
||||
#( #fields_settings ),*
|
||||
} = settings;
|
||||
|
@ -176,7 +176,7 @@ fn generate_start_all_impl(fields: &Punctuated<Field, Comma>) -> proc_macro2::To
|
|||
|
||||
quote! {
|
||||
#[::tracing::instrument(skip(self), err)]
|
||||
fn start_all(&mut self) -> Result<(), ::overwatch::overwatch::Error> {
|
||||
fn start_all(&mut self) -> Result<(), ::overwatch_rs::overwatch::Error> {
|
||||
#( #call_start )*
|
||||
Ok(())
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ fn generate_start_impl(fields: &Punctuated<Field, Comma>) -> proc_macro2::TokenS
|
|||
let field_identifier = field.ident.as_ref().expect("A struct attribute identifier");
|
||||
let type_id = utils::extract_type_from(&field.ty);
|
||||
quote! {
|
||||
<#type_id as ::overwatch::services::ServiceData>::SERVICE_ID => {
|
||||
<#type_id as ::overwatch_rs::services::ServiceData>::SERVICE_ID => {
|
||||
self.#field_identifier.service_runner().run();
|
||||
Ok(())
|
||||
}
|
||||
|
@ -197,10 +197,10 @@ fn generate_start_impl(fields: &Punctuated<Field, Comma>) -> proc_macro2::TokenS
|
|||
|
||||
quote! {
|
||||
#[::tracing::instrument(skip(self), err)]
|
||||
fn start(&mut self, service_id: ::overwatch::services::ServiceId) -> Result<(), ::overwatch::overwatch::Error> {
|
||||
fn start(&mut self, service_id: ::overwatch_rs::services::ServiceId) -> Result<(), ::overwatch_rs::overwatch::Error> {
|
||||
match service_id {
|
||||
#( #cases ),*
|
||||
service_id => Err(::overwatch::overwatch::Error::Unavailable { service_id })
|
||||
service_id => Err(::overwatch_rs::overwatch::Error::Unavailable { service_id })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,16 +212,16 @@ fn generate_stop_impl(fields: &Punctuated<Field, Comma>) -> proc_macro2::TokenSt
|
|||
let type_id = utils::extract_type_from(&field.ty);
|
||||
// TODO: actually stop them here once service lifecycle is implemented
|
||||
quote! {
|
||||
<#type_id as ::overwatch::services::ServiceData>::SERVICE_ID => { unimplemented!() }
|
||||
<#type_id as ::overwatch_rs::services::ServiceData>::SERVICE_ID => { unimplemented!() }
|
||||
}
|
||||
});
|
||||
|
||||
quote! {
|
||||
#[::tracing::instrument(skip(self), err)]
|
||||
fn stop(&mut self, service_id: ::overwatch::services::ServiceId) -> Result<(), ::overwatch::overwatch::Error> {
|
||||
fn stop(&mut self, service_id: ::overwatch_rs::services::ServiceId) -> Result<(), ::overwatch_rs::overwatch::Error> {
|
||||
match service_id {
|
||||
#( #cases ),*
|
||||
service_id => Err(::overwatch::overwatch::Error::Unavailable { service_id })
|
||||
service_id => Err(::overwatch_rs::overwatch::Error::Unavailable { service_id })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,23 +232,23 @@ fn generate_request_relay_impl(fields: &Punctuated<Field, Comma>) -> proc_macro2
|
|||
let field_identifier = field.ident.as_ref().expect("A struct attribute identifier");
|
||||
let type_id = utils::extract_type_from(&field.ty);
|
||||
quote! {
|
||||
<#type_id as ::overwatch::services::ServiceData>::SERVICE_ID => {
|
||||
<#type_id as ::overwatch_rs::services::ServiceData>::SERVICE_ID => {
|
||||
Ok(::std::boxed::Box::new(
|
||||
self.#field_identifier
|
||||
.relay_with()
|
||||
.expect("An open relay to service is established")
|
||||
) as ::overwatch::services::relay::AnyMessage)
|
||||
) as ::overwatch_rs::services::relay::AnyMessage)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
quote! {
|
||||
#[::tracing::instrument(skip(self), err)]
|
||||
fn request_relay(&mut self, service_id: ::overwatch::services::ServiceId) -> ::overwatch::services::relay::RelayResult {
|
||||
fn request_relay(&mut self, service_id: ::overwatch_rs::services::ServiceId) -> ::overwatch_rs::services::relay::RelayResult {
|
||||
{
|
||||
match service_id {
|
||||
#( #cases )*
|
||||
service_id => Err(::overwatch::services::relay::RelayError::Unavailable { service_id })
|
||||
service_id => Err(::overwatch_rs::services::relay::RelayError::Unavailable { service_id })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ fn generate_update_settings_impl(fields: &Punctuated<Field, Comma>) -> proc_macr
|
|||
|
||||
quote! {
|
||||
#[::tracing::instrument(skip(self, settings), err)]
|
||||
fn update_settings(&mut self, settings: Self::Settings) -> Result<(), ::overwatch::overwatch::Error> {
|
||||
fn update_settings(&mut self, settings: Self::Settings) -> Result<(), ::overwatch_rs::overwatch::Error> {
|
||||
let Self::Settings {
|
||||
#( #fields_settings ),*
|
||||
} = settings;
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
[package]
|
||||
name = "overwatch"
|
||||
name = "overwatch-rs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = [
|
||||
"Daniel Sanchez Quiros <danielsq@status.im>"
|
||||
]
|
||||
license-file = "LICENSE"
|
||||
homepage = "https://github.com/logos-co/Overwatch"
|
||||
repository = "https://github.com/logos-co/Overwatch"
|
||||
description = "Overwatch is a framework to easily construct applications that requires of several independent parts that needs communication between them. Everything is self-contained, and it matches somewhat the advantages of microservices."
|
||||
readme = "README.md"
|
||||
keywords = ["async", "services"]
|
||||
categories = ["Asynchronous"]
|
||||
exclude = [
|
||||
"./tests",
|
||||
".github",
|
||||
]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# Overwatch
|
||||
|
||||
[<img alt="github" src="https://img.shields.io/badge/github-logos-co/overwatch-rs-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/logos-co/Overwatch)
|
||||
[<img alt="crates.io" src="https://img.shields.io/crates/v/overwatch-rs.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/overwatch-rs)
|
||||
[<img alt="docs.rs" src="https://img.shields.io/badge/doc/overwatch-rs-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs" height="20">](https://docs.rs/overwatch-rs)
|
||||
[<img alt="build status" src="https://img.shields.io/github/workflow/logos-co/Overwatch/CI/master?style=for-the-badge" height="20">](https://github.com/logos-co/Overwatch/actions?query=branch%3Amaster)
|
||||
|
||||
Overwatch is a framework to easily construct applications that requires of several independent
|
||||
parts that needs communication between them.
|
||||
Everything is self-contained, and it matches somewhat the advantages of microservices.
|
||||
|
||||
## Design Goals
|
||||
|
||||
- Modularity:
|
||||
- Components should be self-contained (as possible)
|
||||
- Communication relations between components should be specifically defined
|
||||
- Components should be mockable. This is rather important for measurements and testing.
|
||||
|
||||
- Single responsibility:
|
||||
- It is easier to isolate problems
|
||||
- Minimal sharing when unavoidable
|
||||
|
||||
- Debuggeability
|
||||
- Easy to track workflow
|
||||
- Easy to test
|
||||
- Easy to measure
|
||||
- Asynchronous Communication
|
|
@ -1,11 +1,11 @@
|
|||
use async_trait::async_trait;
|
||||
use futures::future::select;
|
||||
use overwatch::overwatch::OverwatchRunner;
|
||||
use overwatch::services::handle::{ServiceHandle, ServiceStateHandle};
|
||||
use overwatch::services::relay::RelayMessage;
|
||||
use overwatch::services::state::{NoOperator, NoState};
|
||||
use overwatch::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use overwatch_derive::Services;
|
||||
use overwatch_rs::overwatch::OverwatchRunner;
|
||||
use overwatch_rs::services::handle::{ServiceHandle, ServiceStateHandle};
|
||||
use overwatch_rs::services::relay::RelayMessage;
|
||||
use overwatch_rs::services::state::{NoOperator, NoState};
|
||||
use overwatch_rs::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use std::time::Duration;
|
||||
use tokio::time::sleep;
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
use async_trait::async_trait;
|
||||
use overwatch::overwatch::OverwatchRunner;
|
||||
use overwatch::services::handle::{ServiceHandle, ServiceStateHandle};
|
||||
use overwatch::services::relay::RelayMessage;
|
||||
use overwatch::services::state::{NoOperator, NoState};
|
||||
use overwatch::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use overwatch_derive::Services;
|
||||
use overwatch_rs::overwatch::OverwatchRunner;
|
||||
use overwatch_rs::services::handle::{ServiceHandle, ServiceStateHandle};
|
||||
use overwatch_rs::services::relay::RelayMessage;
|
||||
use overwatch_rs::services::state::{NoOperator, NoState};
|
||||
use overwatch_rs::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use std::time::Duration;
|
||||
use tokio::time::sleep;
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
use async_trait::async_trait;
|
||||
use overwatch::overwatch::OverwatchRunner;
|
||||
use overwatch::services::handle::{ServiceHandle, ServiceStateHandle};
|
||||
use overwatch::services::relay::RelayMessage;
|
||||
use overwatch::services::state::{ServiceState, StateOperator};
|
||||
use overwatch::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use overwatch_derive::Services;
|
||||
use overwatch_rs::overwatch::OverwatchRunner;
|
||||
use overwatch_rs::services::handle::{ServiceHandle, ServiceStateHandle};
|
||||
use overwatch_rs::services::relay::RelayMessage;
|
||||
use overwatch_rs::services::state::{ServiceState, StateOperator};
|
||||
use overwatch_rs::services::{ServiceCore, ServiceData, ServiceId};
|
||||
use std::time::Duration;
|
||||
use tokio::io::{self, AsyncWriteExt};
|
||||
use tokio::time::sleep;
|
Loading…
Reference in New Issue