mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
feat: store pow performance statistics against statistics
This commit is contained in:
@@ -250,6 +250,30 @@ pub trait MCDatabase: std::marker::Send + std::marker::Sync + CloneSPDatabase {
|
||||
|
||||
/// fetch PoWConfig confirms
|
||||
async fn fetch_confirm(&self, user: &str, key: &str) -> DBResult<Vec<i64>>;
|
||||
|
||||
/// record PoW timing
|
||||
async fn analysis_save(
|
||||
&self,
|
||||
captcha_id: &str,
|
||||
d: &PerformanceAnalytics,
|
||||
) -> DBResult<()>;
|
||||
|
||||
/// fetch PoW analytics
|
||||
async fn analytics_fetch(
|
||||
&self,
|
||||
captcha_id: &str,
|
||||
) -> DBResult<Vec<PerformanceAnalytics>>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq)]
|
||||
/// Proof-of-Work CAPTCHA performance analytics
|
||||
pub struct PerformanceAnalytics {
|
||||
/// time taken to generate proof
|
||||
pub time: u32,
|
||||
/// difficulty factor for which the proof was generated
|
||||
pub difficulty_factor: u32,
|
||||
/// worker/client type: wasm, javascript, python, etc.
|
||||
pub worker_type: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq)]
|
||||
|
||||
Reference in New Issue
Block a user