1 package DBIx::Class::Storage::DBI::Replicated::Replicant;
4 requires qw/_query_start/;
5 use MooseX::Types::Moose qw/Bool/;
7 use namespace::clean -except => 'meta';
11 DBIx::Class::Storage::DBI::Replicated::Replicant - A replicated DBI Storage Role
15 This class is used internally by L<DBIx::Class::Storage::DBI::Replicated>.
19 Replicants are DBI Storages that follow a master DBI Storage. Typically this
20 is accomplished via an external replication system. Please see the documents
21 for L<DBIx::Class::Storage::DBI::Replicated> for more details.
23 This class exists to define methods of a DBI Storage that only make sense when
24 it's a classic 'slave' in a pool of slave databases which replicate from a
25 given master database.
29 This class defines the following attributes.
33 This is a boolean which allows you to programmatically activate or deactivate a
34 replicant from the pool. This way to you do stuff like disallow a replicant
35 when it get's too far behind the master, if it stops replicating, etc.
37 This attribute DOES NOT reflect a replicant's internal status, i.e. if it is
38 properly replicating from a master and has not fallen too many seconds behind a
39 reliability threshold. For that, use L</is_replicating> and L</lag_behind_master>.
40 Since the implementation of those functions database specific (and not all DBIC
41 supported DB's support replication) you should refer your database specific
42 storage driver for more information.
56 This class defines the following methods.
58 =head2 around: _query_start
60 advice iof the _query_start method to add more debuggin
64 around '_query_start' => sub {
65 my ($method, $self, $sql, @bind) = @_;
66 my $dsn = $self->_dbi_connect_info->[0];
67 $self->$method("DSN: $dsn SQL: $sql", @bind);
72 Override the debugobj method to redirect this method call back to the master.
77 return shift->schema->storage->debugobj;
82 L<<a href="http://en.wikipedia.org/wiki/Replicant">http://en.wikipedia.org/wiki/Replicant</a>>
86 John Napiorkowski <john.napiorkowski@takkle.com>
90 You may distribute this code under the same terms as Perl itself.