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(&self, domains: &[String], directory_url: &str) -> Result<Option<Vec<u8>>, Self::EC>;
13    async fn store_cert(&self, domains: &[String], directory_url: &str, cert: &[u8]) -> Result<(), Self::EC>;
14}
15
16#[async_trait]
17pub trait AccountCache: Send + Sync {
18    type EA: Debug;
19    async fn load_account(&self, contact: &[String], directory_url: &str) -> Result<Option<Vec<u8>>, Self::EA>;
20    async fn store_account(&self, contact: &[String], directory_url: &str, account: &[u8]) -> Result<(), Self::EA>;
21}