Elasticsearch/CxnPool/Static/NoPing.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 15 / 15 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Elasticsearch/Cxn/Factory.pm ↑ Summary Elasticsearch/Role/Is_Sync.pm »
1 # Licensed to Elasticsearch B.V. under one or more contributor
2 # license agreements. See the NOTICE file distributed with
3 # this work for additional information regarding copyright
4 # ownership. Elasticsearch B.V. licenses this file to you under
5 # the Apache License, Version 2.0 (the "License"); you may
6 # not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
16 # under the License.
17  
18 package Search::Elasticsearch::CxnPool::Static::NoPing;
19 7 $Search::Elasticsearch::CxnPool::Static::NoPing::VERSION = '8.12';
20 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 7 with 'Search::Elasticsearch::Role::CxnPool::Static::NoPing',
22 'Search::Elasticsearch::Role::Is_Sync';
23 7 ▶use Search::Elasticsearch::Util qw(throw);
Subroutine BEGIN: called CC=1 SCAR=0.0
24 7 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 7 1;
27  
28 =pod
29  
30 =encoding UTF-8
31  
32 =head1 NAME
33  
34 Search::Elasticsearch::CxnPool::Static::NoPing - A CxnPool for connecting to a remote cluster without the ability to ping.
35  
36 =head1 VERSION
37  
38 version 8.12
39  
40 =head1 SYNOPSIS
41  
42 $e = Search::Elasticsearch->new(
43 cxn_pool => 'Static::NoPing'
44 nodes => [
45 'search1:9200',
46 'search2:9200'
47 ],
48 );
49  
50 =head1 DESCRIPTION
51  
52 The L<Static::NoPing|Search::Elasticsearch::CxnPool::Static::NoPing> connection
53 pool (like the L<Static|Search::Elasticsearch::CxnPool::Static> pool) should be used
54 when your access to the cluster is limited. However, the C<Static> pool needs
55 to be able to ping nodes in the cluster, with a C<HEAD /> request. If you
56 can't ping your nodes, then you should use the C<Static::NoPing>
57 connection pool instead.
58  
59 Because the cluster cannot be pinged, this CxnPool cannot use a short
60 ping request to determine whether nodes are live or not - it just has to
61 send requests to the nodes to determine whether they are alive or not.
62  
63 Most of the time, a dead node will cause the request to fail quickly.
64 However, in situations where node failure takes time (eg malfunctioning
65 routers or firewalls), a failure may not be reported until the request
66 itself times out (see L<Search::Elasticsearch::Cxn/request_timeout>).
67  
68 Failed nodes will be retried regularly to check if they have recovered.
69  
70 This class does L<Search::Elasticsearch::Role::CxnPool::Static::NoPing> and
71 L<Search::Elasticsearch::Role::Is_Sync>.
72  
73 =head1 CONFIGURATION
74  
75 =head2 C<nodes>
76  
77 The list of nodes to use to serve requests. Can accept a single node,
78 multiple nodes, and defaults to C<localhost:9200> if no C<nodes> are
79 specified. See L<Search::Elasticsearch::Role::Cxn/node> for details of the node
80 specification.
81  
82 =head2 See also
83  
84 =over
85  
86 =item *
87  
88 L<Search::Elasticsearch::Role::Cxn/request_timeout>
89  
90 =item *
91  
92 L<Search::Elasticsearch::Role::Cxn/dead_timeout>
93  
94 =item *
95  
96 L<Search::Elasticsearch::Role::Cxn/max_dead_timeout>
97  
98 =back
99  
100 =head2 Inherited configuration
101  
102 From L<Search::Elasticsearch::Role::CxnPool::Static::NoPing>
103  
104 =over
105  
106 =item * L<max_retries|Search::Elasticsearch::Role::CxnPool::Static::NoPing/"max_retries">
107  
108 =back
109  
110 From L<Search::Elasticsearch::Role::CxnPool>
111  
112 =over
113  
114 =item * L<randomize_cxns|Search::Elasticsearch::Role::CxnPool/"randomize_cxns">
115  
116 =back
117  
118 =head1 METHODS
119  
120 =head2 C<next_cxn()>
121  
122 $cxn = $cxn_pool->next_cxn
123  
124 Returns the next available node in round robin fashion - either a live node
125 which has previously responded successfully, or a previously failed
126 node which should be retried. If all nodes are dead, it will throw
127 a C<NoNodes> error.
128  
129 =head2 Inherited methods
130  
131 From L<Search::Elasticsearch::Role::CxnPool::Static::NoPing>
132  
133 =over
134  
135 =item * L<should_mark_dead()|Search::Elasticsearch::Role::CxnPool::Static::NoPing/"should_mark_dead()">
136  
137 =item * L<schedule_check()|Search::Elasticsearch::Role::CxnPool::Static::NoPing/"schedule_check()">
138  
139 =back
140  
141 From L<Search::Elasticsearch::Role::CxnPool>
142  
143 =over
144  
145 =item * L<cxn_factory()|Search::Elasticsearch::Role::CxnPool/"cxn_factory()">
146  
147 =item * L<logger()|Search::Elasticsearch::Role::CxnPool/"logger()">
148  
149 =item * L<serializer()|Search::Elasticsearch::Role::CxnPool/"serializer()">
150  
151 =item * L<current_cxn_num()|Search::Elasticsearch::Role::CxnPool/"current_cxn_num()">
152  
153 =item * L<cxns()|Search::Elasticsearch::Role::CxnPool/"cxns()">
154  
155 =item * L<seed_nodes()|Search::Elasticsearch::Role::CxnPool/"seed_nodes()">
156  
157 =item * L<next_cxn_num()|Search::Elasticsearch::Role::CxnPool/"next_cxn_num()">
158  
159 =item * L<set_cxns()|Search::Elasticsearch::Role::CxnPool/"set_cxns()">
160  
161 =item * L<request_ok()|Search::Elasticsearch::Role::CxnPool/"request_ok()">
162  
163 =item * L<request_failed()|Search::Elasticsearch::Role::CxnPool/"request_failed()">
164  
165 =item * L<should_retry()|Search::Elasticsearch::Role::CxnPool/"should_retry()">
166  
167 =item * L<should_mark_dead()|Search::Elasticsearch::Role::CxnPool/"should_mark_dead()">
168  
169 =item * L<cxns_str()|Search::Elasticsearch::Role::CxnPool/"cxns_str()">
170  
171 =item * L<cxns_seeds_str()|Search::Elasticsearch::Role::CxnPool/"cxns_seeds_str()">
172  
173 =item * L<retries()|Search::Elasticsearch::Role::CxnPool/"retries()">
174  
175 =item * L<reset_retries()|Search::Elasticsearch::Role::CxnPool/"reset_retries()">
176  
177 =back
178  
179 =head1 AUTHOR
180  
181 Enrico Zimuel <enrico.zimuel@elastic.co>
182  
183 =head1 COPYRIGHT AND LICENSE
184  
185 This software is Copyright (c) 2024 by Elasticsearch BV.
186  
187 This is free software, licensed under:
188  
189 The Apache License, Version 2.0, January 2004
190  
191 =cut
192  
193 __END__
« Elasticsearch/Cxn/Factory.pm ↑ Summary Elasticsearch/Role/Is_Sync.pm »