Deluge Firmware 1.3.0
Build date: 2026.10.18
Loading...
Searching...
No Matches
ClusterPriorityQueue Class Reference

#include <cluster_priority_queue.h>

Inheritance diagram for ClusterPriorityQueue:
Collaboration diagram for ClusterPriorityQueue:

Public Member Functions

Error enqueueCluster (Cluster &cluster, uint32_t priorityRating, const InterruptsDisabled &)
bool empty () const
 Not exact unless interrupts are disabled, as the SD interrupt may be taking one off.
std::optional< qcluster > popForLoading (const InterruptsDisabled &)
 Takes the highest priority Cluster that still wants loading off the queue. For the SD interrupt, so doesn't allocate or free anything - unwanted ones are just dropped, as they've already been taken care of by whatever made them unwanted.
bool hasAnyWithPriority (Priority priority, const InterruptsDisabled &) const
 Whether any Cluster is queued at exactly priority. Has to check every entry, as the heap only keeps the front in order.
bool raisePriority (const Cluster *cluster, Priority priorityRating, const InterruptsDisabled &)
 If cluster is queued at a lower priority than priorityRating, moves it up to that.
std::optional< Priority > take (const Cluster *cluster, const InterruptsDisabled &)
 Takes cluster out of the queue, e.g. to load it right away.
bool erase (const Cluster *cluster, const InterruptsDisabled &)

Detailed Description

Clusters waiting to be read from the card. The main thread adds them, and the SD interrupt takes them off the front with popForLoading() as it gets to them - so everything here has to be done with interrupts disabled.

Member Function Documentation

◆ popForLoading()

std::optional< qcluster > ClusterPriorityQueue::popForLoading ( const InterruptsDisabled & )
inline

Takes the highest priority Cluster that still wants loading off the queue. For the SD interrupt, so doesn't allocate or free anything - unwanted ones are just dropped, as they've already been taken care of by whatever made them unwanted.

Returns
It and its priority, or nullopt if there's nothing to load.

◆ raisePriority()

bool ClusterPriorityQueue::raisePriority ( const Cluster * cluster,
Priority priorityRating,
const InterruptsDisabled &  )
inline

If cluster is queued at a lower priority than priorityRating, moves it up to that.

Enqueuing it again instead would get it loaded twice, which corrupts any data that gets converted on load.

Returns
Whether it was queued at a lower priority.

◆ take()

std::optional< Priority > ClusterPriorityQueue::take ( const Cluster * cluster,
const InterruptsDisabled &  )
inline

Takes cluster out of the queue, e.g. to load it right away.

Returns
The priority it was queued at, so it can be put back if loading fails, or nullopt if it wasn't queued.

The documentation for this class was generated from the following file: