pub struct ConcurrencyController { /* private fields */ }Expand description
Concurrency controller with fairness policies.
Implementations§
Source§impl ConcurrencyController
impl ConcurrencyController
Sourcepub fn new(
global_max: usize,
quotas: ModeQuotas,
fairness: FairnessPolicy,
) -> Self
pub fn new( global_max: usize, quotas: ModeQuotas, fairness: FairnessPolicy, ) -> Self
Create a new concurrency controller with no per-project caps.
Sourcepub fn with_project_caps(
global_max: usize,
quotas: ModeQuotas,
fairness: FairnessPolicy,
project_caps: HashMap<String, ProjectCaps>,
) -> Self
pub fn with_project_caps( global_max: usize, quotas: ModeQuotas, fairness: FairnessPolicy, project_caps: HashMap<String, ProjectCaps>, ) -> Self
Create a new concurrency controller with explicit per-project caps.
Sourcepub async fn acquire_time_driven(&self, project: &str) -> Option<AgentPermit>
pub async fn acquire_time_driven(&self, project: &str) -> Option<AgentPermit>
Try to acquire a slot for a time-driven agent in the given project.
Sourcepub async fn acquire_issue_driven(&self, project: &str) -> Option<AgentPermit>
pub async fn acquire_issue_driven(&self, project: &str) -> Option<AgentPermit>
Try to acquire a slot for an issue-driven agent in the given project.
Sourcepub async fn acquire_mention_driven(&self, project: &str) -> Option<AgentPermit>
pub async fn acquire_mention_driven(&self, project: &str) -> Option<AgentPermit>
Try to acquire a slot for a mention-driven agent in the given project.
Sourcepub async fn acquire_any(&self, project: &str) -> Option<AgentPermit>
pub async fn acquire_any(&self, project: &str) -> Option<AgentPermit>
Try to acquire a generic slot without mode-specific quota checks.
Only enforces the global semaphore and per-project caps. Used when the
caller does not know the agent mode (e.g. spawn_agent is shared across
cron, mention, and issue-driven paths).
Sourcepub async fn running_counts(&self) -> (usize, usize)
pub async fn running_counts(&self) -> (usize, usize)
Get current running counts (time_driven, issue_driven).
Sourcepub async fn project_running_count(&self, project: &str) -> usize
pub async fn project_running_count(&self, project: &str) -> usize
Get the running count for a specific project.
Sourcepub fn available_slots(&self) -> usize
pub fn available_slots(&self) -> usize
Get available slots.
Sourcepub fn fairness_policy(&self) -> FairnessPolicy
pub fn fairness_policy(&self) -> FairnessPolicy
Get the active fairness policy.
Trait Implementations§
Source§impl Clone for ConcurrencyController
impl Clone for ConcurrencyController
Source§fn clone(&self) -> ConcurrencyController
fn clone(&self) -> ConcurrencyController
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ConcurrencyController
impl !RefUnwindSafe for ConcurrencyController
impl Send for ConcurrencyController
impl Sync for ConcurrencyController
impl Unpin for ConcurrencyController
impl UnsafeUnpin for ConcurrencyController
impl !UnwindSafe for ConcurrencyController
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
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>
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>
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