-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(storage-manager): separate creation/start of StorageService
This commit separates creating the `StorageService` from starting it. This change is motivated by the Replication feature: when performing the initial alignment we want to delay the Storage from answering queries until after the initial alignment has been performed. In order to have this functionality we need to be able to dissociate creating the `StorageService` from starting it. As the method `start_storage_queryable_subscriber` takes ownership of the `StorageService`, it became mandatory to first create the `StorageService`, then start the Replication and lastly start the Storage. Because of this, as the Replication code was inside a task, the code to create and start the Storage was also moved inside the task. * plugins/zenoh-plugin-storage-manager/src/replication/service.rs: - Take a reference over the `StorageService` structure as it is only needed before spawning the different Replication tasks. The StorageService is still needed to call `process_sample`. - Clone the `Arc` of the underlying Storage before spawning the Replication tasks. * plugins/zenoh-plugin-storage-manager/src/storages_mgt/mod.rs: - Move the logging until starting the Storage. - Move the code starting the Storage inside the task. - Start the `StorageService` after having started the `ReplicationService`. * plugins/zenoh-plugin-storage-manager/src/storages_mgt/service.rs: - Renamed the function `start` to `new` as it now only creates an instance of the `StorageService`. - Removed the parameter `rx` from the call to `new` as it no longer also starts it. - Removed the call to `start_storage_queryable_subscriber` from `new`. - Changed the visibility of the method `start_storage_queryable_subscriber` to `pub(crate)` as it is called from outside the `service` module. - Added logging information before the Storage "loop" is started (to help confirm, with the logs, the order in which the different elements are started). Signed-off-by: Julien Loudet <[email protected]>
- Loading branch information
Showing
3 changed files
with
46 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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