1 package DBIx::Class::Storage::DBI::Replicated::Replicant;
4 requires qw/_query_start/;
8 DBIx::Class::Storage::DBI::Replicated::Replicant - A replicated DBI Storage Role
12 This class is used internally by L<DBIx::Class::Storage::DBI::Replicated>.
16 Replicants are DBI Storages that follow a master DBI Storage. Typically this
17 is accomplished via an external replication system. Please see the documents
18 for L<DBIx::Class::Storage::DBI::Replicated> for more details.
20 This class exists to define methods of a DBI Storage that only make sense when
21 it's a classic 'slave' in a pool of slave databases which replicate from a
22 given master database.
26 This class defines the following attributes.
30 This is a boolean which allows you to programmatically activate or deactivate a
31 replicant from the pool. This way to you do stuff like disallow a replicant
32 when it get's too far behind the master, if it stops replicating, etc.
34 This attribute DOES NOT reflect a replicant's internal status, i.e. if it is
35 properly replicating from a master and has not fallen too many seconds behind a
36 reliability threshold. For that, use L</is_replicating> and L</lag_behind_master>.
37 Since the implementation of those functions database specific (and not all DBIC
38 supported DB's support replication) you should refer your database specific
39 storage driver for more information.
53 This class defines the following methods.
55 =head2 after: _query_start
57 advice iof the _query_start method to add more debuggin
61 around '_query_start' => sub {
62 my ($method, $self, $sql, @bind) = @_;
63 my $dsn = $self->_dbi_connect_info->[0];
64 $self->$method("DSN: $dsn SQL: $sql", @bind);
69 Override the debugobj method to redirect this method call back to the master.
74 return shift->schema->storage->debugobj;
79 L<<a href="http://en.wikipedia.org/wiki/Replicant">http://en.wikipedia.org/wiki/Replicant</a>>
83 John Napiorkowski <john.napiorkowski@takkle.com>
87 You may distribute this code under the same terms as Perl itself.