Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
* dev: (25 commits)
  Changelog
  Add note to deadlock example
  Add extra trace logging in AddrInner to detect backpressure.
  Switch to edition 2021
  use tx.dyned()
  fix wasm tests.
  Update github actions.
  Fix clippy warnings.
  Make name obligatory on builder as well.
  Remove the deadlock_prio example in favor of the test.
  Add Debug impl for BoxEnvelope.
  Improving existing examples and tests.
  Add an example using tokio channel.
  Add an example to ActorBuilder docs.
  BREAKING: change ActorBuilder::channel signature.
  Add CloneSinkExt.
  Add tracing to RxStrong.
  Add a deadlock test with priority channel.
  Update deps
  Set build status badge to github actions.
  ...
  • Loading branch information
najamelan committed Jul 1, 2023
2 parents ec9fbe1 + 7c10b6c commit 375b42b
Show file tree
Hide file tree
Showing 49 changed files with 699 additions and 445 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/ci.yml
Expand Up @@ -11,15 +11,13 @@ jobs:
steps:

- name: Install latest stable Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: clippy


- name: Checkout crate
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Run tests
run: bash ci/test.bash
Expand All @@ -33,14 +31,12 @@ jobs:
steps:

- name: Install latest nightly Rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
override: true
components: clippy

- name: Checkout crate
uses: actions/checkout@v2
uses: actions/checkout@v3


- name: Run clippy
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.md
Expand Up @@ -5,9 +5,29 @@
[Unreleased]: https://github.com/najamelan/async_executors/compare/release...dev


## [0.3.0] - 2022-07-01

[0.3.0]: https://github.com/najamelan/async_executors/compare/0.2.1...0.3.0

### Upgraded

- __BREAKING__: Update thespis to 0.2.0.
- __BREAKING__: Change the `ActorBuilder::channel` signature so you don't
have to manually convert the error type on the `Sink`.

### Changed

- __BREAKING__: Names have become mandatory on `Mailbox` and `ActorBuilder`.
- __BREAKING__: Improved ergonomics of using custom channels.
- switch to edition 2021

### Added
- more examples and tests


## [0.2.1] - 2022-05-26

[0.2.0]: https://github.com/najamelan/async_executors/compare/0.2.0...0.2.1
[0.2.1]: https://github.com/najamelan/async_executors/compare/0.2.0...0.2.1

### Fixed

Expand Down
24 changes: 14 additions & 10 deletions Cargo.toml
Expand Up @@ -39,14 +39,15 @@ version = "^0.3"
version = "^0.1"

[dependencies.thespis]
version = "^0.1"
version = "^0.2"

[dependencies.tracing-futures]
features = ["futures-03"]
version = "^0.2"

[dev-dependencies]
async_nursery = "^0.5"
async_progress = "^0.2"
futures-timer = "^3"
ring-channel = "^0.11"

Expand Down Expand Up @@ -129,11 +130,6 @@ name = "concurrent_nursery"
path = "examples/concurrent_nursery.rs"
required-features = ["not_wasm"]

[[example]]
name = "deadlock_prio"
path = "examples/deadlock_prio.rs"
required-features = ["not_wasm"]

[[example]]
name = "desugar"
path = "examples/desugar.rs"
Expand Down Expand Up @@ -179,6 +175,11 @@ name = "throttle"
path = "examples/throttle.rs"
required-features = ["not_wasm"]

[[example]]
name = "tokio_channel"
path = "examples/tokio_channel.rs"
required-features = ["not_wasm"]

[[example]]
name = "tracing"
path = "examples/tracing.rs"
Expand All @@ -196,15 +197,14 @@ authors = ["Naja Melan <najamelan@autistici.org>"]
categories = ["asynchronous", "concurrency"]
description = "Reference implementation for the thespis actor model"
documentation = "https://docs.rs/thespis_impl"
edition = "2018"
edition = "2021"
homepage = "https://github.com/thespis-rs/thespis_impl"
keywords = ["async", "futures", "actor", "thespis"]
license = "Unlicense"
name = "thespis_impl"
readme = "README.md"
repository = "https://github.com/thespis-rs/thespis_impl"
resolver = "2"
version = "0.2.1"
version = "0.3.0"

[package.metadata]
[package.metadata.docs]
Expand All @@ -219,6 +219,7 @@ actix = "^0.13"
actix-rt = "^2"

[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.async_chanx]
features = ["tokio"]
version = "^0.1.0-alpha"

[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.async_executors]
Expand All @@ -227,7 +228,7 @@ version = "^0.6"

[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.criterion]
features = []
version = "^0.3"
version = "^0.4"

[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.stream_throttle]
default-features = false
Expand All @@ -241,6 +242,9 @@ version = "^1"
[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.tokio-stream]
version = "^0.1"

[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.tokio-util]
version = "^0.7"

