File Coverage

blib/lib/MooseFS/ChunkInfo.pm
Criterion Covered Total %
statement 12 26 46.1
branch 0 2 0.0
condition 0 6 0.0
subroutine 4 6 66.6
pod 0 1 0.0
total 16 41 39.0


line stmt bran cond sub pod time code
1             package MooseFS::ChunkInfo;
2 1     1   44231 use strict;
  1         3  
  1         29  
3 1     1   5 use warnings;
  1         2  
  1         28  
4 1     1   867 use IO::Socket::INET;
  1         28892  
  1         11  
5 1     1   1845 use Moo;
  1         21615  
  1         8  
6              
7             extends 'MooseFS';
8              
9             sub BUILD {
10 0     0 0   my $self = shift;
11 0           my $s = $self->sock;
12 0           print $s pack('(LL)>', 514, 0);
13 0           my $header = $self->myrecv($s, 8);
14 0           my ($cmd, $length) = unpack('(LL)>', $header);
15 0 0 0       if ( $cmd == 515 and $length == 52 or $length == 76 ) {
      0        
16 0           my $data = $self->myrecv($s, $length);
17 0           my $d = substr($data, 0, 52);
18 0           my ($loopstart, $loopend, $del_invalid, $ndel_invalid, $del_unused, $ndel_unused, $del_dclean, $ndel_dclean, $del_ogoal, $ndel_ogoal, $rep_ugoal, $nrep_ugoal, $rebalance) = unpack('(LLLLLLLLLLLLL)>', $d);
19 0           $self->info({
20             loop_start => $loopstart,
21             loop_end => $loopend,
22             invalid_deletions => $del_invalid,
23             invalid_deletions_out_of => $del_invalid+$ndel_invalid,
24             unused_deletions => $del_unused,
25             unused_deletions_out_of => $del_unused+$ndel_unused,
26             disk_clean_deletions => $del_dclean,
27             disk_clean_deletions_out_of => $del_dclean+$ndel_dclean,
28             over_goal_deletions => $del_ogoal,
29             over_goal_deletions_out_of => $del_ogoal+$ndel_ogoal,
30             replications_under_goal => $rep_ugoal,
31             replications_under_goal_out_of => $rep_ugoal+$nrep_ugoal,
32             replocations_rebalance => $rebalance,
33             });
34             }
35 0           for my $key ( keys %{ $self->info } ) {
  0            
36 0     0     has $key => (is => 'ro', lazy => 1, default => sub {$self->info->{$key}} );
  0            
37             };
38             }
39              
40             1;