struct Reclaiming {
heap: BinaryHeap<Reverse<(Age, AId)>>,
enabled: EnabledToken,
}
Expand description
State while reclamation is active
Fields§
§heap: BinaryHeap<Reverse<(Age, AId)>>
The heap of candidates, oldest at top of heap
enabled: EnabledToken
Make this type uninhabited if memory tracking is compiled out
Implementations§
Source§impl Reclaiming
impl Reclaiming
Sourcefn maybe_start(state: &mut GuardWithDeferredDrop<'_>) -> Option<Self>
fn maybe_start(state: &mut GuardWithDeferredDrop<'_>) -> Option<Self>
Check to see if we should start reclaiming, and if so return a Reclaiming
- Checks to see if usage is above
max
; if not, returnsNone
- Logs that we’re starting reclamation
- Calculates the heap of data ages
Sourcefn choose_victims(
&mut self,
state: &mut State,
) -> Result<Option<Vec<(AId, ProtectedArc<dyn IsParticipant>)>>, ReclaimCrashed>
fn choose_victims( &mut self, state: &mut State, ) -> Result<Option<Vec<(AId, ProtectedArc<dyn IsParticipant>)>>, ReclaimCrashed>
If we’re reclaiming, choose the next victim(s) to reclaim
This is the account whose participant has the oldest data age, and all of that account’s children.
We might discover that we didn’t want to continue reclamation after all: this function is responsible for checking our progress against the low water mark.
If reclamation should stop, this function logs, and returns None
.
Sourceasync fn notify_victims(
&mut self,
victims: Vec<(AId, ProtectedArc<dyn IsParticipant>)>,
) -> Vec<(AId, Result<Reclaimed, VictimPanicked>)>
async fn notify_victims( &mut self, victims: Vec<(AId, ProtectedArc<dyn IsParticipant>)>, ) -> Vec<(AId, Result<Reclaimed, VictimPanicked>)>
Notify the chosen victims and obtain their responses
This is the async part, and is done with the state unlocked.
Sourcefn handle_victim_responses(
&mut self,
state: &mut State,
responses: Vec<(AId, Result<Reclaimed, VictimPanicked>)>,
)
fn handle_victim_responses( &mut self, state: &mut State, responses: Vec<(AId, Result<Reclaimed, VictimPanicked>)>, )
Process the victim’s responses and update state
accordingly
Auto Trait Implementations§
impl Freeze for Reclaiming
impl RefUnwindSafe for Reclaiming
impl Send for Reclaiming
impl Sync for Reclaiming
impl Unpin for Reclaiming
impl UnwindSafe for Reclaiming
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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