This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This refactoring started when I tried to split the message parsing service in several components, some which I could re-use for implementing a multipart message service. I tried to make some simplification, and after some yak shaving ended up making quite a lot of changes. This should make it much easier to implement the multipart message service though. ### Add a coordinator public key validation service This is a check we forgot to implement in the past. See also: - http://world.std.com/~dtd/#sign_encrypt - #514 ### `PetError` removal Only one out of the three variants is used in `xaynet_core` and `xaynet_server`, and two in `xaynet_client`, so there is no point sharing that error type accross the crates. ### Remove the tracing machinery Removed `Request<T>` and the `Traceable` traits. These abstractions were too pervasive and made the code difficult to maintain. Moreover, out tracing implementation relied on `tower_tracing` which still hasn't been released. Removing all these abstractions does makes the code much more readable, and should make it easier to implement the multipart service. ### Flatten the service error type Many services were defined as follow: ```rust impl Service<MyReq> for MyType { type Response = Result<MyResp, MyError>; type Error = MyServiceError; type Future = MyFuture // .. } ``` The future returned by the service then resolved into a `Result<Result<MyResp, MyError>, MyServiceError>`. The idea was that the outer result would be for errors that are specific to the service machinery, while the inner result type would be for business logic only. There are several problems this approach. First it induces complexity and we quickly end up fighting the type checker when we start messing around with the services. Second, there's not always a clear distinction between what is business logic and what is a service implementation detail. Finally, that's a maintenance burden because it forces us to maintain several error types, and convert between them. Therefore, for message services, we unified the error type under `ServiceError`. Now services are defined as: ```rust impl Service<MyReq> for MyType { type Response = MyResp; type Error = MyError; type Future = MyFuture // .. } ``` ### Split out the decryption service Our work for supporting multipart messages led us to consider delegating the encryption layer to TLS at some point. Although there is no short term plan for that, moving the decryption logic into its own service lays the ground for this. Moreover, it allowed us to simplify our tests, because we can now test the message parsing services with non-encrypted messages
- Loading branch information
1 parent
97a64a9
commit 4d21b08
Showing
42 changed files
with
917 additions
and
1,262 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
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
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
Oops, something went wrong.