pub struct OrgControls { /* private fields */ }Expand description
Organization controls service
Manages org-level AI controls with YAML defaults and DB authoritative overrides. DB values override YAML defaults when both are present.
Implementations§
Source§impl OrgControls
impl OrgControls
Sourcepub fn new(yaml_config: OrgAiControlsConfig) -> Self
pub fn new(yaml_config: OrgAiControlsConfig) -> Self
Create a new org controls service with YAML defaults only
Sourcepub fn with_db_accessor(
yaml_config: OrgAiControlsConfig,
db_accessor: Box<dyn OrgControlsAccessor>,
) -> Self
pub fn with_db_accessor( yaml_config: OrgAiControlsConfig, db_accessor: Box<dyn OrgControlsAccessor>, ) -> Self
Create a new org controls service with YAML defaults and DB accessor
Sourcepub async fn load_org_config(
&self,
org_id: &str,
workspace_id: Option<&str>,
) -> Result<OrgAiControlsConfig>
pub async fn load_org_config( &self, org_id: &str, workspace_id: Option<&str>, ) -> Result<OrgAiControlsConfig>
Load org configuration (DB overrides YAML)
Sourcepub async fn check_budget(
&self,
org_id: &str,
workspace_id: Option<&str>,
estimated_tokens: u64,
) -> Result<BudgetCheckResult>
pub async fn check_budget( &self, org_id: &str, workspace_id: Option<&str>, estimated_tokens: u64, ) -> Result<BudgetCheckResult>
Check if budget allows the request
Sourcepub async fn check_rate_limit(
&self,
org_id: &str,
workspace_id: Option<&str>,
) -> Result<RateLimitCheckResult>
pub async fn check_rate_limit( &self, org_id: &str, workspace_id: Option<&str>, ) -> Result<RateLimitCheckResult>
Check if rate limit allows the request
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OrgControls
impl !RefUnwindSafe for OrgControls
impl Send for OrgControls
impl Sync for OrgControls
impl Unpin for OrgControls
impl UnsafeUnpin for OrgControls
impl !UnwindSafe for OrgControls
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