[target."cfg(target_arch = \"wasm32\")"]
[target."cfg(target_arch = \"wasm32\")".dev-dependencies]
wasm-bindgen = "^0.2"
Expand Down
25 changes: 14 additions & 11 deletions Cargo.yml
Expand Up @@ -25,10 +25,9 @@ package:
# - `git tag x.x.x` with version number.
# - `git push && git push --tags`
#
version : 0.2.1
version : 0.3.0
name : thespis_impl
edition : '2018'
resolver : '2'
edition : '2021'
authors : [ Naja Melan <najamelan@autistici.org> ]
description : Reference implementation for the thespis actor model
license : Unlicense
Expand Down Expand Up @@ -75,7 +74,7 @@ dependencies:
#
async_executors : { version: ^0.6 }
futures : { version: ^0.3, features: [ std, compat ], default-features: false }
thespis : { version: ^0.1 }
thespis : { version: ^0.2 }
tracing : ^0.1

# private dependencies.
Expand All @@ -93,6 +92,8 @@ dev-dependencies:
async-std : { version: ^1, features: [ attributes ] }
# tracing-test : { version: ^0.1, path: ../../RUST/tracing-test/tracing-test }
futures-timer : ^3
async_progress : ^0.2


target:

Expand All @@ -112,16 +113,17 @@ target:
dev-dependencies:

async_executors : { version: ^0.6, features: [localpool, threadpool, async_std, tokio_ct, tokio_tp, tracing] }
async_chanx : { version: ^0.1.0-alpha }
async_chanx : { version: ^0.1.0-alpha, features: [tokio] }
stream_throttle : { version: ^0.4, default-features: false, features: [timer-futures-timer] }
tokio-stream : { version: ^0.1 }
tokio-util : { version: ^0.7 }

# for benchmarks
#
actix-rt : ^2
actix : ^0.13
criterion : { version: ^0.3, features: [] }
criterion : { version: ^0.4, features: [] }
tokio : { version: ^1, features: [ sync, macros ] }
tokio-stream : { version: ^0.1 }


build-dependencies:
Expand Down Expand Up @@ -198,10 +200,6 @@ example:
path : examples/concurrent_nursery.rs
required-features : [ not_wasm ]

- name : deadlock_prio
path : examples/deadlock_prio.rs
required-features : [ not_wasm ]

- name : desugar
path : examples/desugar.rs
required-features : [ not_wasm ]
Expand Down Expand Up @@ -238,6 +236,11 @@ example:
path : examples/throttle.rs
required-features : [ not_wasm ]

- name : tokio_channel
path : examples/tokio_channel.rs
required-features : [ not_wasm ]

- name : tracing
path : examples/tracing.rs
required-features : [ not_wasm ]

6 changes: 3 additions & 3 deletions README.md
@@ -1,7 +1,7 @@
# thespis_impl

