1 package DBIx::Class::Storage::DBI::Replicated::Replicant;
4 requires qw/_query_start/;
5 with 'DBIx::Class::Storage::DBI::Replicated::WithDSN';
6 use MooseX::Types::Moose qw/Bool Str/;
7 use DBIx::Class::Storage::DBI::Replicated::Types 'DBICStorageDBI';
9 use namespace::clean -except => 'meta';
13 DBIx::Class::Storage::DBI::Replicated::Replicant - A replicated DBI Storage Role
17 This class is used internally by L<DBIx::Class::Storage::DBI::Replicated>.
21 Replicants are DBI Storages that follow a master DBI Storage. Typically this
22 is accomplished via an external replication system. Please see the documents
23 for L<DBIx::Class::Storage::DBI::Replicated> for more details.
25 This class exists to define methods of a DBI Storage that only make sense when
26 it's a classic 'slave' in a pool of slave databases which replicate from a
27 given master database.
31 This class defines the following attributes.
35 This is a boolean which allows you to programmatically activate or deactivate a
36 replicant from the pool. This way to you do stuff like disallow a replicant
37 when it get's too far behind the master, if it stops replicating, etc.
39 This attribute DOES NOT reflect a replicant's internal status, i.e. if it is
40 properly replicating from a master and has not fallen too many seconds behind a
41 reliability threshold. For that, use L</is_replicating> and L</lag_behind_master>.
42 Since the implementation of those functions database specific (and not all DBIC
43 supported DB's support replication) you should refer your database specific
44 storage driver for more information.
56 has dsn => (is => 'rw', isa => Str);
57 has id => (is => 'rw', isa => Str);
61 Reference to the master Storage.
65 has master => (is => 'rw', isa => DBICStorageDBI, weak_ref => 1);
69 This class defines the following methods.
73 Override the debugobj method to redirect this method call back to the master.
80 return $self->master->debugobj;
85 L<http://en.wikipedia.org/wiki/Replicant>,
86 L<DBIx::Class::Storage::DBI::Replicated>
90 John Napiorkowski <john.napiorkowski@takkle.com>
94 You may distribute this code under the same terms as Perl itself.