tokio_rustls_acme/
cache.rs

1use std::fmt::Debug;
2
3use async_trait::async_trait;
4
5pub trait Cache: CertCache + AccountCache {}
6
7impl<T> Cache for T where T: CertCache + AccountCache {}
8
9#[async_trait]
10pub trait CertCache: Send + Sync {
11    type EC: Debug;
12    async fn load_cert(
13        &self,
14        domains: &[String],
15        directory_url: &str,
16    ) -> Result<Option<Vec<u8>>, Self::EC>;
17    async fn store_cert(
18        &self,
19        domains: &[String],
20        directory_url: &str,
21        cert: &[u8],
22    ) -> Result<(), Self::EC>;
23}
24
25#[async_trait]
26pub trait AccountCache: Send + Sync {
27    type EA: Debug;
28    async fn load_account(
29        &self,
30        contact: &[String],
31        directory_url: &str,
32    ) -> Result<Option<Vec<u8>>, Self::EA>;
33    async fn store_account(
34        &self,
35        contact: &[String],
36        directory_url: &str,
37        account: &[u8],
38    ) -> Result<(), Self::EA>;
39}