Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set fetcher signer as worker member variables #64

Open
antiphoton opened this issue Sep 16, 2021 · 0 comments
Open

Set fetcher signer as worker member variables #64

antiphoton opened this issue Sep 16, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@antiphoton
Copy link
Collaborator

Some SxgWorker functions take arguments of trait object Fetcher, Signer, (and HttpCache in #61). However, the implementations of these traits usually do not change during the lifetime of a worker. Hence we can move these trait objects into the SxgWorker member variables.

Changes would be like

  pub struct SxgWorker {
    ..
+   runtime: Runtime,
  }
+ pub struct Runtime {
+   signer: Mutex<dyn Signer>,
+   fetcher: Mutex<dyn Fetcher>,
+   cache: Mutex<dyn Cache>,
+ }

  impl SxgWorker {
-     pub async fn fetch_ocsp_from_ca<F: fetcher::Fetcher>(&self, fetcher: F) -> Vec<u8>;
+     pub async fn fetch_ocsp_from_ca(&self) -> Vec<u8>;
  }
}
@antiphoton antiphoton added the enhancement New feature or request label Sep 16, 2021
@antiphoton antiphoton self-assigned this Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant