POE-Component-FunctionBus
view release on metacpan or search on metacpan
lib/POE/Component/FunctionBus.pm view on Meta::CPAN
=head1 NAME
POE::Component::FunctionBus - Scalable dynamic function bus
=head1 PECULIARITIES
=head2 UNUSABLE MODULE
This module is a skeleton for a larger module and the author
is basically getting his enviroment setup, trying to remember
howto get PODs nicely formatted and other bits and bobs, that
is the only reason this module has been uploaded.
This module should not be used by anyone in its current state.
=head2 VERSIONING
The author of this module has taken a rather strange approach
to the versioning of the module, basically there the time the
source code/package was packaged 'make dist'.
=head1 VERSION
Version 1569954247
=cut
our $VERSION = '1569954247';
=head1 DESCRIPTION
The entire point of this module is to make a very fast/easy interface for
attaching internal and even external functions to a common standardized
serialization bus. (The serialization used is not enforced)
This module is the forerunner for an upcoming protocol that is in RFC, as the
author of the same protocol I have decided to race ahead and make something
from its fundamental core principles to solve some issues I have in the present.
=head2 WHY
Simply put you can publish functions over a common protocol (not neccesarily
just in perl) and instead of them being controlled by any type of namespace,
they are infact simply functions on a bus so for scalability of that expensive
processing function, you can attach as many workers as like.
This does however mean that very large complex tasks should be split down into
as small of a set of work functions as possible, so that they can be more easily
distributed amongst multiple processes.
But no one writes large heavy monolthic 'evil' functions anymore, right?
=head2 CONSIDERATIONS
To be considering using this type of distributed work network you should also
remember that it is rather dependant on code enacting postback type behaviour,
rather than block-and-return.
Not that you could not use block-and-return it would just well, be rather
resource hungry and not very scalable. If you do have a_function() that takes
8 days to run, consider wrapping it in a service that responds that it is busy
or so. That way you can have multiple nodes providing that service.
=head1 SYNOPSIS
Perhaps a little code snippet.
use POE::Component::FunctionBus;
my $options = {
}
my $node = POE::Component::FunctionBus->new($options);
$node->offer()
=head1 EXPORT
There are no exports for this module
=head1 METHODS
These are for instanciating connecting nodes
=head2 new
Create a new connection object, by default this will act as both a server and
client, it also by default binds 0.0.0.0/IPV4_ANY on port 10101(TCP) as well as
af_unix:/tmp/functionbus.PID.sock (PID here meaning the literal PID that perl
is using)
=cut
sub new {
my ($class,$options) = @_;
my $self = bless {
alias => __PACKAGE__,
session => 0,
}, $class;
$self->{session} = POE::Session->create(
package_states => [
$self => {
_start => '_start',
_stop => '_stop',
_keep_alive => '_keep_alive',
}
],
heap => {
parent => POE::Kernel->get_active_session()->ID
}
);
$self->{id} = $self->{session}->ID;
return $self;
}
( run in 0.596 second using v1.01-cache-2.11-cpan-39bf76dae61 )