[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![Build Status](https://api.travis-ci.org/najamelan/thespis_impl.svg?branch=release)](https://travis-ci.org/najamelan/thespis_impl)
[![Build Status](https://github.com/thespis-rs/thespis_impl/actions/workflows/ci.yml/badge.svg?branch=release&event=push)](https://github.com/thespis-rs/thespis_impl/actions/workflows/ci.yml)
[![Docs](https://docs.rs/thespis_impl/badge.svg)](https://docs.rs/thespis_impl)
[![crates.io](https://img.shields.io/crates/v/thespis_impl.svg)](https://crates.io/crates/thespis_impl)

Expand Down Expand Up @@ -34,14 +34,14 @@ With [cargo yaml](https://gitlab.com/storedbox/cargo-yaml):
```yaml
dependencies:

thespis_impl: ^0.2
thespis_impl: ^0.3
```

In Cargo.toml:
```toml
[dependencies]

thespis_impl = "0.2"
thespis_impl = "0.3"
```

### Upgrade
Expand Down
5 changes: 5 additions & 0 deletions TODO.md
@@ -1,14 +1,19 @@
## TODO

- Document the limitation of futures channels of not waking up the sender, as discovered in the deadlock test. What is the consequence for other actors?
- align all repo's and update the super repo.

fix code coverage, currently still on travis.

- verify log spans.
- see tests/tracing.rs See: https://github.com/dbrgn/tracing-test/issues/4
- neither wasm-logger, nor tracing-wasm show the current span atm. See: https://github.com/storyai/tracing-wasm/issues/17
- log where addr are created and dropped for easier debugging when we have an addr that we forgot to drop.

### Tests

- flesh out tests.
- deadlock still happening

# Perf

Expand Down
8 changes: 4 additions & 4 deletions benches/multi_thread/contention.rs
Expand Up @@ -209,8 +209,8 @@ fn mpsc( c: &mut Criterion )
(
||
{
let (sum_in_addr , sum_in_mb) = Addr::builder().bounded( Some(BOUNDED) ).build() ;
let (mut sum_addr, sum_mb ) = Addr::builder().bounded( Some(BOUNDED) ).build() ;
let (sum_in_addr , sum_in_mb) = Addr::builder( "sum_in" ).bounded( Some(BOUNDED) ).build() ;
let (mut sum_addr, sum_mb ) = Addr::builder( "sum" ).bounded( Some(BOUNDED) ).build() ;

let sum = Sum { total: 5, inner: sum_in_addr } ;
let sum_in = SumIn { count: 0 } ;
Expand Down Expand Up @@ -328,8 +328,8 @@ fn mpsc( c: &mut Criterion )
(
||
{
let (sum_in_addr , sum_in_mb) = Addr::builder().bounded( Some(BOUNDED) ).build() ;
let (mut sum_addr, sum_mb ) = Addr::builder().bounded( Some(BOUNDED) ).build() ;
let (sum_in_addr , sum_in_mb) = Addr::builder( "sum_in" ).bounded( Some(BOUNDED) ).build() ;
let (mut sum_addr, sum_mb ) = Addr::builder( "sum" ).bounded( Some(BOUNDED) ).build() ;

let sum = Sum { total: 5, inner: sum_in_addr } ;
let sum_in = SumIn { count: 0 } ;
Expand Down
20 changes: 10 additions & 10 deletions benches/multi_thread/delivery.rs
Expand Up @@ -176,9 +176,9 @@ fn spsc( c: &mut Criterion )
(
move || // setup
{
let (sum_in_addr, sum_in_mb) = Addr::builder().bounded( Some(BOUNDED) ).build() ;
let (sum_in_addr, sum_in_mb) = Addr::builder( "sum_in" ).bounded( Some(BOUNDED) ).build() ;
let (sum_addr, sum_mb) = Addr::builder( "sum" ).bounded( Some(BOUNDED) ).build() ;
let sum = Sum{ total: 5, inner: sum_in_addr } ;
let (sum_addr, sum_mb) = Addr::builder().bounded( Some(BOUNDED) ).build() ;

let sumin_thread = thread::spawn( move ||
{
Expand Down Expand Up @@ -207,7 +207,7 @@ fn spsc( c: &mut Criterion )

let res = sum_addr.call( Show{} ).await.expect( "Call failed" );

assert_eq!( *msgs as u64 *10 + 5 + termial( *msgs as u64 ), res );
assert_eq!( *msgs *10 + 5 + termial( *msgs ), res );
});

sumin_thread.join().expect( "join sum_in thread" );
Expand Down Expand Up @@ -266,7 +266,7 @@ fn spsc( c: &mut Criterion )

// let res = sum_addr.call( Show{} ).await.expect( "Call failed" );

// assert_eq!( *msgs as u64 *10 + 5 + termial( *msgs as u64 ), res );
// assert_eq!( *msgs *10 + 5 + termial( *msgs ), res );
// });

// sumin_thread.join().expect( "join sum_in thread" );
Expand Down Expand Up @@ -304,7 +304,7 @@ fn spsc( c: &mut Criterion )

let res = sum_addr.send( Show{} ).await.expect( "Call failed" );

assert_eq!( *msgs as u64 *10 + 5 + termial( *msgs as u64 ), res );
assert_eq!( *msgs *10 + 5 + termial( *msgs ), res );

sum_in_thread.stop();
sum_thread .stop();
Expand All @@ -327,9 +327,9 @@ fn spsc( c: &mut Criterion )
(
move || // setup
{
let (sum_in_addr, sum_in_mb) = Addr::builder().bounded( Some(BOUNDED) ).build() ;
let sum = Sum{ total: 5, inner: sum_in_addr } ;
let (sum_addr, sum_mb) = Addr::builder().bounded( Some(BOUNDED) ).build() ;
let (sum_in_addr, sum_in_mb) = Addr::builder( "sum_in" ).bounded( Some(BOUNDED) ).build() ;
let (sum_addr , sum_mb ) = Addr::builder( "sum" ).bounded( Some(BOUNDED) ).build() ;
let sum = Sum{ total: 5, inner: sum_in_addr } ;


let sumin_thread = thread::spawn( move ||
Expand Down Expand Up @@ -359,7 +359,7 @@ fn spsc( c: &mut Criterion )

let res = sum_addr.call( Show{} ).await.expect( "Call failed" );

assert_eq!( *msgs as u64 *10 + 5 + termial( *msgs as u64 ), res );
assert_eq!( *msgs *10 + 5 + termial( *msgs ), res );
});

sumin_thread.join().expect( "join sum_in thread" );
Expand Down Expand Up @@ -419,7 +419,7 @@ fn spsc( c: &mut Criterion )

// let res = sum_addr.call( Show{} ).await.expect( "Call failed" );

// assert_eq!( *msgs as u64 *10 + 5 + termial( *msgs as u64 ), res );
// assert_eq!( *msgs *10 + 5 + termial( *msgs ), res );
// });

// sumin_thread.join().expect( "join sum_in thread" );
Expand Down

0 comments on commit 375b42b

Please sign in to comment.