Brackup/Target/Filebased.pm

filter: Statementstmt 100% 22 / 22 Branchbran 66.6% 4 / 6 Conditioncond 80.0% 4 / 5 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 86.0% 37 / 43 CC 6 SCAR 11.8
CC
6
Cov
91%
chunkpath
5.1
metapath
2.0
BEGIN
1.0
CRAP 3.3
« Brackup/Dict/SQLite.pm ↑ Summary Brackup/PositionedChunk.pm »
1 package Brackup::Target::Filebased;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use base 'Brackup::Target';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # version >= 1.06: 01/23/0123456789abcdef...xxx.chunk
7 # 256 * 256 directories, then files. would need 2 billion
8 # files before leaves have 32k+ files, but at that point
9 # users are probably using better filesystems if they
10 # have 2+ billion inodes.
11 174 ▶sub chunkpath {
Subroutine chunkpath: called CC=5 SCAR=16.3
Pod undocumented
12 174 my ($self, $dig) = @_;
13 174 my @parts;
14 174 my $fulldig = $dig;
15  
16 174 $dig =~ s/^\w+://; # remove the "hashtype:" from beginning
17 174 ▶ $fulldig =~ s/:/./g if $self->nocolons; # Convert colons to dots if we've been asked to
Branch: 1 branch
BranchTrueFalseTotal
if $self->nocolons 0 174 174
18  
19 174 ▶ while (length $dig && @parts < 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $dig and @parts < 2) 348 174 522
Condition66%2/3
length $dig and @parts < 2
!ll&&!rl&&r
0174348
MC/DC50%1/2
length $dig and @parts < 2
length $dig @parts < 2
Truth table66%2/3
A and B
A= length $digB= @parts < 2
ABresult
0X0
100
111
20 348 ▶ $dig =~ s/^([0-9a-f]{2})// or die "Can't get 2 hex digits of $fulldig";
Branch: 1 branch
BranchTrueFalseTotal
$dig =~ s/^([0-9a-f]{2})// or die "Can't get 2 hex digits of $fulldig" 348 0 348
21 348 push @parts, $1;
22 }
23  
24 174 return join("/", @parts) . "/$fulldig.chunk";
25 }
26  
27 13 ▶sub metapath {
Subroutine metapath: called CC=2 SCAR=6.9
Pod undocumented
28 13 my ($self, $name) = @_;
29  
30 13 ▶ $name ||= '';
Condition100%2/2
$name ||= ""
l!l
310
MC/DC100%1/1
$name ||= ""
$name
Truth table100%2/2
A
A= $name
Aresult
11
00
31  
32 13 return "backups/$name";
33 }
34  
35 4 1;
« Brackup/Dict/SQLite.pm ↑ Summary Brackup/PositionedChunk.pm »