slawlor / ractor

Rust actor framework
MIT License
1.31k stars 68 forks source link

Add node event subscription #121

Closed slawlor closed 1 year ago

slawlor commented 1 year ago

When setting up a node, presently there's no way to capture events on nodes without polling the NodeServer.

This change adds a NodeEventSubscription trait so that subscribers can implement the trait to get node events.

Additionally integration tests updated to prove subscription events are wired up right

node-a  | [2023-05-19T15:51:28.807Z WARN  ractor_cluster_integration_tests::tests::auth_handshake] [SubscriptionEventLogger] Node 0 (172.19.0.3:38756) opened
node-b  | [2023-05-19T15:51:28.807Z WARN  ractor_cluster_integration_tests::tests::auth_handshake] [SubscriptionEventLogger] Node 0 (172.19.0.2:8199) opened
...
node-b  | [2023-05-19T15:51:28.808Z WARN  ractor_cluster_integration_tests::tests::auth_handshake] [SubscriptionEventLogger] Node 0 (172.19.0.2:8199) authenticated
node-a  | [2023-05-19T15:51:28.808Z WARN  ractor_cluster_integration_tests::tests::auth_handshake] [SubscriptionEventLogger] Node 0 (172.19.0.3:38756) authenticated
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage has no change and project coverage change: -0.19 :warning:

Comparison is base (3ba5654) 79.93% compared to head (4191876) 79.75%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #121 +/- ## ========================================== - Coverage 79.93% 79.75% -0.19% ========================================== Files 50 50 Lines 8863 8884 +21 ========================================== Hits 7085 7085 - Misses 1778 1799 +21 ``` | [Impacted Files](https://app.codecov.io/gh/slawlor/ractor/pull/121?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Sean+Lawlor) | Coverage Δ | | |---|---|---| | [ractor\_cluster/src/lib.rs](https://app.codecov.io/gh/slawlor/ractor/pull/121?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Sean+Lawlor#diff-cmFjdG9yX2NsdXN0ZXIvc3JjL2xpYi5ycw==) | `100.00% <ø> (ø)` | | | [ractor\_cluster/src/node/mod.rs](https://app.codecov.io/gh/slawlor/ractor/pull/121?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Sean+Lawlor#diff-cmFjdG9yX2NsdXN0ZXIvc3JjL25vZGUvbW9kLnJz) | `2.85% <0.00%> (-0.27%)` | :arrow_down: | | [ractor\_cluster/src/node/node\_session/mod.rs](https://app.codecov.io/gh/slawlor/ractor/pull/121?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Sean+Lawlor#diff-cmFjdG9yX2NsdXN0ZXIvc3JjL25vZGUvbm9kZV9zZXNzaW9uL21vZC5ycw==) | `32.09% <0.00%> (-0.12%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.