Add LocalServiceManager with start_local for LocalSet-driven services#1
Closed
mcharytoniuk wants to merge 5 commits into
Closed
Add LocalServiceManager with start_local for LocalSet-driven services#1mcharytoniuk wants to merge 5 commits into
mcharytoniuk wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a “local” service orchestration path (LocalServiceManager + start_local) intended for running !Send services on a Tokio LocalSet, and refactors some shared lifecycle logic (shutdown draining + outcome classification) out of the existing RunningServiceCollection. It also adds a parallel set of integration tests validating the same behaviors for local services.
Changes:
- Add
LocalService,LocalServiceManager, andLocalRunningServiceCollectionto run!Sendservices viaLocalSet. - Refactor service shutdown draining and panic/error classification into
service_task_drainerandservice_outcome_classifier. - Add extensive
local_*integration tests and do minor import re-ordering in existing tests.
Reviewed changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 25 comments.
Show a summary per file
| File | Description |
|---|---|
| trzcina/src/lib.rs | Wire up new local modules and re-export new public types. |
| trzcina/src/service.rs | Minor formatting change in Service trait. |
| trzcina/src/running_service_collection.rs | Use shared outcome classifier + task drainer; adjust start visibility/attributes. |
| trzcina/src/service_task_drainer.rs | New shared shutdown/drain/abort logic extracted from running collection. |
| trzcina/src/service_outcome_classifier.rs | New shared panic/error/ok outcome classification helper. |
| trzcina/src/local_service.rs | New LocalService trait for !Send services. |
| trzcina/src/local_service_manager.rs | New manager for registering local services/bundles and starting locally. |
| trzcina/src/local_service_bundle.rs | New bundle trait for producing local services. |
| trzcina/src/local_running_service_collection.rs | New local running collection backed by LocalSet + shared drainer/classifier. |
| trzcina/src/local_registered_service.rs | New internal representation for registered local services. |
| trzcina/tests/supports_notify_driven_event_loop_pattern.rs | Import ordering adjustment. |
| trzcina/tests/supports_mutable_internal_state_across_iterations.rs | Import ordering adjustment. |
| trzcina/tests/supports_multi_channel_select_pump_pattern.rs | Import ordering adjustment. |
| trzcina/tests/supports_interval_ticker_reconciliation_pattern.rs | Import ordering adjustment. |
| trzcina/tests/supports_internal_retry_loop_pattern.rs | Import ordering adjustment. |
| trzcina/tests/supports_actix_style_shutdown_signal_pattern.rs | Import ordering adjustment. |
| trzcina/tests/run_reports_leaked_beyond_abort_deadline_when_service_ignores_abort.rs | Import ordering adjustment. |
| trzcina/tests/run_records_string_literal_panic_payload.rs | Import ordering adjustment. |
| trzcina/tests/run_records_service_panic_and_cancels_siblings.rs | Import ordering adjustment. |
| trzcina/tests/run_records_service_error_and_cancels_siblings.rs | Import ordering adjustment. |
| trzcina/tests/run_records_non_string_panic_payload.rs | Import ordering adjustment. |
| trzcina/tests/run_records_all_failures_when_multiple_services_error.rs | Import ordering adjustment. |
| trzcina/tests/run_completes_when_all_services_finish_simultaneously.rs | Import ordering adjustment. |
| trzcina/tests/run_completes_immediately_when_no_services_registered.rs | Import ordering adjustment. |
| trzcina/tests/run_cancels_siblings_when_one_service_finishes_first.rs | Import ordering adjustment. |
| trzcina/tests/run_cancels_all_services_when_external_token_cancelled.rs | Import ordering adjustment. |
| trzcina/tests/run_aborts_hung_services_on_external_cancel.rs | Import ordering adjustment. |
| trzcina/tests/run_aborts_hung_service_after_shutdown_deadline.rs | Import ordering adjustment. |
| trzcina/tests/register_service_runs_registered_service.rs | Import ordering adjustment. |
| trzcina/tests/register_bundle_runs_all_services_returned_by_bundle.rs | Import ordering adjustment. |
| trzcina/tests/coordinates_via_shared_holder_between_two_services.rs | Import ordering adjustment. |
| trzcina/tests/local_supports_notify_driven_event_loop_pattern.rs | New local-service behavioral test. |
| trzcina/tests/local_supports_mutable_internal_state_across_iterations.rs | New local-service behavioral test. |
| trzcina/tests/local_supports_multi_channel_select_pump_pattern.rs | New local-service behavioral test. |
| trzcina/tests/local_supports_interval_ticker_reconciliation_pattern.rs | New local-service behavioral test. |
| trzcina/tests/local_supports_internal_retry_loop_pattern.rs | New local-service behavioral test. |
| trzcina/tests/local_supports_actix_style_shutdown_signal_pattern.rs | New local-service behavioral test. |
| trzcina/tests/local_runs_tokio_spawn_local_inside_service.rs | New local-service behavioral test (spawn_local). |
| trzcina/tests/local_runs_non_send_service.rs | New local-service behavioral test (Rc/RefCell). |
| trzcina/tests/local_run_records_string_literal_panic_payload.rs | New local-service failure-reporting test (panic string). |
| trzcina/tests/local_run_records_service_panic_and_cancels_siblings.rs | New local-service sibling-cancellation + panic recording test. |
| trzcina/tests/local_run_records_service_error_and_cancels_siblings.rs | New local-service sibling-cancellation + error recording test. |
| trzcina/tests/local_run_records_non_string_panic_payload.rs | New local-service failure-reporting test (non-string panic). |
| trzcina/tests/local_run_records_all_failures_when_multiple_services_error.rs | New local-service multi-failure aggregation test. |
| trzcina/tests/local_run_completes_when_all_services_finish_simultaneously.rs | New local-service completion test. |
| trzcina/tests/local_run_completes_immediately_when_no_services_registered.rs | New local-service empty-manager test. |
| trzcina/tests/local_run_cancels_siblings_when_one_service_finishes_first.rs | New local-service sibling-cancellation test. |
| trzcina/tests/local_run_cancels_all_services_when_external_token_cancelled.rs | New local-service external-cancel test. |
| trzcina/tests/local_run_aborts_hung_services_on_external_cancel.rs | New local-service hung-service abort-on-cancel test. |
| trzcina/tests/local_run_aborts_hung_service_after_shutdown_deadline.rs | New local-service hung-service abort-on-deadline test. |
| trzcina/tests/local_register_service_runs_registered_service.rs | New local-service registration test. |
| trzcina/tests/local_register_bundle_runs_all_services_returned_by_bundle.rs | New local-service bundle registration test. |
| trzcina/tests/local_register_bundle_propagates_error_from_bundle.rs | New local-service bundle error-propagation test. |
| trzcina/tests/local_coordinates_via_shared_holder_between_two_services.rs | New local-service coordination/shared-state test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+37
to
+42
| impl Manager for LocalServiceManager { | ||
| type Running = LocalRunningServiceCollection; | ||
|
|
||
| fn start(self, cancellation_token: CancellationToken) -> LocalRunningServiceCollection { | ||
| LocalRunningServiceCollection::start(self.services, cancellation_token) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.