GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DBIX::DBHRESOLVER::STRATEGY::LIST (3)

.ds Aq ’

NAME

DBIx::DBHResolver::Strategy::List - write short description for DBIx::DBHResolver::Strategy::List

CONTENTS

SYNOPSIS



  use DBIx::DBHResolver;
  use DBIx::DBHResolver::Strategy::List;

  our %BLOOD_TYPES = (
    UNKNOWN => 0,
    A       => 1,
    B       => 2,
    O       => 3,
    AB      => 4,
  );

  my $resolver = DBIx::DBHResolver->new;
  $resolver->config(+{
    clusters => +{
      BLOOD => +{
        node => [ qw/BLOOD_A BLOOD_B BLOOD_O BLOOD_AB_OR_UNKNOWN/ ],
        strategy => List,
        strategy_config => +{
          BLOOD_A => [qw/1/],
          BLOOD_B => [qw/2/],
          BLOOD_O => [qw/3/],
          BLOOD_AB_OR_UNKNOWN => [qw/0 4/]
        },
      }
    },
    connect_info => +{
      BLOOD_A             => +{ ... },
      BLOOD_B             => +{ ... },
      BLOOD_O             => +{ ... },
      BLOOD_AB_OR_UNKNOWN => +{ ... },
    },
  });

  my $strategy = DBIx::DBHResolver::Strategy::List;

  $strategy->connect_info( $resolver, BLOOD, $BLOOD_TYPE{A} ); # return BLOOD_As connect_info
  $strategy->connect_info( $resolver, BLOOD, $BLOOD_TYPE{B} ); # return BLOOD_Bs connect_info
  $strategy->connect_info( $resolver, BLOOD, $BLOOD_TYPE{O} ); # return BLOOD_Os connect_info
  $strategy->connect_info( $resolver, BLOOD, $BLOOD_TYPE{AB} ); # return BLOOD_AB_OR_UNKNOWNs connect_info
  $strategy->connect_info( $resolver, BLOOD, $BLOOD_TYPE{UNKNOWN} ); # return BLOOD_AB_OR_UNKNOWNs connect_info



DESCRIPTION

This module is list based sharding strategy.

METHODS

connect_info( CW$resolver, CW$node_or_cluster, CW$args )

Return connect_info hash ref.

resolve( CW$resolver, CW$node_or_cluster, CW$key, CW$args )

Return resolved node_or_cluster name.

AUTHOR

Toru Yamaguchi <zigorou@dena.jp<gt>

LICENSE

This module is licensed under the same terms as Perl itself.

SEE ALSO

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DBIX::DBHRESOLVER::STRATEGY::LIST (3) 2012-10-21

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.