pub trait OrgControlsAccessor: Send + Sync {
// Required methods
fn load_org_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<OrgAiControlsConfig>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn check_budget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
estimated_tokens: u64,
) -> Pin<Box<dyn Future<Output = Result<BudgetCheckResult, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn check_rate_limit<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<RateLimitCheckResult, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
fn is_feature_enabled<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
feature: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
fn record_usage<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
user_id: Option<&'life3 str>,
feature: AiFeature,
tokens: u64,
cost_usd: f64,
metadata: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
}Expand description
Trait for accessing org controls from database
Required Methods§
Sourcefn load_org_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<OrgAiControlsConfig>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn load_org_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<Option<OrgAiControlsConfig>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Load org controls configuration
Sourcefn check_budget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
estimated_tokens: u64,
) -> Pin<Box<dyn Future<Output = Result<BudgetCheckResult, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn check_budget<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
estimated_tokens: u64,
) -> Pin<Box<dyn Future<Output = Result<BudgetCheckResult, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Check if budget allows the request
Sourcefn check_rate_limit<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<RateLimitCheckResult, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn check_rate_limit<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = Result<RateLimitCheckResult, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Check if rate limit allows the request
Sourcefn is_feature_enabled<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
feature: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn is_feature_enabled<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
feature: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Check if a feature is enabled
Sourcefn record_usage<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
user_id: Option<&'life3 str>,
feature: AiFeature,
tokens: u64,
cost_usd: f64,
metadata: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn record_usage<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
org_id: &'life1 str,
workspace_id: Option<&'life2 str>,
user_id: Option<&'life3 str>,
feature: AiFeature,
tokens: u64,
cost_usd: f64,
metadata: Option<Value>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Record usage for audit