blib/lib/StorageDisplay/Data/Root.pm

filter: Statementstmt 96.0% 49 / 51 Branchbran 100% 10 / 10 Conditioncond 71.4% 5 / 7 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 3 totaltotal 87.9% 73 / 83 CC 9 SCAR 15.5
CC
9
Cov
94%
dotSubGraph
8.0
__ANON__
2.0
label
2.0
CRAP 4.7
« blib/lib/StorageDisplay/Data/RAID.pm ↑ Summary blib/lib/StorageDisplay.pm »
1 #
2 # This file is part of StorageDisplay
3 #
4 # This software is copyright (c) 2014-2023 by Vincent Danjean.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 package StorageDisplay::Data::Root;
13 # ABSTRACT: Handle machine data for StorageDisplay
14  
15 9 our $VERSION = '2.06'; # VERSION
16  
17 9 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 9 ▶use namespace::sweep;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 9 extends 'StorageDisplay::Data::Elem';
20  
21 9 with (
22 'StorageDisplay::Role::Style::IsSubGraph',
23 'StorageDisplay::Role::Style::Machine',
24 'StorageDisplay::Role::Elem::Kind'
25 => { kind => "machine" }
26 );
27  
28 9 has 'host' => (
29 is => 'ro',
30 isa => 'Str',
31 required => 1,
32 );
33  
34 7 ▶sub dotSubGraph {
Subroutine dotSubGraph: called CC=8 SCAR=20.8
Pod undocumented
35 7 my $self = shift;
36 7 ▶ my $t = shift // "\t";
Condition50%1/2
shift() // "\t"
l!l
70
MC/DC0%0/1
shift() // "\t"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
37  
38 7 my @text;
39 7 my @subnodes=$self->dotSubNodes($t);
40 7 $self->pushDotText(\@text, $t,
41 $self->dotSubNodes($t));
42  
43 7 my $it = $self->iterator(recurse => 1);
44 7 ▶ while (defined(my $e=$it->next)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $e = $it->next)) 550 7 557
45 550 my @links = $e->dotLinks($t, @_);
46 550 ▶ if (scalar(@links)>0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @links > 0) 114 436 550
47 114 $self->pushDotText(
48 \@text, $t,
49 '// Links from '.$e->dname,
50 @links,
51 );
52 }
53 }
54 7 $it = $self->iterator(recurse => 1);
55 7 ▶ while (defined(my $e=$it->next)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $e = $it->next)) 550 7 557
56 my @blocks = grep {
57 550 $_->provided
58 } $e->consumedBlocks;
59  
60 550 ▶ if (scalar(@blocks)>0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @blocks > 0) 147 403 550
61 $self->pushDotText(
62 \@text, $t,
63 '// Links for '.$e->dname,
64 147 (map { $_->elem->linkname.' -> '.$e->linkname } @blocks),
65 );
66 }
67 {
68 # No consumed block. Perhaps, we come from a VM provisionning
69 550 my @blocks = grep {
70 550 ▶ (!$_->provided)
Condition100%3/3
!$_->provided && $_->isa('StorageDisplay::Block::System')
!ll&&!rl&&r
1471514
MC/DC100%2/2
!$_->provided && $_->isa('StorageDisplay::Block::System')
!$_->provided $_->isa('StorageDisplay::Block::System')
Truth table100%3/3
not(A) && B
A= !$_->providedB= $_->isa('StorageDisplay::Block::System')
ABresult
0X0
100
111
71 && $_->isa('StorageDisplay::Block::System')
72 } $e->consumedBlocks;
73 550 ▶ if ($e->isa('StorageDisplay::Data::Partition::None')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e->isa("StorageDisplay::Data::Partition::None")) 3 547 550
74 3 push @blocks, $e->allProvidedBlocks;
75 }
76 $self->pushDotText(
77 \@text, $t,
78 '// Links for '.$e->dname,
79 (map {
80 550 "// TARGET LINK: ".$self->host." ".
81 $_->size." ".
82 $_->kname." ".$e->linkname} @blocks));
83  
84 }
85 }
86 7 return @text;
87 }
88  
89 7 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
90 7 my $orig = shift;
91 7 my $class = shift;
92 7 ▶ my $host = shift // 'machine';
Condition50%1/2
shift() // "machine"
l!l
70
MC/DC0%0/1
shift() // "machine"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
93  
94 7 return $class->$orig(
95 'name' => $host,
96 'host' => $host,
97 @_
98 );
99 9 };
100  
101 0 ▶sub label {
Subroutine label: not called CC=1 SCAR=6.9
Pod undocumented
102 0 my $self = shift;
103 0 return "COUCOU1".$self->host;
104 }
105  
106 7 ▶sub dotLabel {
Subroutine dotLabel: called CC=1 SCAR=0.0
Pod undocumented
107 7 my $self = shift;
108 7 return $self->host;
109 }
110  
111 9 1;
112  
113 __END__
« blib/lib/StorageDisplay/Data/RAID.pm ↑ Summary blib/lib/StorageDisplay.pm »