| 1 | package Redis::Fast::Sentinel; | ||||||||||||||||||||||
| 2 | |||||||||||||||||||||||
| 3 | # ABSTRACT: Redis::Fast Sentinel interface | ||||||||||||||||||||||
| 4 | |||||||||||||||||||||||
| 5 | 42 | ▶ | use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 6 | 42 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 7 | |||||||||||||||||||||||
| 8 | 42 | ▶ | use Carp; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 9 | |||||||||||||||||||||||
| 10 | 42 | ▶ | use base qw(Redis::Fast); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 11 | |||||||||||||||||||||||
| 12 | 0 | ▶ | sub new { | ||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 13 | 0 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||
| 14 | # these args are not allowed when contacting a sentinel | ||||||||||||||||||||||
| 15 | 0 | delete @args{qw(sentinels service)}; | |||||||||||||||||||||
| 16 | # Do not support SSL for sentinels | ||||||||||||||||||||||
| 17 | 0 | $args{ssl} = 0; | |||||||||||||||||||||
| 18 | |||||||||||||||||||||||
| 19 | 0 | $class->SUPER::new(%args); | |||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||
| 21 | |||||||||||||||||||||||
| 22 | 0 | ▶ | sub get_service_address { | ||||||||||||||||||||
|
Subroutine
get_service_address: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||
| 23 | 0 | ▶ | my ($self, $service) = @_; | ||||||||||||||||||||
|
Subroutine
get_service_address: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||
| 24 | 0 | my ($ip, $port) = $self->sentinel('get-master-addr-by-name', $service); | |||||||||||||||||||||
| 25 | 0 | ▶ | defined $ip | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 26 | or return; | ||||||||||||||||||||||
| 27 | 0 | ▶ | $ip eq 'IDONTKNOW' | ||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||
| 28 | and return $ip; | ||||||||||||||||||||||
| 29 | 0 | return "$ip:$port"; | |||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||
| 31 | |||||||||||||||||||||||
| 32 | 0 | ▶ | sub get_masters { | ||||||||||||||||||||
|
Subroutine
get_masters: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||
| 33 | 0 | ▶ | map { +{ @$_ }; } @{ shift->sentinel('masters') || [] }; | ||||||||||||||||||||
|
Subroutine
get_masters: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/4
(shift())->sentinel('masters') || []
(shift())->sentinel('masters') || []
MC/DC0%0/1
(shift())->sentinel('masters') || []
(shift())->sentinel('masters')
MC/DC0%0/1
(shift())->sentinel('masters') || []
(shift())->sentinel('masters')
Truth table0%0/2
A
A= (shift())->sentinel('masters')
Truth table0%0/2
A
A= (shift())->sentinel('masters')
| |||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||
| 35 | |||||||||||||||||||||||
| 36 | 42 | 1; | |||||||||||||||||||||
| 37 | |||||||||||||||||||||||
| 38 | __END__ | ||||||||||||||||||||||