RecorderDatabase

Struct RecorderDatabase 

Source
pub struct RecorderDatabase { /* private fields */ }
Expand description

SQLite database for recorder

Implementations§

Source§

impl RecorderDatabase

Source

pub async fn new<P: AsRef<Path>>(path: P) -> Result<Self>

Create a new database connection

Source

pub async fn new_in_memory() -> Result<Self>

Create an in-memory database (for testing)

Source

pub async fn insert_request(&self, request: &RecordedRequest) -> Result<()>

Insert a new request

Source

pub async fn insert_response(&self, response: &RecordedResponse) -> Result<()>

Insert a response

Source

pub async fn get_request(&self, id: &str) -> Result<Option<RecordedRequest>>

Get a request by ID

Source

pub async fn get_response( &self, request_id: &str, ) -> Result<Option<RecordedResponse>>

Get a response by request ID

Source

pub async fn get_exchange(&self, id: &str) -> Result<Option<RecordedExchange>>

Get an exchange (request + response) by request ID

Source

pub async fn update_response( &self, request_id: &str, status_code: i32, headers: &str, body: &str, size_bytes: i64, ) -> Result<()>

Update an existing response

Source

pub async fn list_recent(&self, limit: i32) -> Result<Vec<RecordedRequest>>

List recent requests

Source

pub async fn delete_older_than(&self, days: i64) -> Result<u64>

Delete old requests

Source

pub async fn get_stats(&self) -> Result<DatabaseStats>

Get database statistics

Source

pub async fn get_statistics(&self) -> Result<DetailedStats>

Get detailed statistics for API

Source

pub async fn clear_all(&self) -> Result<()>

Clear all recordings

Source

pub async fn close(self)

Close the database connection

Source

pub async fn insert_sync_snapshot(&self, snapshot: &SyncSnapshot) -> Result<()>

Insert a sync snapshot

Source

pub async fn get_snapshots_for_endpoint( &self, endpoint: &str, method: Option<&str>, limit: Option<i32>, ) -> Result<Vec<SyncSnapshot>>

Get snapshots for an endpoint

Source

pub async fn get_snapshots_by_cycle( &self, sync_cycle_id: &str, ) -> Result<Vec<SyncSnapshot>>

Get snapshots by sync cycle ID

Source

pub async fn delete_old_snapshots(&self, keep_per_endpoint: i32) -> Result<u64>

Delete old snapshots (retention policy)

Source

pub async fn insert_behavioral_sequence( &self, sequence: &BehavioralSequence, ) -> Result<()>

Insert a behavioral sequence

Source

pub async fn get_behavioral_sequences(&self) -> Result<Vec<BehavioralSequence>>

Get all behavioral sequences

Source

pub async fn insert_endpoint_probability_model( &self, model: &EndpointProbabilityModel, ) -> Result<()>

Insert or update endpoint probability model

Source

pub async fn get_endpoint_probability_model( &self, endpoint: &str, method: &str, ) -> Result<Option<EndpointProbabilityModel>>

Get endpoint probability model

Source

pub async fn get_all_endpoint_probability_models( &self, ) -> Result<Vec<EndpointProbabilityModel>>

Get all endpoint probability models

Source

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

Source

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.

Source

pub async fn create_flow( &self, flow_id: &str, name: Option<&str>, description: Option<&str>, tags: &[String], ) -> Result<()>

Create a new flow

Source

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

Source

pub async fn get_flow_step_count(&self, flow_id: &str) -> Result<usize>

Get the number of steps in a flow

Source

pub async fn get_flow_steps(&self, flow_id: &str) -> Result<Vec<FlowStepRow>>

Get flow steps

Source

pub async fn get_flow_metadata( &self, flow_id: &str, ) -> Result<Option<FlowMetadataRow>>

Get flow metadata

Source

pub async fn list_flows( &self, limit: Option<i64>, ) -> Result<Vec<FlowMetadataRow>>

List flows

Source

pub async fn update_flow_metadata( &self, flow_id: &str, name: Option<&str>, description: Option<&str>, tags: Option<&[String]>, ) -> Result<()>

Update flow metadata

Source

pub async fn delete_flow(&self, flow_id: &str) -> Result<()>

Delete a flow

Source

pub async fn store_scenario( &self, scenario: &BehavioralScenario, version: &str, ) -> Result<()>

Store a behavioral scenario

Source

pub async fn get_scenario( &self, scenario_id: &str, ) -> Result<Option<BehavioralScenario>>

Get a scenario by ID

Source

pub async fn get_scenario_by_name_version( &self, name: &str, version: &str, ) -> Result<Option<BehavioralScenario>>

Get a scenario by name and version

Source

pub async fn list_scenarios( &self, limit: Option<i64>, ) -> Result<Vec<ScenarioMetadataRow>>

List all scenarios

Source

pub async fn delete_scenario(&self, scenario_id: &str) -> Result<()>

Delete a scenario

Trait Implementations§

Source§

impl Clone for RecorderDatabase

Source§

fn clone(&self) -> RecorderDatabase

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: Rng + ?Sized, Self: FakeBase<U>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ParallelSend for T