From: John Napiorkowski Date: Wed, 7 May 2008 00:43:52 +0000 (+0000) Subject: documented methods for detecting replicant reliability, created stub methods X-Git-Tag: v0.08240~402^2~56 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=9c748388f02532cfa13d1d96c6b4b1ffefd9c76b documented methods for detecting replicant reliability, created stub methods --- diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm index 8d53297..59ac66e 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Replicant.pm @@ -32,6 +32,13 @@ This is a boolean which allows you to programmatically activate or deactivate a 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 and L. +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 @@ has 'active' => ( default=>1, ); - =head1 METHODS This class defines the following methods. @@ -59,6 +65,29 @@ around '_query_start' => sub { $self->$method("DSN: $dsn SQL: $sql", @bind); }; +=head2 is_replicating + +A boolean that reports if a particular L 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 diff --git a/t/93storage_replication.t b/t/93storage_replication.t index 5cbafef..589e499 100644 --- a/t/93storage_replication.t +++ b/t/93storage_replication.t @@ -310,10 +310,10 @@ TESTRELIABLE: { $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.';