pub struct AllocationManager { /* private fields */ }Expand description
Manages allocations for a supervisor.
Implementations§
Source§impl AllocationManager
impl AllocationManager
Sourcepub fn max_borrow(self, n: usize) -> Self
pub fn max_borrow(self, n: usize) -> Self
Set max borrow.
Sourcepub async fn record_lent(&self, grant: AllocationGrant)
pub async fn record_lent(&self, grant: AllocationGrant)
Record a grant where we are the lender.
Sourcepub async fn record_borrowed(&self, grant: AllocationGrant)
pub async fn record_borrowed(&self, grant: AllocationGrant)
Record a grant where we are the borrower.
Sourcepub async fn remove_grant(&self, lease_id: &str)
pub async fn remove_grant(&self, lease_id: &str)
Remove a grant.
Sourcepub async fn lent_count(&self) -> usize
pub async fn lent_count(&self) -> usize
Get count of lent executors.
Sourcepub async fn borrowed_count(&self) -> usize
pub async fn borrowed_count(&self) -> usize
Get count of borrowed executors.
Sourcepub async fn can_borrow(&self, count: usize) -> bool
pub async fn can_borrow(&self, count: usize) -> bool
Can we borrow more?
Sourcepub async fn get_expired_grants(&self) -> Vec<AllocationGrant>
pub async fn get_expired_grants(&self) -> Vec<AllocationGrant>
Get expired grants.
Sourcepub async fn cleanup_expired(&self) -> Vec<String>
pub async fn cleanup_expired(&self) -> Vec<String>
Clean up expired grants.
Sourcepub async fn borrowed_executor_ids(&self) -> Vec<String>
pub async fn borrowed_executor_ids(&self) -> Vec<String>
Get all borrowed executor IDs.
Sourcepub async fn lent_executor_ids(&self) -> Vec<String>
pub async fn lent_executor_ids(&self) -> Vec<String>
Get all lent executor IDs.
Sourcepub fn create_offer(
&self,
request: &AllocationRequest,
executor_ids: Vec<String>,
) -> AllocationOffer
pub fn create_offer( &self, request: &AllocationRequest, executor_ids: Vec<String>, ) -> AllocationOffer
Create an offer for a request. Used by supervisors to respond to allocation requests.
Sourcepub fn create_release(
lease_id: impl Into<String>,
reason: ReleaseReason,
) -> AllocationRelease
pub fn create_release( lease_id: impl Into<String>, reason: ReleaseReason, ) -> AllocationRelease
Create a release notification when returning executors.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AllocationManager
impl !RefUnwindSafe for AllocationManager
impl Send for AllocationManager
impl Sync for AllocationManager
impl Unpin for AllocationManager
impl UnsafeUnpin for AllocationManager
impl !UnwindSafe for AllocationManager
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