pub struct SessionRepository { /* private fields */ }Implementations§
Source§impl SessionRepository
impl SessionRepository
pub const fn new(pool: DbPool) -> Self
pub async fn find_by_id( &self, session_id: &SessionId, ) -> Result<Option<AnalyticsSession>>
pub async fn find_by_fingerprint( &self, fingerprint_hash: &str, user_id: &UserId, ) -> Result<Option<AnalyticsSession>>
pub async fn list_active_by_user( &self, user_id: &UserId, ) -> Result<Vec<AnalyticsSession>>
pub async fn update_activity(&self, session_id: &SessionId) -> Result<()>
pub async fn increment_request_count( &self, session_id: &SessionId, ) -> Result<()>
pub async fn increment_task_count(&self, session_id: &SessionId) -> Result<()>
pub async fn increment_ai_request_count( &self, session_id: &SessionId, ) -> Result<()>
pub async fn increment_message_count( &self, session_id: &SessionId, ) -> Result<()>
pub async fn end_session(&self, session_id: &SessionId) -> Result<()>
pub async fn mark_as_scanner(&self, session_id: &SessionId) -> Result<()>
pub async fn mark_as_behavioral_bot( &self, session_id: &SessionId, reason: &str, ) -> Result<()>
pub async fn check_and_mark_behavioral_bot( &self, session_id: &SessionId, request_count_threshold: i32, ) -> Result<bool>
pub async fn cleanup_inactive(&self, inactive_hours: i32) -> Result<u64>
pub async fn migrate_user_sessions( &self, old_user_id: &UserId, new_user_id: &UserId, ) -> Result<u64>
pub async fn create_session( &self, params: &CreateSessionParams<'_>, ) -> Result<()>
pub async fn find_recent_by_fingerprint( &self, fingerprint_hash: &str, max_age_seconds: i64, ) -> Result<Option<SessionRecord>>
pub async fn exists(&self, session_id: &SessionId) -> Result<bool>
pub async fn increment_ai_usage( &self, session_id: &SessionId, tokens: i32, cost_cents: i32, ) -> Result<()>
pub async fn update_behavioral_detection( &self, session_id: &SessionId, score: i32, is_behavioral_bot: bool, reason: Option<&str>, ) -> Result<()>
pub async fn escalate_throttle( &self, session_id: &SessionId, new_level: i32, ) -> Result<()>
pub async fn get_throttle_level(&self, session_id: &SessionId) -> Result<i32>
pub async fn count_sessions_by_fingerprint( &self, fingerprint_hash: &str, window_hours: i64, ) -> Result<i64>
pub async fn get_endpoint_sequence( &self, session_id: &SessionId, ) -> Result<Vec<String>>
pub async fn get_request_timestamps( &self, session_id: &SessionId, ) -> Result<Vec<DateTime<Utc>>>
pub async fn get_total_content_pages(&self) -> Result<i64>
pub async fn get_session_for_behavioral_analysis( &self, session_id: &SessionId, ) -> Result<Option<SessionBehavioralData>>
pub async fn has_analytics_events(&self, session_id: &SessionId) -> Result<bool>
pub async fn get_session_velocity( &self, session_id: &SessionId, ) -> Result<(Option<i64>, Option<i64>)>
Trait Implementations§
Source§impl Clone for SessionRepository
impl Clone for SessionRepository
Source§fn clone(&self) -> SessionRepository
fn clone(&self) -> SessionRepository
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionRepository
impl Debug for SessionRepository
Source§impl SessionAnalyticsProvider for SessionRepository
impl SessionAnalyticsProvider for SessionRepository
fn increment_task_count<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = SessionAnalyticsResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn increment_message_count<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = SessionAnalyticsResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for SessionRepository
impl !RefUnwindSafe for SessionRepository
impl Send for SessionRepository
impl Sync for SessionRepository
impl Unpin for SessionRepository
impl !UnwindSafe for SessionRepository
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
Mutably borrows from an owned value. Read more
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>
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 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>
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