pub struct NoOpUsageService;Expand description
No-op usage service for OSS / development. Always allows requests, never records anything.
Trait Implementations§
Source§impl Clone for NoOpUsageService
impl Clone for NoOpUsageService
Source§fn clone(&self) -> NoOpUsageService
fn clone(&self) -> NoOpUsageService
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 NoOpUsageService
impl Debug for NoOpUsageService
Source§impl UsageService for NoOpUsageService
impl UsageService for NoOpUsageService
Source§fn check_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_workspace_id: &'life1 str,
_user_id: &'life2 str,
_is_llm: bool,
_auth_source: &'life3 str,
) -> Pin<Box<dyn Future<Output = UsageCheckResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn check_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_workspace_id: &'life1 str,
_user_id: &'life2 str,
_is_llm: bool,
_auth_source: &'life3 str,
) -> Pin<Box<dyn Future<Output = UsageCheckResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Check whether a request should be allowed based on all rate limits.
Called by middleware before processing a request.
is_llm indicates whether this is an LLM-consuming endpoint.
auth_source is “jwt” or “api_key” for per-source analytics.Source§fn record_usage<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_workspace_id: &'life1 str,
_user_id: &'life2 str,
_tokens_used: i64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn record_usage<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_workspace_id: &'life1 str,
_user_id: &'life2 str,
_tokens_used: i64,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Record token usage after a completed agent run.
Source§fn get_usage<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_workspace_id: &'life1 str,
_user_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<UsageSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_usage<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_workspace_id: &'life1 str,
_user_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<UsageSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get current usage snapshot for display.
Source§fn get_limits<'life0, 'life1, 'async_trait>(
&'life0 self,
_workspace_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<UsageLimits>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_limits<'life0, 'life1, 'async_trait>(
&'life0 self,
_workspace_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<UsageLimits>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the configured limits for a workspace.
Auto Trait Implementations§
impl Freeze for NoOpUsageService
impl RefUnwindSafe for NoOpUsageService
impl Send for NoOpUsageService
impl Sync for NoOpUsageService
impl Unpin for NoOpUsageService
impl UnsafeUnpin for NoOpUsageService
impl UnwindSafe for NoOpUsageService
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