File Coverage

blib/lib/Elasticsearch/Role/Scroll.pm
Criterion Covered Total %
statement 12 21 57.1
branch 0 6 0.0
condition n/a
subroutine 4 6 66.6
pod 0 2 0.0
total 16 35 45.7


line stmt bran cond sub pod time code
1             package Elasticsearch::Role::Scroll;
2             $Elasticsearch::Role::Scroll::VERSION = '1.05';
3 1     1   724 use Moo::Role;
  1         2  
  1         7  
4             requires 'finish';
5 1     1   357 use Elasticsearch::Util qw(parse_params throw);
  1         2  
  1         9  
6 1     1   459 use Scalar::Util qw(weaken blessed);
  1         2  
  1         71  
7 1     1   6 use namespace::clean;
  1         2  
  1         7  
8              
9             has 'es' => ( is => 'ro', required => 1 );
10             has 'scroll' => ( is => 'ro' );
11             has 'total' => ( is => 'rwp' );
12             has 'max_score' => ( is => 'rwp' );
13             has 'facets' => ( is => 'rwp' );
14             has 'aggregations' => ( is => 'rwp' );
15             has 'suggest' => ( is => 'rwp' );
16             has 'took' => ( is => 'rwp' );
17             has 'total_took' => ( is => 'rwp' );
18             has 'search_params' => ( is => 'ro' );
19             has 'is_finished' => ( is => 'rwp', default => '' );
20             has '_scroll_id' => ( is => 'rwp', clearer => 1, predicate => 1 );
21              
22             #===================================
23             sub finish {
24             #===================================
25 0     0 0   my $self = shift;
26 0 0         return if $self->is_finished;
27 0           $self->_set_is_finished(1);
28              
29 0 0         my $scroll_id = $self->_scroll_id or return;
30 0           $self->_clear_scroll_id;
31 0           eval { $self->es->clear_scroll( scroll_id => $scroll_id ) };
  0            
32             }
33              
34             #===================================
35             sub DEMOLISH {
36             #===================================
37 0 0   0 0   my $self = shift or return;
38 0           $self->finish;
39             }
40              
41             1;
42              
43             # ABSTRACT: Provides common functionality to L<Elasticseach::Scroll> and L<Elasticsearch::Async::Scroll>
44              
45             __END__
46              
47             =pod
48              
49             =encoding UTF-8
50              
51             =head1 NAME
52              
53             Elasticsearch::Role::Scroll - Provides common functionality to L<Elasticseach::Scroll> and L<Elasticsearch::Async::Scroll>
54              
55             =head1 VERSION
56              
57             version 1.05
58              
59             =head1 AUTHOR
60              
61             Clinton Gormley <drtech@cpan.org>
62              
63             =head1 COPYRIGHT AND LICENSE
64              
65             This software is Copyright (c) 2014 by Elasticsearch BV.
66              
67             This is free software, licensed under:
68              
69             The Apache License, Version 2.0, January 2004
70              
71             =cut