pub struct RecorderDatabase { /* private fields */ }Expand description
SQLite database for recorder
Implementations§
Source§impl RecorderDatabase
impl RecorderDatabase
Sourcepub async fn new_in_memory() -> Result<Self>
pub async fn new_in_memory() -> Result<Self>
Create an in-memory database (for testing)
Sourcepub async fn insert_request(&self, request: &RecordedRequest) -> Result<()>
pub async fn insert_request(&self, request: &RecordedRequest) -> Result<()>
Insert a new request
Sourcepub async fn insert_response(&self, response: &RecordedResponse) -> Result<()>
pub async fn insert_response(&self, response: &RecordedResponse) -> Result<()>
Insert a response
Sourcepub async fn get_request(&self, id: &str) -> Result<Option<RecordedRequest>>
pub async fn get_request(&self, id: &str) -> Result<Option<RecordedRequest>>
Get a request by ID
Sourcepub async fn get_response(
&self,
request_id: &str,
) -> Result<Option<RecordedResponse>>
pub async fn get_response( &self, request_id: &str, ) -> Result<Option<RecordedResponse>>
Get a response by request ID
Sourcepub async fn get_exchange(&self, id: &str) -> Result<Option<RecordedExchange>>
pub async fn get_exchange(&self, id: &str) -> Result<Option<RecordedExchange>>
Get an exchange (request + response) by request ID
Sourcepub async fn update_response(
&self,
request_id: &str,
status_code: i32,
headers: &str,
body: &str,
size_bytes: i64,
) -> Result<()>
pub async fn update_response( &self, request_id: &str, status_code: i32, headers: &str, body: &str, size_bytes: i64, ) -> Result<()>
Update an existing response
Sourcepub async fn list_recent(&self, limit: i32) -> Result<Vec<RecordedRequest>>
pub async fn list_recent(&self, limit: i32) -> Result<Vec<RecordedRequest>>
List recent requests
Sourcepub async fn delete_older_than(&self, days: i64) -> Result<u64>
pub async fn delete_older_than(&self, days: i64) -> Result<u64>
Delete old requests
Sourcepub async fn get_stats(&self) -> Result<DatabaseStats>
pub async fn get_stats(&self) -> Result<DatabaseStats>
Get database statistics
Sourcepub async fn get_statistics(&self) -> Result<DetailedStats>
pub async fn get_statistics(&self) -> Result<DetailedStats>
Get detailed statistics for API
Sourcepub async fn insert_sync_snapshot(&self, snapshot: &SyncSnapshot) -> Result<()>
pub async fn insert_sync_snapshot(&self, snapshot: &SyncSnapshot) -> Result<()>
Insert a sync snapshot
Sourcepub async fn get_snapshots_for_endpoint(
&self,
endpoint: &str,
method: Option<&str>,
limit: Option<i32>,
) -> Result<Vec<SyncSnapshot>>
pub async fn get_snapshots_for_endpoint( &self, endpoint: &str, method: Option<&str>, limit: Option<i32>, ) -> Result<Vec<SyncSnapshot>>
Get snapshots for an endpoint
Sourcepub async fn get_snapshots_by_cycle(
&self,
sync_cycle_id: &str,
) -> Result<Vec<SyncSnapshot>>
pub async fn get_snapshots_by_cycle( &self, sync_cycle_id: &str, ) -> Result<Vec<SyncSnapshot>>
Get snapshots by sync cycle ID
Sourcepub async fn delete_old_snapshots(&self, keep_per_endpoint: i32) -> Result<u64>
pub async fn delete_old_snapshots(&self, keep_per_endpoint: i32) -> Result<u64>
Delete old snapshots (retention policy)
Sourcepub async fn insert_behavioral_sequence(
&self,
sequence: &BehavioralSequence,
) -> Result<()>
pub async fn insert_behavioral_sequence( &self, sequence: &BehavioralSequence, ) -> Result<()>
Insert a behavioral sequence
Sourcepub async fn get_behavioral_sequences(&self) -> Result<Vec<BehavioralSequence>>
pub async fn get_behavioral_sequences(&self) -> Result<Vec<BehavioralSequence>>
Get all behavioral sequences
Sourcepub async fn insert_endpoint_probability_model(
&self,
model: &EndpointProbabilityModel,
) -> Result<()>
pub async fn insert_endpoint_probability_model( &self, model: &EndpointProbabilityModel, ) -> Result<()>
Insert or update endpoint probability model
Sourcepub async fn get_endpoint_probability_model(
&self,
endpoint: &str,
method: &str,
) -> Result<Option<EndpointProbabilityModel>>
pub async fn get_endpoint_probability_model( &self, endpoint: &str, method: &str, ) -> Result<Option<EndpointProbabilityModel>>
Get endpoint probability model
Sourcepub async fn get_all_endpoint_probability_models(
&self,
) -> Result<Vec<EndpointProbabilityModel>>
pub async fn get_all_endpoint_probability_models( &self, ) -> Result<Vec<EndpointProbabilityModel>>
Get all endpoint probability models
Sourcepub async fn get_requests_by_trace(
&self,
min_requests_per_trace: Option<i32>,
) -> Result<Vec<(String, Vec<RecordedRequest>)>>
pub async fn get_requests_by_trace( &self, min_requests_per_trace: Option<i32>, ) -> Result<Vec<(String, Vec<RecordedRequest>)>>
Get requests grouped by trace_id for sequence learning
Sourcepub async fn get_exchanges_for_endpoint(
&self,
endpoint: &str,
method: &str,
limit: Option<i32>,
) -> Result<Vec<(RecordedRequest, Option<RecordedResponse>)>>
pub async fn get_exchanges_for_endpoint( &self, endpoint: &str, method: &str, limit: Option<i32>, ) -> Result<Vec<(RecordedRequest, Option<RecordedResponse>)>>
Get requests and responses for a specific endpoint and method
Returns a list of (request, response) pairs for building probability models.
Sourcepub async fn create_flow(
&self,
flow_id: &str,
name: Option<&str>,
description: Option<&str>,
tags: &[String],
) -> Result<()>
pub async fn create_flow( &self, flow_id: &str, name: Option<&str>, description: Option<&str>, tags: &[String], ) -> Result<()>
Create a new flow
Sourcepub async fn add_flow_step(
&self,
flow_id: &str,
request_id: &str,
step_index: usize,
step_label: Option<&str>,
timing_ms: Option<u64>,
) -> Result<()>
pub async fn add_flow_step( &self, flow_id: &str, request_id: &str, step_index: usize, step_label: Option<&str>, timing_ms: Option<u64>, ) -> Result<()>
Add a step to a flow
Sourcepub async fn get_flow_step_count(&self, flow_id: &str) -> Result<usize>
pub async fn get_flow_step_count(&self, flow_id: &str) -> Result<usize>
Get the number of steps in a flow
Sourcepub async fn get_flow_steps(&self, flow_id: &str) -> Result<Vec<FlowStepRow>>
pub async fn get_flow_steps(&self, flow_id: &str) -> Result<Vec<FlowStepRow>>
Get flow steps
Sourcepub async fn get_flow_metadata(
&self,
flow_id: &str,
) -> Result<Option<FlowMetadataRow>>
pub async fn get_flow_metadata( &self, flow_id: &str, ) -> Result<Option<FlowMetadataRow>>
Get flow metadata
Sourcepub async fn list_flows(
&self,
limit: Option<i64>,
) -> Result<Vec<FlowMetadataRow>>
pub async fn list_flows( &self, limit: Option<i64>, ) -> Result<Vec<FlowMetadataRow>>
List flows
Sourcepub async fn update_flow_metadata(
&self,
flow_id: &str,
name: Option<&str>,
description: Option<&str>,
tags: Option<&[String]>,
) -> Result<()>
pub async fn update_flow_metadata( &self, flow_id: &str, name: Option<&str>, description: Option<&str>, tags: Option<&[String]>, ) -> Result<()>
Update flow metadata
Sourcepub async fn delete_flow(&self, flow_id: &str) -> Result<()>
pub async fn delete_flow(&self, flow_id: &str) -> Result<()>
Delete a flow
Sourcepub async fn store_scenario(
&self,
scenario: &BehavioralScenario,
version: &str,
) -> Result<()>
pub async fn store_scenario( &self, scenario: &BehavioralScenario, version: &str, ) -> Result<()>
Store a behavioral scenario
Sourcepub async fn get_scenario(
&self,
scenario_id: &str,
) -> Result<Option<BehavioralScenario>>
pub async fn get_scenario( &self, scenario_id: &str, ) -> Result<Option<BehavioralScenario>>
Get a scenario by ID
Sourcepub async fn get_scenario_by_name_version(
&self,
name: &str,
version: &str,
) -> Result<Option<BehavioralScenario>>
pub async fn get_scenario_by_name_version( &self, name: &str, version: &str, ) -> Result<Option<BehavioralScenario>>
Get a scenario by name and version
Sourcepub async fn list_scenarios(
&self,
limit: Option<i64>,
) -> Result<Vec<ScenarioMetadataRow>>
pub async fn list_scenarios( &self, limit: Option<i64>, ) -> Result<Vec<ScenarioMetadataRow>>
List all scenarios
Sourcepub async fn delete_scenario(&self, scenario_id: &str) -> Result<()>
pub async fn delete_scenario(&self, scenario_id: &str) -> Result<()>
Delete a scenario
Trait Implementations§
Source§impl Clone for RecorderDatabase
impl Clone for RecorderDatabase
Source§fn clone(&self) -> RecorderDatabase
fn clone(&self) -> RecorderDatabase
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RecorderDatabase
impl !RefUnwindSafe for RecorderDatabase
impl Send for RecorderDatabase
impl Sync for RecorderDatabase
impl Unpin for RecorderDatabase
impl !UnwindSafe for RecorderDatabase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more