1 package DBIx::Class::Storage::DBI::Replicated::Replicant;
4 use DBIx::Class::Storage::DBI::Replicated::Types
5 qw(Boolean DBICStorageDBI Defined);
7 requires qw/_query_start/;
8 with 'DBIx::Class::Storage::DBI::Replicated::WithDSN';
12 DBIx::Class::Storage::DBI::Replicated::Replicant - A replicated DBI Storage Role
16 This class is used internally by L<DBIx::Class::Storage::DBI::Replicated>.
20 Replicants are DBI Storages that follow a master DBI Storage. Typically this
21 is accomplished via an external replication system. Please see the documents
22 for L<DBIx::Class::Storage::DBI::Replicated> for more details.
24 This class exists to define methods of a DBI Storage that only make sense when
25 it's a classic 'slave' in a pool of slave databases which replicate from a
26 given master database.
30 This class defines the following attributes.
34 This is a boolean which allows you to programmatically activate or deactivate a
35 replicant from the pool. This way you can do stuff like disallow a replicant
36 when it gets too far behind the master, if it stops replicating, etc.
38 This attribute DOES NOT reflect a replicant's internal status, i.e. if it is
39 properly replicating from a master and has not fallen too many seconds behind a
40 reliability threshold. For that, use L</is_replicating> and L</lag_behind_master>.
41 Since the implementation of those functions database specific (and not all DBIC
42 supported DBs support replication) you should refer your database-specific
43 storage driver for more information.
55 has dsn => (is => 'rw', isa => Defined(err=>sub{"'dsn' must be defined"}));
56 has id => (is => 'rw', isa => Defined(err=>sub{"'id' must be defined"}));
60 Reference to the master Storage.
72 This class defines the following methods.
76 Override the debugobj method to redirect this method call back to the master.
81 (shift)->master->debugobj;
86 L<http://en.wikipedia.org/wiki/Replicant>,
87 L<DBIx::Class::Storage::DBI::Replicated>
91 John Napiorkowski <jjnapiork@cpan.org>
95 You may distribute this code under the same terms as Perl itself.