Data::RuledCluster - clustering data resolver
This document describes Data::RuledCluster version 0.01.
use Data::RuledCluster; my $config = +{ clusters => +{ USER_W => [qw/USER001_W USER002_W/], USER_R => [qw/USER001_R USER002_R/], }, node => +{ USER001_W => ['dbi:mysql:user001', 'root', '',], USER002_W => ['dbi:mysql:user002', 'root', '',], USER001_R => ['dbi:mysql:user001', 'root', '',], USER002_R => ['dbi:mysql:user002', 'root', '',], }, }; my $dr = Data::RuledCluster->new( config => $config, ); my $resolved_data = $dr->resolve('USER_W', $user_id); # or my $resolved_data = $dr->resolve('USER001_W'); # $resolved_data: +{ node => 'USER001_W', node_info => ['dbi:mysql:user001', 'root', '',]}
# TODO
create a new Data::RuledCluster instance.
set or get config.
resolve cluster data.
Return hash resolved node and keys.
If $cluster_or_node is cluster, return true. But $cluster_or_node is not cluster, return false.
If $cluster_or_node is node, return true. But $cluster_or_node is not node, return false.
Return cluster info hash ref.
Retrieve cluster member node names as Array.
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.
Atsushi Kobayashi <nekokak@gmail.com>
Copyright (c) 2012, Atsushi Kobayashi. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.