Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.2.5 #20

Merged
merged 15 commits into from
Jan 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .cargo/config

This file was deleted.

22 changes: 7 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
version: 2
updates:
- package-ecosystem: github-actions
- package-ecosystem: cargo
directory: /
schedule:
interval: daily
- package-ecosystem: cargo
directory: /xtask
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
- package-ecosystem: cargo
directory: /acme
schedule:
interval: daily
- package-ecosystem: cargo
directory: /crates/compilers
directory: /core
schedule:
interval: daily
- package-ecosystem: cargo
directory: /crates/conduits
directory: /derive
schedule:
interval: daily
- package-ecosystem: cargo
directory: /crates/core
directory: /macros
schedule:
interval: daily
- package-ecosystem: cargo
directory: /crates/gateways
directory: /net
schedule:
interval: daily
- package-ecosystem: cargo
directory: /crates/net
schedule:
interval: daily
- package-ecosystem: cargo
directory: /crates/pipelines
schedule:
interval: daily
11 changes: 6 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
push:
branches: [ "main", "master", "prod" ]
tags: [ "prod-*", "v*.*.*" ]
release:
types: [ published ]
schedule:
- cron: "30 9 * * *"
workflow_dispatch:
Expand All @@ -33,20 +35,19 @@ jobs:
- uses: actions/checkout@v3
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --release -v --workspace
- run: cargo test --all --all-features --release -v
- run: cargo test --all -F full --release -v
features:
if: ${{ github.event.inputs.publish }}
name: Publish
needs: [ build ]
runs-on: ubuntu-latest
strategy:
matrix:
package:
- acme-compilers
- acme-conduits
- acme-core
- acme-gateways
- acme-derive
- acme-macros
- acme-net
- acme-pipelines
steps:
- uses: actions/checkout@v3
- name: Publish (${{matrix.package}})
Expand Down
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ tasks:
rustup default nightly
rustup target add wasm32-unknown-unknown wasm32-wasi --toolchain nightly
rustup component add clippy rustfmt --toolchain nightly
cargo build --workspace --release
cargo build -F full --workspace --release
command: cargo watch -x test --all
13 changes: 11 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ edition = "2021"
homepage = "https://github.com/FL03/acme/wikis"
license = "Apache-2.0"
repository = "https://github.com/FL03/acme"
version = "0.2.4" # TODO - Update cargo package version
readme = "README.md"
version = "0.2.5" # TODO - Update cargo package version

[workspace]
default-members = [
Expand All @@ -14,9 +15,17 @@ default-members = [
exclude = [ "xtask" ]
members = [
"acme",
"crates/*",
"core",
"derive",
"macros",
"net",
]

[workspace.dependencies]
scsys = { features = ["full"], version = "0.1.41" }
serde = { features = ["derive"], version = "1" }
serde_json = "1"

[profile.dev]
codegen-units = 256
debug = true
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

[![Clippy](https://github.com/FL03/acme/actions/workflows/clippy.yml/badge.svg)](https://github.com/FL03/acme/actions/workflows/clippy.yml)
[![Rust](https://github.com/FL03/acme/actions/workflows/rust.yml/badge.svg)](https://github.com/FL03/acme/actions/workflows/rust.yml)
[![crates.io](https://img.shields.io/crates/v/acme.svg)](https://crates.io/crates/acme)
[![docs.rs](https://docs.rs/acme/badge.svg)](https://docs.rs/acme)

***

Expand Down
41 changes: 22 additions & 19 deletions acme/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
[package]
authors = ["FL03 <jo3mccain@icloud.com> (https://github.com)"]
categories = []
description = "Acme is a complete development toolkit for extending platform functionality"
edition = "2021"
homepage = "https://github.com/scattered-systems/acme/wikis"
keywords = ["async", "scsys"]
license = "Apache-2.0"
name = "acme"
publish = true
readme = "README.md"
repository = "https://github.com/scattered-systems/acme"
version = "0.2.4" # TODO - Update cargo package version

authors.workspace = true
description.workspace = true
edition.workspace = true
homepage.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
version.workspace = true

[lib]
crate-type = ["cdylib", "rlib"]
test = true

[features]
default = ["core"]
full = ["conduits", "core", "compilers", "extras", "gateways", "net", "pipelines",]
full = [
"core",
"derive",
"extras",
"macros",
"net",
]

core = ["acme-core"]
derive = ["acme-derive/default"]
macros = ["acme-macros/default"]
extras = []

net = ["acme-net"]
conduits = ["acme-conduits"]
compilers = ["acme-compilers"]
gateways = ["acme-gateways"]
pipelines = ["acme-pipelines"]

[build-dependencies]

[dependencies]
acme-conduits = { features = [], optional = true, path = "../crates/conduits", version = "0.2.4" }
acme-core = { features = [], optional = true, path = "../crates/core", version = "0.2.4" }
acme-compilers = { features = [], optional = true, path = "../crates/compilers", version = "0.2.4" }
acme-gateways = { features = [], optional = true, path = "../crates/gateways", version = "0.2.4" }
acme-net = { features = [], optional = true, path = "../crates/net", version = "0.2.4" }
acme-pipelines = { features = [], optional = true, path = "../crates/pipelines", version = "0.2.4" }
acme-core = { features = [], optional = true, path = "../core", version = "0.2.5" }
acme-derive = { features = [], optional = true, path = "../derive", version = "0.2.5" }
acme-macros = { features = [], optional = true, path = "../macros", version = "0.2.5" }
acme-net = { features = [], optional = true, path = "../net", version = "0.2.5" }

[package.metadata.docs.rs]
all-features = true
Expand Down
24 changes: 6 additions & 18 deletions acme/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,20 @@
Acme was inspired by projects like Python's FastAPI, seeking to simplify the creation of powerful Rust-native applications targeting WebAssembly runtime's.
Additionally, Acme services the ecosystem by forming the basis of our composable runtime environment facilitated by the tandem between Proton, Flow, and Reaction.
*/
#[cfg(feature = "compilers")]
pub use acme_compilers as compilers;
#[cfg(feature = "conduits")]
pub use acme_conduits as conduits;
#[cfg(feature = "core")]
pub use acme_core::*;
#[cfg(feature = "gateways")]
pub use acme_gateways as gateways;
#[cfg(feature = "derive")]
pub use acme_derive::*;
#[cfg(feature = "macros")]
pub use acme_macros::*;
#[cfg(feature = "net")]
pub use acme_net as net;
#[cfg(feature = "pipelines")]
pub use acme_pipelines as pipelines;

pub mod prelude {
pub use super::*;

#[cfg(feature = "compilers")]
pub use super::compilers::*;
#[cfg(feature = "conduits")]
pub use super::conduits::*;
#[cfg(feature = "gateways")]
pub use super::gateways::*;
#[cfg(feature = "net")]
pub use super::net::*;
#[cfg(feature = "pipelines")]
pub use super::pipelines::*;
pub use super::*;
#[cfg(feature = "core")]
pub use super::{events::*, sessions::*};
pub use super::{events::*, handlers::*, sessions::*};
}
43 changes: 43 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[package]
description = "acme"
name = "acme-core"

authors.workspace = true
edition.workspace = true
homepage.workspace = true
license.workspace = true
readme.workspace = true
repository.workspace = true
version.workspace = true

[features]
default = [ "cli"]
full = [ "cli" ]

cli = [ "clap/cargo", "clap/derive", "clap/default", "clap/env"]

[lib]
crate-type = ["cdylib", "rlib"]
test = true

[build-dependencies]

[dev-dependencies]

[dependencies]
scsys.workspace = true
serde.workspace = true
serde_json.workspace = true

async-trait = "0.1"
axum-core = "0.3"
clap = { features = ["cargo", "derive", "env"], optional = true, version = "4" }
decanter = { features = ["derive"], version = "0.1.3" }
futures = "0.3"
strum = { features = ["derive"], version = "0.24" }
tokio = { features = ["macros", "process", "signal", "sync"], version = "1" }
tracing-subscriber = "0.3"

[package.metadata.docs.rs]
all-features = true
rustc-args = ["--cfg", "docsrs"]
11 changes: 8 additions & 3 deletions crates/core/src/events/event.rs → core/src/events/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@
Contrib: FL03 <jo3mccain@icloud.com>
Description: ... Summary ...
*/
use super::{EventSpec, Eventful};
use scsys::prelude::Message;
use crate::{EventSpec, Eventful};
use decanter::prelude::{Hash, Hashable};
use scsys::prelude::{Message, Timestamp};
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Event<E: ToString = super::Events> {
pub event: E,
pub message: Message,
pub timestamp: i64,
}

impl<E: ToString> Event<E> {
pub fn new(event: E, message: Option<Message>) -> Self {
let timestamp = Timestamp::default().into();
Self {
event,
message: message.unwrap_or_default(),
timestamp,
}
}
}
Expand Down Expand Up @@ -80,6 +84,7 @@ mod tests {
#[test]
fn test_events_default() {
let a = Event::<Events>::default();
a.hash();
assert_eq!(a.event(), crate::events::Events::None);
}
}
2 changes: 1 addition & 1 deletion crates/core/src/events/mod.rs → core/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Contrib: FL03 <jo3mccain@icloud.com>
Description: ... Summary ...
*/
pub use self::{event::*, opts::*, specs::*};
pub use self::{event::*, opts::*};

pub(crate) mod event;
pub(crate) mod opts;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/events/opts.rs → core/src/events/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Contrib: FL03 <jo3mccain@icloud.com>
Description: ... Summary ...
*/
use super::{Event, Eventful};
use crate::{events::Event, Eventful};
use scsys::prelude::Message;
use serde::{Deserialize, Serialize};

Expand Down
20 changes: 20 additions & 0 deletions core/src/handlers/handler.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Appellation: handler <module>
Contrib: FL03 <jo3mccain@icloud.com>
Description: ... summary ...
*/
use serde::{Deserialize, Serialize};

pub type TransitionFunction<S, T> = dyn Fn(S) -> T;

pub trait Transition<S> {
type Output;

fn data(&self) -> S;
fn transition(&self, dirac: &TransitionFunction<S, Self::Output>) -> Self::Output {
dirac(self.data())
}
}

#[derive(Clone, Debug, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Handler;
30 changes: 30 additions & 0 deletions core/src/handlers/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Appellation: handlers <module>
Contrib: FL03 <jo3mccain@icloud.com>
Description: ... summary ...
*/
pub use self::handler::*;

pub(crate) mod handler;

pub(crate) mod specs {
use async_trait::async_trait;

///
#[async_trait]
pub trait AsyncHandle: Clone + Send + Sync {
type Error: std::error::Error + Send + Sync;

async fn handler(&self) -> Result<&Self, Self::Error>
where
Self: Sized;
}
///
pub trait Handle: Clone {
type Error: std::error::Error + 'static;

fn handler(&self) -> Result<&Self, Self::Error>
where
Self: Sized;
}
}
Loading