[Bast-commits] r4352 - in
DBIx-Class/0.08/branches/replication_dedux:
lib/DBIx/Class/Storage/DBI/Replicated t
jnapiorkowski at dev.catalyst.perl.org
jnapiorkowski at dev.catalyst.perl.org
Wed May 7 01:43:54 BST 2008
Author: jnapiorkowski
Date: 2008-05-07 01:43:52 +0100 (Wed, 07 May 2008)
New Revision: 4352
Modified:
DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm
DBIx-Class/0.08/branches/replication_dedux/t/93storage_replication.t
Log:
documented methods for detecting replicant reliability, created stub methods
Modified: DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm
===================================================================
--- DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm 2008-05-07 00:23:09 UTC (rev 4351)
+++ DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm 2008-05-07 00:43:52 UTC (rev 4352)
@@ -32,6 +32,13 @@
replicant from the pool. This way to you do stuff like disallow a replicant
when it get's too far behind the master, if it stops replicating, etc.
+This attribute DOES NOT reflect a replicant's internal status, i.e. if it is
+properly replicating from a master and has not fallen too many seconds behind a
+reliability threshold. For that, use L</is_replicating> and L</lag_behind_master>.
+Since the implementation of those functions database specific (and not all DBIC
+supported DB's support replication) you should refer your database specific
+storage driver for more information.
+
=cut
has 'active' => (
@@ -42,7 +49,6 @@
default=>1,
);
-
=head1 METHODS
This class defines the following methods.
@@ -59,7 +65,30 @@
$self->$method("DSN: $dsn SQL: $sql", @bind);
};
+=head2 is_replicating
+A boolean that reports if a particular L<DBIx::Class::Storage::DBI> is set to
+replicate from a master database. Default is false, which is the result
+returned by databases that don't support replication.
+
+=cut
+
+sub is_replicating {
+ my $self = shift @_;
+}
+
+=head2 lag_behind_master
+
+Returns a number that represents a certain amount of lag behind a master db
+when a given storage is replicating. The number is database dependent, but
+starts at zero, which is the default, and increases with the amount of lag.
+
+=cut
+
+sub lag_behind_master {
+ my $self = shift @_;
+}
+
=head1 AUTHOR
John Napiorkowski <john.napiorkowski at takkle.com>
Modified: DBIx-Class/0.08/branches/replication_dedux/t/93storage_replication.t
===================================================================
--- DBIx-Class/0.08/branches/replication_dedux/t/93storage_replication.t 2008-05-07 00:23:09 UTC (rev 4351)
+++ DBIx-Class/0.08/branches/replication_dedux/t/93storage_replication.t 2008-05-07 00:43:52 UTC (rev 4352)
@@ -310,10 +310,10 @@
$replicated->schema->storage->set_balanced_storage;
ok $replicated->schema->resultset('Artist')->find(3)
- => 'Read from replicant';
+ => 'Read from replicant';
}
-## Make sure when $reliable goes out of scope, we are using replicants again
+## Make sure when reliable goes out of scope, we are using replicants again
ok $replicated->schema->resultset('Artist')->find(1)
=> 'back to replicant 1.';
More information about the Bast-commits
mailing list