X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FReplicated.pm;h=a70a8b56c3d6910b63b3e4c103cfbd16c7d5df69;hb=161fb22350bdfb511af2cc96d2a556a4296c20e8;hp=6408cb4fd2f3ad7b6be77da13941c8c69b428f91;hpb=106d5f3b7e03a68fb2e125772e3f06a34115f22d;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index 6408cb4..a70a8b5 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -89,6 +89,18 @@ has 'balancer_type' => ( }, ); +=head2 balancer_args + +Contains a hashref of initialized information to pass to the Balancer object. +See L for available arguments. + +=cut + +has 'balancer_args' => ( + is=>'ro', + isa=>'HashRef', +); + =head2 pool Is a or derived class. This is a @@ -104,8 +116,6 @@ has 'pool' => ( connect_replicants replicants has_replicants - num_replicants - delete_replicant /], ); @@ -120,6 +130,7 @@ has 'balancer' => ( is=>'ro', isa=>'DBIx::Class::Storage::DBI::Replicated::Balancer', lazy_build=>1, + handles=>[qw/auto_validate_every/], ); =head2 master @@ -258,7 +269,8 @@ Lazy builder for the L attribute. =cut sub _build_pool { - shift->create_pool; + my $self = shift @_; + $self->create_pool; } =head2 _build_balancer_type @@ -268,7 +280,7 @@ Lazy builder for the L attribute. =cut sub _build_balancer_type { - return 'DBIx::Class::Storage::DBI::Replicated::Balancer'; + return 'DBIx::Class::Storage::DBI::Replicated::Balancer::First'; } =head2 _build_balancer @@ -282,7 +294,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