.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Tirex::PrioQueue 3pm" .TH Tirex::PrioQueue 3pm "2021-10-07" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Tirex::PrioQueue \- Queue for one priority .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Tirex::PrioQueue; \& my $pq = Tirex::PrioQueue\->new(prio => 7); \& \& $pq\->add($job); \& $pq\->remove($job); \& \& $job = $pq\->next(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" PrioQueues hold all jobs with a certain priority. They are never accessed directly, only through a Tirex::Queue object. .SH "METHODS" .IX Header "METHODS" .ie n .SS "Tirex::PrioQueue\->new(prio => $prio);" .el .SS "Tirex::PrioQueue\->new(prio => \f(CW$prio\fP);" .IX Subsection "Tirex::PrioQueue->new(prio => $prio);" Create new priority queue object. .ie n .SS "$pq\->\fBsize()\fP" .el .SS "\f(CW$pq\fP\->\fBsize()\fP" .IX Subsection "$pq->size()" Returns the size of the priority queue. .ie n .SS "$pq\->\fBempty()\fP" .el .SS "\f(CW$pq\fP\->\fBempty()\fP" .IX Subsection "$pq->empty()" Is the priority queue empty? .PP Returns true if the queue is empty, false otherwise. .ie n .SS "$pq\->\fBreset()\fP" .el .SS "\f(CW$pq\fP\->\fBreset()\fP" .IX Subsection "$pq->reset()" Reset the queue. All jobs on the queue will be lost! .PP Returns priority queue itself, so that calls can be chained. .ie n .SS "$pq\->add($job)" .el .SS "\f(CW$pq\fP\->add($job)" .IX Subsection "$pq->add($job)" Add job to priority queue. The job will only be added if the job priority and the queue priority are the same. This method will *not* check whether a job for the same metatile is already in the queue. .PP Returns the job if it was added, undef otherwise. .ie n .SS "$pq\->remove($job)" .el .SS "\f(CW$pq\fP\->remove($job)" .IX Subsection "$pq->remove($job)" Remove a job from the priority queue. .PP Returns the job or undef if the job was not on this queue. .ie n .SS "$pq\->\fBclean()\fP" .el .SS "\f(CW$pq\fP\->\fBclean()\fP" .IX Subsection "$pq->clean()" The priority queue can have empty (undef) items in it where there was a real job that was removed when another job for the same metatile came in. This method will clean those empty items from the beginning and end of the queue. It is called from \fBremove()\fR and \fBnext()\fR methods to ensure that there are no empty items at the beginning or end at any time. .PP Returns priority queue itself, so that calls can be chained. .ie n .SS "$pq\->\fBpeek()\fP" .el .SS "\f(CW$pq\fP\->\fBpeek()\fP" .IX Subsection "$pq->peek()" Get first element of the priority queue without removing it. .PP Returns false if the queue is empty. .ie n .SS "$pq\->\fBnext()\fP" .el .SS "\f(CW$pq\fP\->\fBnext()\fP" .IX Subsection "$pq->next()" Remove and return first element of the priority queue. .PP Returns false if there are no jobs in the queue. .ie n .SS "$pq\->\fBage_first()\fP" .el .SS "\f(CW$pq\fP\->\fBage_first()\fP" .IX Subsection "$pq->age_first()" Returns age (in seconds) of first job in the priority queue. Age is the difference between current and request time. .PP Returns false if the priority queue is empty. .ie n .SS "$pq\->\fBage_last()\fP" .el .SS "\f(CW$pq\fP\->\fBage_last()\fP" .IX Subsection "$pq->age_last()" Returns age (in seconds) of last job in the priority queue. Age is the difference between current and request time. .PP Returns false if the priority queue is empty. .ie n .SS "$pq\->\fBreset_maxsize()\fP" .el .SS "\f(CW$pq\fP\->\fBreset_maxsize()\fP" .IX Subsection "$pq->reset_maxsize()" Reset maxsize. New maxsize will be equal to current size. .PP Returns new maxsize; .ie n .SS "$pq\->\fBremove_jobs_for_unknown_maps()\fP" .el .SS "\f(CW$pq\fP\->\fBremove_jobs_for_unknown_maps()\fP" .IX Subsection "$pq->remove_jobs_for_unknown_maps()" Remove all jobs from this prioqueue where the map is undefined. This can happen after a reload of the config file, when a map was deleted from it. .ie n .SS "$pq\->\fBstatus()\fP" .el .SS "\f(CW$pq\fP\->\fBstatus()\fP" .IX Subsection "$pq->status()" Return status of the priority queue. .SH "SEE ALSO" .IX Header "SEE ALSO" Tirex::Queue, Tirex::Job