From 4be7a66d03875f0f07082f7a34c5453434de7eeb Mon Sep 17 00:00:00 2001
From: Awiteb
Date: Sat, 10 Aug 2024 15:53:06 +0000
Subject: [PATCH] refactor: Move the `CacacheStorage` to another module
Signed-off-by: Awiteb
---
.../cacache_storage.rs} | 81 +----------------
src/storage/mod.rs | 90 +++++++++++++++++++
2 files changed, 92 insertions(+), 79 deletions(-)
rename src/{storage.rs => storage/cacache_storage.rs} (78%)
create mode 100644 src/storage/mod.rs
diff --git a/src/storage.rs b/src/storage/cacache_storage.rs
similarity index 78%
rename from src/storage.rs
rename to src/storage/cacache_storage.rs
index 6043ddb..42b440a 100644
--- a/src/storage.rs
+++ b/src/storage/cacache_storage.rs
@@ -9,62 +9,22 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-use std::{sync::Arc, time::Duration};
-
-#[cfg(feature = "cacache-storage")]
use std::{
path::{Path, PathBuf},
- time::SystemTime,
+ time::{Duration, SystemTime},
};
-/// Trait to store the captcha token and answer. is also clear the expired captcha.
-///
-/// The trait will be implemented for `Arc` if `T` implements the trait.
-///
-/// The trait is thread safe, so the storage can be shared between threads.
-pub trait CaptchaStorage: Send + Sync + 'static
-where
- Self: Clone + std::fmt::Debug,
-{
- /// The error type of the storage.
- type Error: std::fmt::Display + std::fmt::Debug + Send;
-
- /// Store the captcha token and answer.
- fn store_answer(
- &self,
- answer: String,
- ) -> impl std::future::Future