NAME

Data::EventStream::Window - Perl extension for event processing

VERSION

This document describes Data::EventStream::Window version 0.13

DESCRIPTION

This class represents time window for which aggregator aggregates data. Normally window objects are passed to aggregators' callbacks and user has no need to build them himself.

METHODS

$class->new

Create a new Window object. Data::EventStream will do it for you.

$self->count

Number of events in the window

$self->start_time

Window start time

$self->end_time

Window end time

$self->reset_count

Set number of events in window to 0

$self->time_length

Window length in time

$self->get_event($idx)

Returns event with the specified index. 0 being the oldest, and -1 being the latest, most recent, event.

$self->get_iterator

Returns callable iterator object. Each time you call it, it returns the next event starting from the oldest one. For example:

my $next_event = $win->get_iterator;
while ( my $event = $next_event->() ) {
    ...
}