blib/lib/Cassandra/Client/Policy/Retry/Default.pm

filter: Statementstmt 38.8% 14 / 36 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 44.4% 4 / 9 Podpod 0.0% 0 / 5 totaltotal 23.0% 18 / 78 CC 13 SCAR 27.8
CC
13
Cov
23%
on_read_timeout
30.0
new
20.0
on_write_timeout
20.0
CRAP 16.1
« blib/lib/Cassandra/Client/AsyncEV.pm ↑ Summary blib/lib/Cassandra/Client/Policy/LoadBalancing/Default.pm »
1 package Cassandra::Client::Policy::Retry::Default;
2 13 our $AUTHORITY = 'cpan:TVDW';
3 13 $Cassandra::Client::Policy::Retry::Default::VERSION = '0.21';
4 13 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 13 ▶use Cassandra::Client::Policy::Retry qw/
Subroutine BEGIN: called CC=1 SCAR=0.0
9 try_next_host
10 retry
11 rethrow
12 13 /;
13  
14 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
Pod undocumented
15 0 my ($class, %args)= @_;
16 0 my $max_retries;
17 0 foreach(qw/max_retries_read_timeout max_retries_unavailable max_retries_write_timeout max_retries_request_error/) {
18 0 ▶ $max_retries->{$_} = exists $args{$_} ? 0+ delete $args{$_} : 1;
Branch: 1 branch
BranchTrueFalseTotal
exists $args{$_} ? : 0 0 0
19 }
20  
21 0 ▶ if (%args) {
Branch: 1 branch
BranchTrueFalseTotal
if (%args) 0 0 0
22 0 die 'Unknown arguments '. (join ', ', keys %args);
23 }
24 0 return bless {
25 max_retries => $max_retries,
26 }, $class;
27 }
28  
29 0 ▶sub on_read_timeout {
Subroutine on_read_timeout: not called CC=5 SCAR=34.0
Pod undocumented
30 0 my ($self, $statement, $consistency_level, $required_responses, $received_responses, $data_retrieved, $nr_retries)= @_;
31  
32 0 ▶ return rethrow if $nr_retries >= $self->{max_retries}{max_retries_read_timeout};
Branch: 1 branch
BranchTrueFalseTotal
if $nr_retries >= $self->{"max_retries"}{"max_retries_read_timeout"} 0 0 0
33 0 ▶ return retry if $received_responses < $required_responses;
Branch: 1 branch
BranchTrueFalseTotal
if $received_responses < $required_responses 0 0 0
34 0 ▶ return retry if $received_responses >= $required_responses and !$data_retrieved;
Branch: 1 branch
BranchTrueFalseTotal
if $received_responses >= $required_responses and not $data_retrieved 0 0 0
Condition0%0/3
$received_responses >= $required_responses and not $data_retrieved
!ll&&!rl&&r
000
MC/DC0%0/2
$received_responses >= $required_responses and not $data_retrieved
$received_responses >= $required_responses not $data_retrieved
Truth table0%0/3
A and not(B)
A= $received_responses >= $required_responsesB= not $data_retrieved
ABresult
0X0
100
111
35 0 return rethrow;
36 }
37  
38 0 ▶sub on_unavailable {
Subroutine on_unavailable: not called CC=2 SCAR=17.9
Pod undocumented
39 0 my ($self, $statement, $consistency_level, $required_replicas, $alive_replicas, $nr_retries)= @_;
40  
41 0 ▶ return rethrow if $nr_retries >= $self->{max_retries}{max_retries_unavailable};
Branch: 1 branch
BranchTrueFalseTotal
if $nr_retries >= $self->{"max_retries"}{"max_retries_unavailable"} 0 0 0
42 0 return try_next_host;
43 }
44  
45 0 ▶sub on_write_timeout {
Subroutine on_write_timeout: not called CC=4 SCAR=30.0
Pod undocumented
46 0 my ($self, $statement, $consistency_level, $write_type, $required_acks, $received_acks, $nr_retries)= @_;
47  
48 0 ▶ return rethrow if $nr_retries >= $self->{max_retries}{max_retries_write_timeout};
Branch: 1 branch
BranchTrueFalseTotal
if $nr_retries >= $self->{"max_retries"}{"max_retries_write_timeout"} 0 0 0
49 0 ▶ return retry if $write_type eq 'BATCH_LOG' or $statement->{idempotent};
Branch: 1 branch
BranchTrueFalseTotal
if $write_type eq "BATCH_LOG" or $statement->{"idempotent"} 0 0 0
Condition0%0/3
$write_type eq "BATCH_LOG" or $statement->{"idempotent"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$write_type eq "BATCH_LOG" or $statement->{"idempotent"}
$write_type eq "BATCH_LOG" $statement->{"idempotent"}
Truth table0%0/3
A or B
A= $write_type eq "BATCH_LOG"B= $statement->{"idempotent"}
ABresult
1X1
011
000
50 0 return rethrow;
51 }
52  
53 0 ▶sub on_request_error {
Subroutine on_request_error: not called CC=2 SCAR=17.9
Pod undocumented
54 0 my ($self, $statement, $consistency_level, $error, $nr_retries)= @_;
55  
56 0 ▶ return rethrow if $nr_retries >= $self->{max_retries}{max_retries_request_error};
Branch: 1 branch
BranchTrueFalseTotal
if $nr_retries >= $self->{"max_retries"}{"max_retries_request_error"} 0 0 0
57 0 return try_next_host;
58 }
59  
60 13 1;
61  
62 __END__
« blib/lib/Cassandra/Client/AsyncEV.pm ↑ Summary blib/lib/Cassandra/Client/Policy/LoadBalancing/Default.pm »