changed SQLT::Parser::DBIC so that in FK constraints, both the field order for the...
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Replicated.pm
index 7323b42..27136b1 100644 (file)
@@ -75,16 +75,20 @@ has 'pool_type' => (
 
 =head2 pool_args
 
-Contains a hashref of initialized information to pass to the Pool object.  See
-L<DBIx::Class::Storage::Replicated::Pool> for available arguments.
+Contains a hashref of initialized information to pass to the Balancer object.
+See L<DBIx::Class::Storage::Replicated::Pool> for available arguments.
 
 =cut
 
 has 'pool_args' => (
     is=>'ro',
     isa=>'HashRef',
+    lazy=>1,
+    required=>1,
+    default=>sub { {} },
 );
 
+
 =head2 balancer_type
 
 The replication pool requires a balance class to provider the methods for
@@ -101,6 +105,21 @@ has 'balancer_type' => (
     },
 );
 
+=head2 balancer_args
+
+Contains a hashref of initialized information to pass to the Balancer object.
+See L<DBIx::Class::Storage::Replicated::Balancer> for available arguments.
+
+=cut
+
+has 'balancer_args' => (
+    is=>'ro',
+    isa=>'HashRef',
+    lazy=>1,
+    required=>1,
+    default=>sub { {} },
+);
+
 =head2 pool
 
 Is a <DBIx::Class::Storage::DBI::Replicated::Pool> or derived class.  This is a
@@ -116,9 +135,6 @@ has 'pool' => (
         connect_replicants    
         replicants
         has_replicants
-        num_replicants
-        delete_replicant
-        validate_replicants
     /],
 );
 
@@ -133,6 +149,7 @@ has 'balancer' => (
     is=>'ro',
     isa=>'DBIx::Class::Storage::DBI::Replicated::Balancer',
     lazy_build=>1,
+    handles=>[qw/auto_validate_every/],
 );
 
 =head2 master
@@ -272,7 +289,7 @@ Lazy builder for the L</pool> attribute.
 
 sub _build_pool {
        my $self = shift @_;
-    $self->create_pool($self->pool_args);
+    $self->create_pool(%{$self->pool_args});
 }
 
 =head2 _build_balancer_type
@@ -282,7 +299,7 @@ Lazy builder for the L</balancer_type> attribute.
 =cut
 
 sub _build_balancer_type {
-    return 'DBIx::Class::Storage::DBI::Replicated::Balancer';
+    return 'DBIx::Class::Storage::DBI::Replicated::Balancer::First';
 }
 
 =head2 _build_balancer
@@ -296,7 +313,8 @@ sub _build_balancer {
     my $self = shift @_;
     $self->create_balancer(
         pool=>$self->pool, 
-        master=>$self->master);
+        master=>$self->master,
+        %{$self->balancer_args},);
 }
 
 =head2 _build_write_handler