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