6_0/Role/Scroll.pm untested

filter: Statementstmt 0.0% 0 / 40 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 56 CC 4 SCAR 18.3
CC
4
Cov
0%
scroll_request
12.0
DEMOLISH
6.0
BEGIN
2.0
CRAP 6.2
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::Client::6_0::Role::Scroll;
19 $Search::Elasticsearch::Client::6_0::Role::Scroll::VERSION = '7.711001';
20 use Moo::Role;
21 requires 'finish';
22 use Search::Elasticsearch::Util qw(parse_params throw);
23 use Devel::GlobalDestruction;
24 use namespace::clean;
25 has 'es' => ( is => 'ro', required => 1 );
26 has 'scroll' => ( is => 'ro' );
27 has 'scroll_in_qs' => ( is => 'ro' );
28 has 'total' => ( is => 'rwp' );
29 has 'max_score' => ( is => 'rwp' );
30 has 'facets' => ( is => 'rwp' );
31 has 'aggregations' => ( is => 'rwp' );
32 has 'suggest' => ( is => 'rwp' );
33 has 'took' => ( is => 'rwp' );
34 has 'total_took' => ( is => 'rwp' );
35 has 'search_params' => ( is => 'ro' );
36 has 'is_finished' => ( is => 'rwp', default => '' );
37 has '_pid' => ( is => 'ro', default => sub {$$} );
38 has '_scroll_id' => ( is => 'rwp', clearer => 1, predicate => 1 );
39  
40 #===================================
41 sub scroll_request {
42 #===================================
43 my $self = shift;
44 throw( 'Illegal',
45 'Scroll requests are not fork safe and may only be '
46 . 'refilled by the same process that created the instance.' )
47 if $self->_pid != $$;
48  
49 my %args = ( scroll => $self->scroll );
50 if ( $self->scroll_in_qs ) {
51 $args{scroll_id} = $self->_scroll_id;
52 }
53 else {
54 $args{body} = { scroll_id => $self->_scroll_id };
55 }
56 $self->es->scroll(%args);
57 }
58  
59 #===================================
60 sub DEMOLISH {
61 #===================================
62 my $self = shift or return;
63 return if in_global_destruction;
64 $self->finish;
65 }
66  
67 1;
68  
69 # ABSTRACT: Provides common functionality to L<Search::Elasticsearch::Client::6_0::Scroll> and L<Search::Elasticsearch::Client::6_0::Async::Scroll>
70  
71 __END__