File Coverage

blib/lib/Cassandra/Client/Policy/Retry/Default.pm
Criterion Covered Total %
statement 11 27 40.7
branch 0 12 0.0
condition 0 3 0.0
subroutine 4 9 44.4
pod 0 5 0.0
total 15 56 26.7


line stmt bran cond sub pod time code
1             package Cassandra::Client::Policy::Retry::Default;
2             our $AUTHORITY = 'cpan:TVDW';
3             $Cassandra::Client::Policy::Retry::Default::VERSION = '0.13_007'; # TRIAL
4              
5 1     1   13 $Cassandra::Client::Policy::Retry::Default::VERSION = '0.13007';use 5.010;
  1         3  
6 1     1   5 use strict;
  1         2  
  1         15  
7 1     1   5 use warnings;
  1         2  
  1         30  
8              
9 1         224 use Cassandra::Client::Policy::Retry qw/
10             try_next_host
11             retry
12             rethrow
13 1     1   253 /;
  1         2  
14              
15             sub new {
16 0     0 0   my ($class)= @_;
17 0           return bless {}, $class;
18             }
19              
20             sub on_read_timeout {
21 0     0 0   my ($self, $statement, $consistency_level, $required_responses, $received_responses, $data_retrieved, $nr_retries)= @_;
22              
23 0 0         return rethrow if $nr_retries;
24 0 0 0       return retry if $received_responses >= $required_responses && !$data_retrieved;
25 0           return rethrow;
26             }
27              
28             sub on_unavailable {
29 0     0 0   my ($self, $statement, $consistency_level, $required_replicas, $alive_replicas, $nr_retries)= @_;
30              
31 0 0         return rethrow if $nr_retries;
32 0           return try_next_host;
33             }
34              
35             sub on_write_timeout {
36 0     0 0   my ($self, $statement, $consistency_level, $write_type, $required_acks, $received_acks, $nr_retries)= @_;
37              
38 0 0         return rethrow if $nr_retries;
39 0 0         return retry if $write_type eq 'BATCH_LOG';
40 0           return rethrow;
41             }
42              
43             sub on_request_error {
44 0     0 0   my ($self, $statement, $consistency_level, $error, $nr_retries)= @_;
45              
46 0 0         return rethrow if $nr_retries;
47 0           return try_next_host;
48             }
49              
50             1;
51              
52             __END__