pub struct Pool { /* private fields */ }Expand description
A pool for delayed edges. Pools are scoped to a State. Edges within a State will share Pools. A Pool will keep a count of the total ‘weight’ of the currently scheduled edges. If a Plan attempts to schedule an Edge which would cause the total weight to exceed the depth of the Pool, the Pool will enque the Edge instead of allowing the Plan to schedule it. The Pool will relinquish queued Edges when the total scheduled weight diminishes enough (i.e. when a scheduled edge completes).
Implementations§
Source§impl Pool
impl Pool
pub fn new(name: Vec<u8>, depth: usize) -> Self
pub fn is_valid(&self) -> bool
pub fn depth(&self) -> usize
pub fn name(&self) -> &[u8] ⓘ
pub fn current_use(&self) -> usize
Sourcepub fn should_delay_edge(&self) -> bool
pub fn should_delay_edge(&self) -> bool
true if the Pool might delay this edge
Sourcepub fn delay_edge(&mut self, state: &State, edge: EdgeIndex)
pub fn delay_edge(&mut self, state: &State, edge: EdgeIndex)
adds the given edge to this Pool to be delayed.
Sourcepub fn retrieve_ready_edges(
&mut self,
state: &State,
ready_queue: &mut BTreeSet<EdgeIndex>,
)
pub fn retrieve_ready_edges( &mut self, state: &State, ready_queue: &mut BTreeSet<EdgeIndex>, )
Pool will add zero or more edges to the ready_queue
Sourcepub fn edge_scheduled(&mut self, state: &State, edge: EdgeIndex)
pub fn edge_scheduled(&mut self, state: &State, edge: EdgeIndex)
informs this Pool that the given edge is committed to be run. Pool will count this edge as using resources from this pool.
Sourcepub fn edge_finished(&mut self, state: &State, edge: EdgeIndex)
pub fn edge_finished(&mut self, state: &State, edge: EdgeIndex)
informs this Pool that the given edge is no longer runnable, and should relinquish its resources back to the pool