=cut
has 'pool_type' => (
- is=>'ro',
+ is=>'rw',
isa=>ClassName,
- required=>1,
default=>'DBIx::Class::Storage::DBI::Replicated::Pool',
handles=>{
'create_pool' => 'new',
=cut
has 'pool_args' => (
- is=>'ro',
+ is=>'rw',
isa=>HashRef,
lazy=>1,
- required=>1,
default=>sub { {} },
);
=cut
has 'balancer_type' => (
- is=>'ro',
+ is=>'rw',
isa=>BalancerClassNamePart,
coerce=>1,
required=>1,
=cut
has 'balancer_args' => (
- is=>'ro',
+ is=>'rw',
isa=>HashRef,
lazy=>1,
required=>1,
=cut
has 'balancer' => (
- is=>'ro',
+ is=>'rw',
isa=>'DBIx::Class::Storage::DBI::Replicated::Balancer',
lazy_build=>1,
handles=>[qw/auto_validate_every/],
=head2 around: connect_info
Preserve master's C<connect_info> options (for merging with replicants.)
+Also set any Replicated related options from connect_info, such as
+C<pool_type>, C<pool_args>, C<balancer_type> and C<balancer_args>.
=cut
next unless (reftype($arg)||'') eq 'HASH';
%opts = (%opts, %$arg);
}
-
delete $opts{dsn};
+ if (@opts{qw/pool_type pool_args/}) {
+ $self->pool_type(delete $opts{pool_type})
+ if $opts{pool_type};
+
+ $self->pool_args({
+ %{ $self->pool_args },
+ %{ delete $opts{pool_args} || {} }
+ });
+
+ $self->pool($self->_build_pool);
+ }
+
+ if (@opts{qw/balancer_type balancer_args/}) {
+ $self->balancer_type(delete $opts{balancer_type})
+ if $opts{balancer_type};
+
+ $self->balancer_args({
+ %{ $self->balancer_args },
+ %{ delete $opts{balancer_args} || {} }
+ });
+
+ $self->balancer($self->_build_balancer);
+ }
+
$self->_master_connect_info_opts(\%opts);
$self->$next($info, @extra);