Client/Core/3_0/Role/Helper/Scroll.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 55 CC 3 SCAR 13.3
CC
3
Cov
0%
scroll_request
6.0
DEMOLISH
6.0
es
2.0
CRAP 3.8
1 # OpenSearch::Client is an unofficial client for OpenSearch.
2 # It is derived from Search::Elasticsearch version 7.714
3 # License details from the original work are contained in the
4 # NOTICE file distributed with this work.
5 #
6 #-----------------------------------------------------------------------
7 # OpenSearch::Client
8 #-----------------------------------------------------------------------
9 # Copyright 2026 Mark Dootson
10 #
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
14 #
15 # http://www.apache.org/licenses/LICENSE-2.0
16 #
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
22  
23 package OpenSearch::Client::Core::3_0::Role::Helper::Scroll;
24 $OpenSearch::Client::Core::3_0::Role::Helper::Scroll::VERSION = '3.007011';
25 use Moo::Role;
26 requires 'finish';
27 use OpenSearch::Client::Util qw(parse_params throw);
28 use Devel::GlobalDestruction;
29 use namespace::clean;
30 has 'os' => ( is => 'ro', required => 1 );
31 has 'scroll' => ( is => 'ro' );
32 has 'total' => ( is => 'rwp' );
33 has 'max_score' => ( is => 'rwp' );
34 has 'facets' => ( is => 'rwp' );
35 has 'aggregations' => ( is => 'rwp' );
36 has 'suggest' => ( is => 'rwp' );
37 has 'took' => ( is => 'rwp' );
38 has 'total_took' => ( is => 'rwp' );
39 has 'search_params' => ( is => 'ro' );
40 has 'is_finished' => ( is => 'rwp', default => '' );
41 has '_pid' => ( is => 'ro', default => sub {$$} );
42 has '_scroll_id' => ( is => 'rwp', clearer => 1, predicate => 1 );
43  
44 ## help use of this as a drop in for Search::Elasticsearch
45 sub es { shift->os; }
46  
47 #===================================
48 sub scroll_request {
49 #===================================
50 my $self = shift;
51 throw( 'Illegal',
52 'Scroll requests are not fork safe and may only be '
53 . 'refilled by the same process that created the instance.' )
54 if $self->_pid != $$;
55  
56 my %args = ( scroll => $self->scroll );
57 $args{body} = { scroll_id => $self->_scroll_id };
58 $self->es->scroll(%args);
59 }
60  
61 #===================================
62 sub DEMOLISH {
63 #===================================
64 my $self = shift or return;
65 return if in_global_destruction;
66 $self->finish;
67 }
68  
69 1;
70  
71 __END__