Why not adopt me?
NAME
Data::EventStream - Perl extension for event processing
VERSION
This document describes Data::EventStream version 0.10
SYNOPSIS
use Data::EventStream;
DESCRIPTION
Module provides methods to analyze stream of events.
METHODS
$class->new(%params)
Creates a new instance. The following parameters are accepted:
- time
-
Initial model time, by default 0
- time_sub
-
Reference to a subroutine that returns time associated with the event passed to it as the only parameter.
$self->set_time($time)
Set new model time. This time must not be less than the current model time.
$self->next_leave
Return time of the next nearest leave or reset event
$self->add_aggregator($aggregator, %params)
Add a new aggregator object. The following options are accepted:
- count
-
Maximum number of event for which aggregator can aggregate data. When number of aggregated events reaches this limit, each time before a new event enters aggregator, the oldest aggregated event will leave it.
- duration
-
Maximum period of time handled by aggregator. Each time the model time is updated, events with age exceeding specified duration are leaving aggregator.
- batch
-
If enabled, when count or duration limit is reached, aggregator is reset and all events leaving it at once.
- start_time
-
Time when the first period should start. Used in conjunction with duration and batch. By default current model time.
- disposable
-
Used in conjunction with batch. Aggregator only aggregates specified period once and on reset it is removed from the list of aggregators.
- on_enter
-
Callback that should be invoked after event entered aggregator. Aggregator object is passed as the only argument to callback.
- on_leave
-
Callback that should be invoked before event leaves aggregator. Aggregator object is passed as the only argument to callback.
- on_reset
-
Callback that should be invoked before resetting the aggregator. Aggregator object is passed as the only argument to callback.
$self->add_event($event)
Add new event
BUGS
Please report any bugs or feature requests via GitHub bug tracker at http://github.com/trinitum/perl-Data-EventStream/issues.
AUTHOR
Pavel Shaydo <zwon at cpan.org>
LICENSE AND COPYRIGHT
Copyright (C) 2014 Pavel Shaydo
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.