line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Search::Elasticsearch::Role::Cxn::Async::Simple; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
983
|
use Moo::Role; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
388
|
use namespace::clean; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with 'Search::Elasticsearch::Role::Cxn'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub pings_ok { |
11
|
0
|
|
|
0
|
0
|
|
my ($self, $cb) = @_; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
my $log = $self->logger; |
14
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
$log->infof('Pinging [%s]', $self->stringify) |
16
|
|
|
|
|
|
|
if $log->is_info; |
17
|
|
|
|
|
|
|
$self->perform_request( |
18
|
|
|
|
|
|
|
{ |
19
|
|
|
|
|
|
|
method => 'HEAD', |
20
|
|
|
|
|
|
|
path => '/', |
21
|
|
|
|
|
|
|
timeout => $self->ping_timeout, |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
sub { |
24
|
0
|
0
|
|
0
|
|
|
if (@_) { |
25
|
0
|
0
|
|
|
|
|
$log->infof('Marking [%s] as live', $self->stringify) |
26
|
|
|
|
|
|
|
if $log->is_info; |
27
|
0
|
|
|
|
|
|
$self->mark_live(); |
28
|
0
|
|
|
|
|
|
$cb->(1); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
0
|
0
|
|
|
|
|
$log->debug($@) |
32
|
|
|
|
|
|
|
if $log->is_debug; |
33
|
0
|
|
|
|
|
|
$self->mark_dead(); |
34
|
0
|
|
|
|
|
|
$cb->(); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
0
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub sniff { |
43
|
0
|
|
|
0
|
0
|
|
my ($self, $cb) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $log = $self->logger; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
$log->infof('Sniffing [%s]', $self->stringify) |
48
|
|
|
|
|
|
|
if $log->is_info; |
49
|
|
|
|
|
|
|
$self->perform_request( |
50
|
|
|
|
|
|
|
{ |
51
|
|
|
|
|
|
|
method => 'GET', |
52
|
|
|
|
|
|
|
path => '/_nodes/' . $self->protocol, |
53
|
|
|
|
|
|
|
qs => {timeout => 1000 * $self->sniff_timeout}, |
54
|
|
|
|
|
|
|
timeout => $self->sniff_request_timeout, |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
sub { |
57
|
0
|
0
|
|
0
|
|
|
if (@_) { |
58
|
0
|
|
|
|
|
|
$cb->($_[1]->{nodes}); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else { |
61
|
0
|
0
|
|
|
|
|
$log->debug($@) |
62
|
|
|
|
|
|
|
if $log->is_debug; |
63
|
0
|
|
|
|
|
|
$cb->(); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
0
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |