Skip to content

Commit

Permalink
Merge pull request #52 from Scattered-Systems/v0.1.42
Browse files Browse the repository at this point in the history
V0.1.42
  • Loading branch information
FL03 authored Mar 28, 2023
2 parents 48c115a + 70a79d7 commit 73a57ea
Show file tree
Hide file tree
Showing 31 changed files with 395 additions and 536 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ updates:
directory: /derive
schedule:
interval: daily
- package-ecosystem: cargo
directory: /gen
schedule:
interval: daily
- package-ecosystem: cargo
directory: /macros
schedule:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Clippy

on:
pull_request:
branches: [ "main", "master", "prod*" ]
branches-ignore: [ "dev*" ]
tags: [ "nightly*", "v*.*.*" ]
push:
branches: [ "main", "master", "prod*" ]
branches-ignore: [ "dev*" ]
tags: [ "nightly*", "v*.*.*" ]
schedule:
- cron: "30 9 * * *"
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ env:

on:
pull_request:
branches: [ "main", "master", "prod*" ]
branches-ignore: [ "dev*" ]
tags: [ "nightly*", "v*.*.*" ]
push:
branches: [ "main", "master", "prod*" ]
branches-ignore: [ "dev*" ]
tags: [ "nightly*", "v*.*.*" ]
schedule:
- cron: "30 9 * * *"
Expand All @@ -23,20 +23,24 @@ on:
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest

strategy:
matrix:
platform: [ ubuntu-latest ]
toolchain:
- stable
- nightly
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: rustup
run: |
rustup update
rustup default ${{ matrix.toolchain }}
- run: cargo build -F full --release -v --workspace
- run: cargo test --all -F full --release -v
- name: Build
run: cargo build -F full --release -v --workspace
- name: Test
run: cargo test --all -F full --release -v
features:
if: ${{ github.event.inputs.publish }}
name: Publish (features)
Expand All @@ -47,7 +51,6 @@ jobs:
- scsys-actors
- scsys-core
- scsys-derive
- scsys-gen
- scsys-macros
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ default-members = [

exclude = [
"examples/*",
"xtask"
]

members = [
"core",
"derive",
"gen",
"macros",
"scsys"
]
Expand All @@ -26,11 +24,13 @@ keywords = ["blockchain", "primitives", "scsys"]
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/scattered-systems/scsys"
version = "0.1.41"
version = "0.1.42"

[workspace.dependencies]
serde = { features = ["derive"], version = "1" }
serde_json = "1"
smart-default = "0.6"
strum = { features = ["derive"], version = "0.24" }

[profile.dev]
codegen-units = 256
Expand Down
24 changes: 3 additions & 21 deletions actors/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,7 @@ pub use self::message::*;

pub(crate) mod message;

pub(crate) mod specs {
use serde::Serialize;
use std::{collections::HashSet, fmt::Display};

pub trait Symbolic: Clone + Display {
fn symbols(&self) -> &HashSet<Self>;
}

/// Describes the base interface for creating new messages
pub trait MessageSpec: Clone + Display + Serialize {
type Symbol: Symbolic;

fn message(&self) -> &Self::Symbol;
fn timestamp(&self) -> i64;
}
/// Extends the base message specification for composing more complex message pipelines
pub trait MessageSpecExt: MessageSpec {
type Metadata: Serialize;

fn metadata(&self) -> &Self::Metadata;
}
pub trait MessageSpec {
fn message(&self) -> &Self;
fn timestamp(&self) -> i64;
}
61 changes: 31 additions & 30 deletions actors/src/states/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,44 @@
Contrib: FL03 <jo3mccain@icloud.com>
Description: ... Summary ...
*/
pub use self::{specs::*, state::*};
pub use self::state::*;

pub(crate) mod state;

pub(crate) mod specs {
use crate::messages::Message;
use std::sync::Arc;
use crate::messages::Message;
use std::sync::Arc;

pub trait StatePack: Default + ToString {
fn by_ref(&self) -> &Self {
self
}
fn by_ref_mut(&mut self) -> &mut Self {
self
}
/// [StatePack] describes the possible states being wrapped by a [Stateful] structure.
pub trait StatePack:
Default + ToString + std::convert::From<i64> + std::convert::Into<i64>
{
fn by_ref(&self) -> &Self {
self
}
fn by_ref_mut(&mut self) -> &mut Self {
self
}
}

pub trait Stateful<S: StatePack>: Clone + Default {
type Data;
fn by_ref(&self) -> Self {
self.clone()
}
fn by_ref_mut(&mut self) -> Self {
self.clone()
}
fn by_arc(self: Arc<Self>) -> Arc<Self> {
self
}
fn message(self) -> Message<Self::Data>;
fn state(self) -> S;
fn timestamp(self) -> i64;
pub trait Stateful<S: StatePack>: Clone + Default {
type Data;
fn by_ref(&self) -> Self {
self.clone()
}
fn by_ref_mut(&mut self) -> Self {
self.clone()
}
fn by_arc(self: Arc<Self>) -> Arc<Self> {
self
}
fn message(self) -> Message<Self::Data>;
fn state(self) -> S;
fn timestamp(self) -> i64;
}

pub trait StatefulExt<S: StatePack>: Stateful<S> {
fn now() -> i64 {
chrono::Utc::now().timestamp()
}
fn update_state(&mut self, msg: Option<Message<Self::Data>>, state: S) -> &Self;
pub trait StatefulExt<S: StatePack>: Stateful<S> {
fn now() -> i64 {
chrono::Utc::now().timestamp()
}
fn update(&mut self, msg: Option<Message<Self::Data>>, state: S);
}
Loading

0 comments on commit 73a57ea

Please sign in to comment.