fix(notify_cancel): removed usage of async trait and made the trait dyn incompatible #2665
+35
−27
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.
Linked Issues/PRs
Description
The code will bloat a little more, but that's fine :_) we don't have dyn dispatch for
NotifyCancel
anymore.This pull request introduces changes to the
fuel-core
crate, primarily focusing on enhancing the flexibility and functionality of theTaskManager
andCancellationToken
structures. The changes include adding a generic parameter to these structures and updating related implementations to accommodate this new parameter.Key changes include:
Enhancements to Task Management:
crates/fuel-core/src/service/genesis/task_manager.rs
: Introduced a generic parameterN
to theTaskManager
andCancellationToken
structures, allowing for more flexible cancellation handling. Updated theNotifyCancel
trait to return a future instead of usingasync_trait
. [1] [2] [3] [4] [5] [6]Updates to Genesis Exporter and Importer:
crates/fuel-core/src/service/genesis/exporter.rs
: Modified theExporter
struct to include the new generic parameterN
and updated its implementation accordingly.crates/fuel-core/src/service/genesis/importer.rs
: Updated theSnapshotImporter
struct to include the new generic parameterN
and adjusted its implementation.Modifications to Import Task:
crates/fuel-core/src/service/genesis/importer/import_task.rs
: Updated therun
method to accept aCancellationToken
with the new generic parameterN
and modified thenever_cancel
test function to reflect this change. [1] [2] [3]Removal of Async Trait:
crates/fuel-core/src/lib.rs
: Removed theasync_trait
annotation from theNotifyCancel
implementation forShutdownListener
.Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]