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

Igni/actor branch replay #327

Draft
wants to merge 41 commits into
base: relrin/bastion-actor-trait
Choose a base branch
from

Conversation

o0Ignition0o
Copy link
Contributor

Checklist
  • tests are passing with cargo test.
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message is clear

o0Ignition0o and others added 30 commits September 24, 2020 21:13
Fixes #281 #282 #283 #284 #285 #286

Signed-off-by: Marc-Antoine Perennou <[email protected]>
* bump lever

* bump nuclei
* wip, allow to run tokio based futures in the bastion executor

* use tokio::main!

* runtime handles

* wip, adding tests and making them compatible with runtime-tokio

* ok docs remaining, no clue how to handle it

* wip, doctests

* wip: getting there...

* tests are finally passing!

* runtime-tokio => tokio-runtime

* tokio_test is amazing <3

* woopsie

* prepare for master, so we can beta test the tokio feature
Fixes #298

Signed-off-by: Marc-Antoine Perennou <[email protected]>
Transitioning to intra-doc-link will allow us to get better feedback about broken
links in the future. It also allows us to remove some annotations that are guessed
by rustdoc.

This commit *should* translate every link to intra-doc-link.
* Add initial implementation for MessageHandler

This commit adds very basic implementation of MessageHandler. This structure
stores a SignedMessage, and calls, depending on which kind of message it is, and
on its underlying type, either a specified closure, or a fallback one.

The goal is to provide an API that would be nicer to work with than the msg!
macro.

Current implementation features a state-machine like algorithm and currently
only handles messages that can responded to (aka "questions").

* Make AnswerSender carry its own signature.

This allows us not to trust caller of AnswerSender::reply to provide a
correct signature. As such, the corresponding method can be documented.

This is necessary because such method may be called in the closure that
are passed to MessageHandler::with_question.

Note: this commit renames AnswerSender::send to AnswerSender::respond, and
removes the signature part. This method is public but not documented. As
such, this theorically breaking change should not break any code.

* Add on_* functions

This allows us to match on both regular messages (the ones we can't
respond to) as well as the broadcasts. It follows the same model
established previously.

* Add documentation for MessageHandler API

* Make sender address available for each on_* function

* Allow MessageHandler to return something

Previous implementation of MessageHandler always returned nothing, as it
was not considered important. However, returning something is important
at least in the fibonacci example.

This commit allows the MessageHandler to return some data. It requires
every matcher to return the same data type. This data is stored in the
MessageHandler and returned by the on_fallback function.

* Rewrite the fibonacci example with MessageHanlder

* Remove useless clone by destructuring on fallback.

This allows us to remove additional code.

* Add a proof of concept that we can match over different types using the MessageHandler

Co-authored-by: Jeremy Lempereur <[email protected]>
vertexclique and others added 11 commits March 21, 2021 11:12
Previous pull request[1] introduced the MessageHandler datatype, but did
not export it in the prelude.

Examples have been updated so that they don't import MessageHandler manually.

[1]: #309
* wip

* wip, a lot left!

* a bit of debug statements and more funsies

* tell and tell_everyone are working.

* ok we're almost there, lets see if i can handle a vec<replies> and if i can register ppl to a new Distributor

* yay it works!

* lints

* 19 lints remaining

* 9 warnings to go

* docs + tests

* i think we re good to go

* example fix

* san

* move miri to a .sh file

* bump nightlies and anyhow

* clippy pass + prepare to merge
* proposal: distributor request fn

* go async by default, add a sync variant backed by mpsc::channel

* let the example runwith or without the tokio-runtime feature

* fix: sometimes the children weren't attached to the dispatcher

* use RwLock for now

* add an after_start callback to know exactly when the children have spawned and the distributor is ready to receive and dispatch messages to everyone

* wip

* merge tests

* split the tokio and the regular test runner so that both pass
* dispatch to available children only. (#268)

* Fix RestartStrategy::timeout < 1s (#265)

* Renamed ActorStateData struct to Context

* Extended available states for Actor

* Added methods for additional states

* Added removed state

* Added definition module

* Added Definition struct

* Removed unsafe Send and Sync implementation for MailboxTx

* Added docstrings for Mailbox<T>

* Added tests for the Definition struct

* Added presaving messages

* Removed excessive imports

* Added methods for getting latest message

* Removed reference for the returned envelope

* Code review changes
@o0Ignition0o o0Ignition0o changed the base branch from master to relrin/bastion-actor-trait April 14, 2021 11:00
@Relrin Relrin force-pushed the relrin/bastion-actor-trait branch from fb29cfb to 90fe2c9 Compare July 4, 2021 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants