NAME

Argon::Queue - Bounded, prioritized queue class

VERSION

version 0.18

SYNOPSIS

use Argon::Queue;

my $q = Argon::Queue->new(max => 32);

unless ($q->is_full) {
  $q->put(...);
}

unless ($q->is_empty) {
  my $msg = $q->get;
}

DESCRIPTION

The bounded priority queue used by the Argon::Manager for Argon::Messages submitted to the Ar network.

ATTRIBUTES

max

The maximum number of messages supported by the queue.

METHODS

is_empty

Returns true if the queue is empty.

is_full

Returns true if there is at least one Argon::Message in the queue.

put

Adds a message to the queue. Croaks if the supplied message is not an Argon::Message or if the queue is full.

Adding a message to the queue has the side effect of promoting any previously added messages that have been stuck at a lower level priority for an overly long time.

get

Removes and returns the next Argon::Message on the queue. Returns undef if the queue is empty.

AUTHOR

Jeff Ober <sysread@fastmail.fm>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Jeff Ober.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.