| 1 | package Hadoop::IO::RCFile::Reader::FileStreamReader; | ||||||||||||||||||||||||||||
| 2 | 2 | $Hadoop::IO::RCFile::Reader::FileStreamReader::VERSION = '0.003'; | |||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use File::Spec; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Log::Log4perl; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Types::Standard qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | Dict | ||||||||||||||||||||||||||||
| 13 | HashRef | ||||||||||||||||||||||||||||
| 14 | InstanceOf | ||||||||||||||||||||||||||||
| 15 | Str | ||||||||||||||||||||||||||||
| 16 | 2 | ); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use constant { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 2 | STRING_CHUNK_SIZE => 10 * 1024**2, | |||||||||||||||||||||||||||
| 20 | ARRAY_CHUNK_SIZE => 1 * 1024**2, | ||||||||||||||||||||||||||||
| 21 | 2 | }; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 2 | has webhdfs_client => ( | |||||||||||||||||||||||||||
| 24 | is => 'ro', | ||||||||||||||||||||||||||||
| 25 | isa => InstanceOf['Net::Hadoop::WebHDFS::LWP'], | ||||||||||||||||||||||||||||
| 26 | required => 1, | ||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 2 | has file => ( | |||||||||||||||||||||||||||
| 30 | is => 'ro', | ||||||||||||||||||||||||||||
| 31 | isa => Str, | ||||||||||||||||||||||||||||
| 32 | required => 1, | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 2 | has _file_meta => ( | |||||||||||||||||||||||||||
| 36 | is => 'rw', | ||||||||||||||||||||||||||||
| 37 | isa => HashRef, # Dict? | ||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | has _reader_info => ( | |||||||||||||||||||||||||||
| 41 | is => 'rw', | ||||||||||||||||||||||||||||
| 42 | isa => HashRef, # Dict? | ||||||||||||||||||||||||||||
| 43 | ); | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 2 | has _web_reader_info => ( | |||||||||||||||||||||||||||
| 46 | is => 'rw', | ||||||||||||||||||||||||||||
| 47 | isa => HashRef, # Dict? | ||||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 2 | has log => ( | |||||||||||||||||||||||||||
| 51 | is => 'rw', | ||||||||||||||||||||||||||||
| 52 | isa => InstanceOf['Log::Log4perl::Logger'], | ||||||||||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub BUILD { | ||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 56 | 0 | my ($self, $args) = @_; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | $self->log(Log::Log4perl->get_logger("Hadoop::IO::RCFile::Reader::FileStreamReader")); | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | my $file = $self->file; | |||||||||||||||||||||||||||
| 61 | 0 | $self->log->debug("Retrieving file information for $file"); | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | my $hdfs_client = $self->webhdfs_client; | |||||||||||||||||||||||||||
| 64 | 0 | ▶ | my $file_meta = $hdfs_client->exists($file ) || die "$file does not exist!"; | ||||||||||||||||||||||||||
|
Condition0%0/2
$hdfs_client->exists($file) || die("$file does not exist!")
MC/DC0%0/1
$hdfs_client->exists($file) || die("$file does not exist!")
$hdfs_client->exists($file)
Truth table0%0/2
A
A= $hdfs_client->exists($file)
| |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | $self->log->debug("Got file meta for $file\n" . Dumper($file_meta)); | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if ($file_meta->{type} ne 'FILE') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 0 | die "$file is not a file"; | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | $self->_file_meta($file_meta); | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | $self->_reader_info({ file_len => $file_meta->{length}, | ||||||||||||||||||||||||||||
| 75 | 0 | file_offset => 0, | |||||||||||||||||||||||||||
| 76 | buffer_pos => 0, | ||||||||||||||||||||||||||||
| 77 | buffer_len => 0, | ||||||||||||||||||||||||||||
| 78 | raw_buffer => [], | ||||||||||||||||||||||||||||
| 79 | eof => 0, | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | ); | ||||||||||||||||||||||||||||
| 82 | $self->_web_reader_info({ file_len => $file_meta->{length}, | ||||||||||||||||||||||||||||
| 83 | 0 | file_offset => 0, | |||||||||||||||||||||||||||
| 84 | buffer_pos => 0, | ||||||||||||||||||||||||||||
| 85 | buffer_len => 0, | ||||||||||||||||||||||||||||
| 86 | raw_buffer => undef, | ||||||||||||||||||||||||||||
| 87 | eof => 0, | ||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | sub read_byte { | ||||||||||||||||||||||||||
|
Subroutine
read_byte: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 93 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 94 | 0 | my ($nread, $data) = $self->read(1); | |||||||||||||||||||||||||||
| 95 | 0 | ▶ | return $data->[0] if ($data && (ref($data) eq 'ARRAY')); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$data and ref $data eq "ARRAY"
MC/DC0%0/2
$data and ref $data eq "ARRAY"
$data
ref $data eq "ARRAY"
Truth table0%0/3
A and B
A= $dataB= ref $data eq "ARRAY"
| |||||||||||||||||||||||||||||
| 96 | 0 | return undef; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 0 | ▶ | sub read { | ||||||||||||||||||||||||||
|
Subroutine
read: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 100 | 0 | my ($self, $len) = @_; | |||||||||||||||||||||||||||
| 101 | 0 | ▶ | if ($len <= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 0 | return 0, []; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 0 | my $n = 0; | |||||||||||||||||||||||||||
| 106 | 0 | my @content; | |||||||||||||||||||||||||||
| 107 | 0 | while (1) { | |||||||||||||||||||||||||||
| 108 | 0 | my $nread = $self->_read($len - $n, \@content); | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ($nread <= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | ▶ | if ($n == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | 0 | return $nread, undef; | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | 0 | $n = $n + $nread; | |||||||||||||||||||||||||||
| 114 | 0 | return $n, \@content; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | 0 | $n = $n + $nread; | |||||||||||||||||||||||||||
| 117 | 0 | ▶ | if ($n >= $len) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 0 | return $n, \@content; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 0 | ▶ | sub _read { | ||||||||||||||||||||||||||
|
Subroutine
_read: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 124 | 0 | my ($self, $len, $container) = @_; | |||||||||||||||||||||||||||
| 125 | 0 | my $reader_info = $self->_reader_info; | |||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ($reader_info->{eof}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 0 | return -1, undef; | |||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | 0 | my $buffer_len = $reader_info->{buffer_len}; | |||||||||||||||||||||||||||
| 131 | 0 | my $buffer_pos = $reader_info->{buffer_pos}; | |||||||||||||||||||||||||||
| 132 | 0 | my $avail = $buffer_len - $buffer_pos; | |||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ($avail <= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | 0 | my $n = $self->_fill(); | |||||||||||||||||||||||||||
| 136 | 0 | ▶ | if ($n == -1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | 0 | return -1, undef; | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | 0 | return $self->_read($len, $container); | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | 0 | my $buffer = $reader_info->{raw_buffer}; | |||||||||||||||||||||||||||
| 142 | 0 | ▶ | if ($avail >= $len) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 0 | push @$container, @{$buffer}[ $buffer_pos .. ($buffer_pos + $len - 1) ]; | |||||||||||||||||||||||||||
| 144 | 0 | $buffer_pos = $buffer_pos + $len; | |||||||||||||||||||||||||||
| 145 | 0 | $reader_info->{buffer_pos} = $buffer_pos; | |||||||||||||||||||||||||||
| 146 | 0 | return $len; | |||||||||||||||||||||||||||
| 147 | } else { | ||||||||||||||||||||||||||||
| 148 | 0 | push @$container, @{$buffer}[ $buffer_pos .. ($buffer_pos + $avail - 1) ]; | |||||||||||||||||||||||||||
| 149 | 0 | $buffer_pos = $buffer_pos + $avail; | |||||||||||||||||||||||||||
| 150 | 0 | $reader_info->{buffer_pos} = $buffer_pos; | |||||||||||||||||||||||||||
| 151 | 0 | return $avail; | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub _fill { | ||||||||||||||||||||||||||
|
Subroutine
_fill: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 157 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 0 | my $hdfs_client = $self->webhdfs_client; | |||||||||||||||||||||||||||
| 160 | 0 | my $file = $self->file; | |||||||||||||||||||||||||||
| 161 | 0 | my $reader_info = $self->_reader_info; | |||||||||||||||||||||||||||
| 162 | 0 | my $offset = $reader_info->{file_offset}; | |||||||||||||||||||||||||||
| 163 | 0 | my $file_len = $reader_info->{file_len}; | |||||||||||||||||||||||||||
| 164 | 0 | my $file_remaining_len = $file_len - $offset; | |||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if ($file_remaining_len <= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 0 | $self->log->debug("We have reached end of file"); | |||||||||||||||||||||||||||
| 168 | 0 | $reader_info->{eof} = 1; | |||||||||||||||||||||||||||
| 169 | 0 | return -1; | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | 0 | ▶ | my $read_len = ($file_remaining_len >= ARRAY_CHUNK_SIZE) ? ARRAY_CHUNK_SIZE : $file_remaining_len; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | 0 | my $content = $self->_read_from_string_buffer($read_len); | |||||||||||||||||||||||||||
| 173 | 0 | my @content_b = unpack("c*", $content); | |||||||||||||||||||||||||||
| 174 | 0 | my $content_len = scalar @content_b; | |||||||||||||||||||||||||||
| 175 | 0 | delete $reader_info->{raw_buffer}; | |||||||||||||||||||||||||||
| 176 | 0 | $offset = $offset + $content_len; | |||||||||||||||||||||||||||
| 177 | 0 | $reader_info->{file_offset} = $offset; | |||||||||||||||||||||||||||
| 178 | 0 | $reader_info->{raw_buffer} = \@content_b; | |||||||||||||||||||||||||||
| 179 | 0 | $reader_info->{buffer_pos} = 0; | |||||||||||||||||||||||||||
| 180 | 0 | $reader_info->{buffer_len} = $content_len; | |||||||||||||||||||||||||||
| 181 | 0 | return $content_len; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub _read_from_string_buffer { | ||||||||||||||||||||||||||
|
Subroutine
_read_from_string_buffer: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 185 | 0 | my ($self, $len) = @_; | |||||||||||||||||||||||||||
| 186 | 0 | my $reader_info = $self->_web_reader_info; | |||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if ($reader_info->{eof}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | 0 | return -1, undef; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | 0 | my $buffer_len = $reader_info->{buffer_len}; | |||||||||||||||||||||||||||
| 192 | 0 | my $buffer_pos = $reader_info->{buffer_pos}; | |||||||||||||||||||||||||||
| 193 | 0 | my $avail = $buffer_len - $buffer_pos; | |||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 0 | ▶ | if ($avail <= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 196 | 0 | $self->log->debug("No data available in buffer, going to read from hdfs"); | |||||||||||||||||||||||||||
| 197 | 0 | my $n = $self->_read_data_from_hdfs(); | |||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ($n == -1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 0 | return -1, undef; | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | 0 | return $self->_read_from_string_buffer($len); | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | 0 | my $buffer = $reader_info->{raw_buffer}; | |||||||||||||||||||||||||||
| 204 | 0 | ▶ | if ($avail >= $len) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | 0 | my $content = substr $buffer, $buffer_pos, $len; | |||||||||||||||||||||||||||
| 206 | 0 | $buffer_pos = $buffer_pos + $len; | |||||||||||||||||||||||||||
| 207 | 0 | $reader_info->{buffer_pos} = $buffer_pos; | |||||||||||||||||||||||||||
| 208 | 0 | return $len, $content; | |||||||||||||||||||||||||||
| 209 | } else { | ||||||||||||||||||||||||||||
| 210 | 0 | $self->log->debug("Less data available in buffer then needed in _read2"); | |||||||||||||||||||||||||||
| 211 | 0 | my $content = substr $buffer, $buffer_pos; | |||||||||||||||||||||||||||
| 212 | 0 | $buffer_pos = $buffer_pos + $avail; | |||||||||||||||||||||||||||
| 213 | 0 | $reader_info->{buffer_pos} = $buffer_pos; | |||||||||||||||||||||||||||
| 214 | 0 | return $avail; | |||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 0 | ▶ | sub _read_data_from_hdfs { | ||||||||||||||||||||||||||
|
Subroutine
_read_data_from_hdfs: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 220 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 0 | my $hdfs_client = $self->webhdfs_client; | |||||||||||||||||||||||||||
| 223 | 0 | my $file = $self->file; | |||||||||||||||||||||||||||
| 224 | 0 | my $reader_info = $self->_web_reader_info; | |||||||||||||||||||||||||||
| 225 | 0 | my $offset = $reader_info->{file_offset}; | |||||||||||||||||||||||||||
| 226 | 0 | my $file_len = $reader_info->{file_len}; | |||||||||||||||||||||||||||
| 227 | 0 | my $file_remaining_len = $file_len - $offset; | |||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | 0 | ▶ | if ($file_remaining_len <= 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 230 | 0 | $self->log->debug("We have reached end of file"); | |||||||||||||||||||||||||||
| 231 | 0 | $reader_info->{eof} = 1; | |||||||||||||||||||||||||||
| 232 | 0 | return -1; | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | 0 | ▶ | my $read_len = ($file_remaining_len >= STRING_CHUNK_SIZE) ? STRING_CHUNK_SIZE : $file_remaining_len; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 0 | $self->log->debug("Going to read $read_len byte from file"); | |||||||||||||||||||||||||||
| 236 | 0 | my $content = $hdfs_client->read($file, | |||||||||||||||||||||||||||
| 237 | offset => $offset, | ||||||||||||||||||||||||||||
| 238 | length => $read_len, | ||||||||||||||||||||||||||||
| 239 | ); | ||||||||||||||||||||||||||||
| 240 | 0 | delete $reader_info->{raw_buffer}; | |||||||||||||||||||||||||||
| 241 | 0 | my $content_len = length $content; | |||||||||||||||||||||||||||
| 242 | 0 | $offset = $offset + $content_len; | |||||||||||||||||||||||||||
| 243 | 0 | $reader_info->{file_offset} = $offset; | |||||||||||||||||||||||||||
| 244 | 0 | $reader_info->{raw_buffer} = $content; | |||||||||||||||||||||||||||
| 245 | 0 | $reader_info->{buffer_pos} = 0; | |||||||||||||||||||||||||||
| 246 | 0 | $reader_info->{buffer_len} = $content_len; | |||||||||||||||||||||||||||
| 247 | 0 | return $content_len; | |||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 0 | ▶ | sub has_more { | ||||||||||||||||||||||||||
|
Subroutine
has_more: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 251 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 0 | my $hdfs_client = $self->webhdfs_client; | |||||||||||||||||||||||||||
| 254 | 0 | my $file = $self->file; | |||||||||||||||||||||||||||
| 255 | 0 | my $reader_info = $self->_reader_info; | |||||||||||||||||||||||||||
| 256 | 0 | my $buffer_len = $reader_info->{buffer_len}; | |||||||||||||||||||||||||||
| 257 | 0 | my $buffer_pos = $reader_info->{buffer_pos}; | |||||||||||||||||||||||||||
| 258 | 0 | my $avail = $buffer_len - $buffer_pos; | |||||||||||||||||||||||||||
| 259 | 0 | ▶ | return 1 if ($avail > 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 260 | 0 | my $offset = $reader_info->{file_offset}; | |||||||||||||||||||||||||||
| 261 | 0 | my $file_len = $reader_info->{file_len}; | |||||||||||||||||||||||||||
| 262 | 0 | my $file_remaining_len = $file_len - $offset; | |||||||||||||||||||||||||||
| 263 | 0 | ▶ | return 1 if ($file_remaining_len > 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 264 | 0 | $reader_info->{eof} = 1; | |||||||||||||||||||||||||||
| 265 | 0 | return 0; | |||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | 2 | 1; | |||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | __END__ | ||||||||||||||||||||||||||||