pub trait Storage: Send {
Show 26 methods
// Required methods
fn kind(&self) -> &str;
fn ping(&mut self) -> Result<bool>;
fn ensure_schema(&mut self) -> Result<()>;
fn upsert_scan_run(&mut self, run: &ScanRun) -> Result<()>;
fn get_scan_run(&mut self, run_id: &str) -> Result<Option<ScanRun>>;
fn list_scan_runs(&mut self) -> Result<Vec<ScanRun>>;
fn delete_scan_run(&mut self, run_id: &str) -> Result<()>;
fn upsert_asset(&mut self, asset: &Asset) -> Result<()>;
fn get_asset(&mut self, asset_id: &str) -> Result<Option<Asset>>;
fn list_assets(&mut self) -> Result<Vec<Asset>>;
fn upsert_service(&mut self, service: &Service) -> Result<()>;
fn get_service(&mut self, service_id: &str) -> Result<Option<Service>>;
fn list_services_for_asset(
&mut self,
asset_id: &str,
) -> Result<Vec<Service>>;
fn list_all_services(&mut self) -> Result<Vec<Service>>;
fn upsert_finding(&mut self, finding: &Finding) -> Result<()>;
fn get_finding(&mut self, finding_id: &str) -> Result<Option<Finding>>;
fn list_findings_for_asset(
&mut self,
asset_id: &str,
) -> Result<Vec<Finding>>;
fn list_all_findings(&mut self) -> Result<Vec<Finding>>;
fn add_observation(&mut self, observation: &Observation) -> Result<()>;
fn get_observation(&mut self, obs_id: &str) -> Result<Option<Observation>>;
fn list_observations_for(
&mut self,
subject_type: &str,
subject_id: &str,
) -> Result<Vec<Observation>>;
fn list_all_observations(&mut self) -> Result<Vec<Observation>>;
fn upsert_exploit_execution(
&mut self,
execution: &ExploitExecution,
) -> Result<()>;
fn get_exploit_execution(
&mut self,
execution_id: &str,
) -> Result<Option<ExploitExecution>>;
fn list_exploit_executions(&mut self) -> Result<Vec<ExploitExecution>>;
fn list_exploit_executions_for_run(
&mut self,
run_id: &str,
) -> Result<Vec<ExploitExecution>>;
}Expand description
Backend-agnostic persistence interface used by the importer.
All write operations are upserts keyed by a stable, content-derived id so
that re-running an import over the same scan folder is idempotent. History
is preserved through the Observations collection rather than by
overwriting prior rows.
Required Methods§
fn kind(&self) -> &str
Sourcefn ping(&mut self) -> Result<bool>
fn ping(&mut self) -> Result<bool>
Verify connectivity (PocketBase health / SQLite open + query).
Sourcefn ensure_schema(&mut self) -> Result<()>
fn ensure_schema(&mut self) -> Result<()>
Create all required collections/tables if they do not exist.
fn upsert_scan_run(&mut self, run: &ScanRun) -> Result<()>
fn get_scan_run(&mut self, run_id: &str) -> Result<Option<ScanRun>>
fn list_scan_runs(&mut self) -> Result<Vec<ScanRun>>
Sourcefn delete_scan_run(&mut self, run_id: &str) -> Result<()>
fn delete_scan_run(&mut self, run_id: &str) -> Result<()>
Delete a scan run and the records owned by it (observations and exploit executions). Assets, services and findings are shared across runs and are left untouched.
fn upsert_asset(&mut self, asset: &Asset) -> Result<()>
fn get_asset(&mut self, asset_id: &str) -> Result<Option<Asset>>
fn list_assets(&mut self) -> Result<Vec<Asset>>
fn upsert_service(&mut self, service: &Service) -> Result<()>
fn get_service(&mut self, service_id: &str) -> Result<Option<Service>>
fn list_services_for_asset(&mut self, asset_id: &str) -> Result<Vec<Service>>
fn list_all_services(&mut self) -> Result<Vec<Service>>
fn upsert_finding(&mut self, finding: &Finding) -> Result<()>
fn get_finding(&mut self, finding_id: &str) -> Result<Option<Finding>>
fn list_findings_for_asset(&mut self, asset_id: &str) -> Result<Vec<Finding>>
fn list_all_findings(&mut self) -> Result<Vec<Finding>>
fn add_observation(&mut self, observation: &Observation) -> Result<()>
fn get_observation(&mut self, obs_id: &str) -> Result<Option<Observation>>
fn list_observations_for( &mut self, subject_type: &str, subject_id: &str, ) -> Result<Vec<Observation>>
fn list_all_observations(&mut self) -> Result<Vec<Observation>>
fn upsert_exploit_execution( &mut self, execution: &ExploitExecution, ) -> Result<()>
fn get_exploit_execution( &mut self, execution_id: &str, ) -> Result<Option<ExploitExecution>>
fn list_exploit_executions(&mut self) -> Result<Vec<ExploitExecution>>
fn list_exploit_executions_for_run( &mut self, run_id: &str, ) -> Result<Vec<ExploitExecution>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".