Set fetcher signer as worker member variables
antiphoton opened this issue · comments
Boxiao Cao commented
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>;
}
}