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
DBIx::DBHResolver::Strategy::List(3) User Contributed Perl Documentation DBIx::DBHResolver::Strategy::List(3)

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

  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_A's connect_info
  $strategy->connect_info( $resolver, 'BLOOD', $BLOOD_TYPE{B} ); # return BLOOD_B's connect_info
  $strategy->connect_info( $resolver, 'BLOOD', $BLOOD_TYPE{O} ); # return BLOOD_O's connect_info
  $strategy->connect_info( $resolver, 'BLOOD', $BLOOD_TYPE{AB} ); # return BLOOD_AB_OR_UNKNOWN's connect_info
  $strategy->connect_info( $resolver, 'BLOOD', $BLOOD_TYPE{UNKNOWN} ); # return BLOOD_AB_OR_UNKNOWN's connect_info

This module is list based sharding strategy.

Return connect_info hash ref.

Return resolved node_or_cluster name.

Toru Yamaguchi <zigorou@dena.jp<gt>

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

2012-10-21 perl v5.32.1

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

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