use super::{BehavioralSequence, EndpointProbabilityModel};
use async_trait::async_trait;
use chrono::{DateTime, Utc};
#[derive(Clone, Debug)]
pub struct CloningRecordedRequest {
pub timestamp: DateTime<Utc>,
pub method: String,
pub path: String,
pub body: Option<String>,
pub duration_ms: Option<i64>,
pub status_code: Option<i32>,
}
#[derive(Clone, Debug)]
pub struct CloningRecordedResponse {
pub status_code: i32,
pub body: Option<String>,
}
#[async_trait]
pub trait BehavioralCloningStore: Send + Sync {
async fn get_exchanges_for_endpoint(
&self,
endpoint: &str,
method: &str,
limit: Option<i32>,
) -> Result<Vec<(CloningRecordedRequest, Option<CloningRecordedResponse>)>, String>;
async fn get_requests_by_trace(
&self,
min: Option<i32>,
) -> Result<Vec<(String, Vec<CloningRecordedRequest>)>, String>;
async fn insert_endpoint_probability_model(
&self,
model: &EndpointProbabilityModel,
) -> Result<(), String>;
async fn get_endpoint_probability_model(
&self,
endpoint: &str,
method: &str,
) -> Result<Option<EndpointProbabilityModel>, String>;
async fn get_all_endpoint_probability_models(
&self,
) -> Result<Vec<EndpointProbabilityModel>, String>;
async fn insert_behavioral_sequence(&self, sequence: &BehavioralSequence)
-> Result<(), String>;
async fn get_behavioral_sequences(&self) -> Result<Vec<BehavioralSequence>, String>;
}
#[async_trait]
pub trait BehavioralCloningStateProvider: Clone + Send + Sync + 'static {
type Store: BehavioralCloningStore;
async fn open_store(&self) -> Result<Self::Store, String>;
}