added some advice to debugging replicants so that we can see a replicant dsn, got...
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Replicated / Replicant.pm
CommitLineData
26ab719a 1package DBIx::Class::Storage::DBI::Replicated::Replicant;
2
3use Moose;
4extends 'DBIx::Class::Storage::DBI', 'Moose::Object';
5
6=head1 NAME
7
8DBIx::Class::Storage::DBI::Replicated::Replicant; A replicated DBI Storage
9
10=head1 SYNOPSIS
11
12This class is used internally by L<DBIx::Class::Storage::DBI::Replicated>. You
13shouldn't need to create instances of this class.
14
15=head1 DESCRIPTION
16
17Replicants are DBI Storages that follow a master DBI Storage. Typically this
18is accomplished via an external replication system. Please see the documents
19for L<DBIx::Class::Storage::DBI::Replicated> for more details.
20
21This class exists to define methods of a DBI Storage that only make sense when
22it's a classic 'slave' in a pool of slave databases which replicate from a
23given master database.
24
25=head1 ATTRIBUTES
26
27This class defines the following attributes.
28
50336325 29=head2 active
30
31This is a boolean which allows you to programmatically activate or deactivate a
32replicant from the pool. This way to you do stuff like disallow a replicant
33when it get's too far behind the master, if it stops replicating, etc.
34
35=cut
36
37has 'active' => (
38 is=>'rw',
39 isa=>'Bool',
40 lazy=>1,
41 required=>1,
42 default=>1,
43);
44
45
26ab719a 46=head1 METHODS
47
48This class defines the following methods.
49
50336325 50=head2 after: _query_start
51
52advice iof the _query_start method to add more debuggin
53
54=cut
55
56around '_query_start' => sub {
57 my ($method, $self, $sql, @bind) = @_;
58 my $dsn = $self->connect_info->[0];
59 $self->$method("DSN: $dsn SQL: $sql", @bind);
60};
61
62
26ab719a 63=head1 AUTHOR
64
65John Napiorkowski <john.napiorkowski@takkle.com>
66
67=head1 LICENSE
68
69You may distribute this code under the same terms as Perl itself.
70
50336325 71=cut
72
731;