Commit Graph

606 Commits

Author SHA1 Message Date
o0Ignition0o 48d4c73edb start iteration 0.4.6-alpha.0 2022-01-07 21:38:17 +01:00
o0Ignition0o 2703b5280d prepare for bastion publish 2022-01-07 21:32:09 +01:00
o0Ignition0o cd14080862 bastion-executor: prepare for release 0.4.2 2022-01-07 21:28:08 +01:00
Marc-Antoine Perennou 01eeb5861a
Update dependencies (#337)
* update tracking-subscriber to 0.3

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>

* update lasso to 0.6

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>

* update env_logger to 0.9

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2021-10-25 13:56:57 +02:00
Jeremy Lempereur beff46a61b
unregister from distributors and dispatchers when a child panics (#336) 2021-08-13 09:48:48 +02:00
Colin J. Fuller 44508cd4e7
Don't remove a distributor from the global dispatcher if it has clients (#330)
Because distributors are usable globally by name, it's possible (and
useful) for multiple groups of children to use the same distributor.
However, if one of the groups of children is then stopped as part of the
normal flow of an application, the distributor is removed from the
global dispatcher, and all senders receive an error on trying to send to
that distributor, even if it still has active recipients from other
groups of children.

This commit changes `remove_distributor` in the global dispatcher so
that it checks to see if it still has recipients and only removes the
distributor if there are no remaining recipients.
2021-04-27 14:35:16 +02:00
Cédric 7fb016ced9
Example: add dependencies to distributor (#329) 2021-04-21 14:06:59 +02:00
Benoit Chassignol 055637728b
update hello world with message handler (#328) 2021-04-16 15:25:10 +02:00
Jeremy Lempereur f1697b388b
bump dependencies (#324) 2021-04-13 14:29:27 +02:00
Jeremy Lempereur 24f5522bb4
remove clippy inline lints, that's too much noise for now (#326) 2021-04-13 14:16:18 +02:00
Jeremy Lempereur 90b8a0918d
proposal: distributor request fn (#321)
* 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
2021-04-13 08:31:20 +02:00
o0Ignition0o 1c4ffb3e3f depend on lightproc master branch so we can compile 2021-04-09 09:15:34 +02:00
Jeremy Lempereur c6016a95f6
named Distributor (#319)
* 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
2021-04-06 21:39:46 +02:00
Sasha Pourcelot e923d55503
Export MessageHandler to the prelude (#317)
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]: https://github.com/bastion-rs/bastion/pull/309
2021-03-26 11:32:19 +01:00
Theo M. Bulut c8f1506380
Lower dispatcher log to debug (#315) 2021-03-21 11:12:10 +01:00
Kan-Ru Chen 93b66e4f7c
Fix a typo in children doc (#314) 2021-03-13 10:01:17 +01:00
Benoit Chassignol 674deb13e6
Improve readme (#312) 2021-03-03 09:40:12 +01:00
Sasha Pourcelot 835be0586d
Add MessageHandler (#309)
* 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 <jeremy.lempereur@gmail.com>
2021-03-02 18:31:25 +01:00
Sasha Pourcelot 8d6707fdf2
Translate doc link to intra-doc-link, fix broken links (#310)
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.
2021-03-02 18:30:18 +01:00
fosdick.io ac238b3cdb
Updating the Bastion architecture image and adding it to README.md. See #215 (https://github.com/bastion-rs/bastion/issues/215) for more information. (#311) 2021-03-01 23:11:31 +01:00
Jeremy Lempereur 0d159ea483
Change the supervisor creation order in the broadcast message example (#270) 2021-02-03 17:26:02 +01:00
Sagi Sarussi 0693624dc8
Fix an issue which-in the service doesn't die when `../data/distwrite` doesn't exist. (#279)
Run RustFmt.
2021-02-03 17:18:38 +01:00
Jeremy Lempereur 7f438ca6d6
update miri flags (#275) 2021-02-03 15:08:26 +01:00
Jeremy Lempereur 206ee5af09
target minor versions of lightproc instead of patch (#305) 2021-02-03 14:49:25 +01:00
Jeremy Lempereur c7eb00f9aa
bump nightly versions (#306) 2021-02-03 12:08:29 +01:00
Marc-Antoine Perennou fbcc301667
update rand (#304)
Fixes #298

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2021-02-03 11:44:39 +01:00
o0Ignition0o cbef83704b put the dependency to lightproc back 2021-02-01 19:55:33 +01:00
Jeremy Lempereur 39ff2b8a89
wip, allow to run tokio based futures in the bastion executor (#299)
* 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
2021-02-01 19:49:54 +01:00
Mahmut Bulut 86644839ed (cargo-release) start next development iteration 0.4.5-alpha.0 2021-02-01 14:34:44 +01:00
Mahmut Bulut 5c99157e87 (cargo-release) version 0.4.4 2021-02-01 14:34:22 +01:00
Mahmut Bulut 851207d846 (cargo-release) version 0.4.1 2021-02-01 14:10:02 +01:00
Mahmut Bulut 25e4ec1390
Bastion executor version alignment (#302) 2021-02-01 13:38:16 +01:00
Mahmut Bulut 599a8525c4
Fix clippy warnings (#301) 2021-02-01 13:29:20 +01:00
Jeremy Lempereur fb38a402a5
bump lever and nuclei (#300)
* bump lever

* bump nuclei
2021-02-01 13:21:12 +01:00
Captain Meow bd6c1646dd
override the redundancy based on the resizer (#292)
Signed-off-by: பாலாஜி <rbalajis25@gmail.com>
2020-12-07 12:29:21 +01:00
Captain Meow a478cc66d8
use old state to restart the child (#289)
Signed-off-by: பாலாஜி <rbalajis25@gmail.com>
2020-12-03 12:24:38 +05:30
Marc-Antoine Perennou 44f433fcfa
chore: update dependencies (#288)
Fixes #281 #282 #283 #284 #285 #286

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2020-11-06 11:34:04 +01:00
Sagi Sarussi 1383c196d7
it -> if (#278) 2020-10-11 19:24:09 +02:00
Sagi Sarussi a2a588522f
Fix grammar/typos (#276) 2020-10-06 15:51:58 +02:00
o0Ignition0o 6e58b06fbd (cargo-release) start next development iteration 0.4.4-alpha.0 2020-09-24 21:52:27 +02:00
o0Ignition0o dc175cbe04 (cargo-release) version 0.4.3 2020-09-24 21:51:55 +02:00
o0Ignition0o ff3b755d6d bump executor dependency 2020-09-24 21:47:54 +02:00
o0Ignition0o 80c58ff7fa (cargo-release) bastion-executor start next development iteration 0.4.1-alpha.0 2020-09-24 21:38:22 +02:00
o0Ignition0o 6234445c57 (cargo-release) version 0.4.0 2020-09-24 21:32:49 +02:00
Jeremy Lempereur aa066f2cea
Igni/affine steal sort (#261)
Executor rework
2020-09-24 21:13:42 +02:00
nicolaiunrein 75904cfe43
Fix RestartStrategy::timeout < 1s (#265) 2020-08-20 21:14:52 +02:00
Jeremy Lempereur 6a9f11eb5e
dispatch to available children only. (#268) 2020-08-20 18:50:35 +02:00
o0Ignition0o 3cbda62b85 (cargo-release) start next development iteration 0.4.3-alpha.0 2020-08-12 11:36:24 +02:00
o0Ignition0o 0c7c6085f1 (cargo-release) version 0.4.2 2020-08-12 11:35:50 +02:00
o0Ignition0o e90f546206 bump bastion-executor dependency 2020-08-12 11:35:29 +02:00