-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: meta-service: re-implement export with Stream
- Updated the `export()` function in `grpc_service.rs` to use crate `futures-async-stream`, changed return type of the function to use a `BoxStream` that yields a series of JSON strings, instead of returning a big `Vec<String>`. This allows for more efficient handling of asynchronous streams, which can provide performance improvements. Note that `export(self: Arc<Sefl>)` takes an `Arc<Self>` as argument because the generated `gRPC` stream signature requires a `'static` lifetime. As a result, the `export(&self)` can not be used: ``` type ExportStream: Stream<Item = Result<_, _>> + Send + 'static; ``` - Add dependency crate `futures-async-stream`; - Enable unstable feature `#![feature(generators)]` for building a `Stream` from a generator(`yield ...`);
- Loading branch information
1 parent
e8c1aeb
commit 0ded016
Showing
8 changed files
with
70 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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