| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBM::Deep::Sector::File; |
|
2
|
|
|
|
|
|
|
|
|
3
|
50
|
|
|
50
|
|
854
|
use 5.008_004; |
|
|
50
|
|
|
|
|
175
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
50
|
|
|
50
|
|
248
|
use strict; |
|
|
50
|
|
|
|
|
92
|
|
|
|
50
|
|
|
|
|
1211
|
|
|
6
|
50
|
|
|
50
|
|
270
|
use warnings FATAL => 'all'; |
|
|
50
|
|
|
|
|
94
|
|
|
|
50
|
|
|
|
|
2022
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
50
|
|
|
50
|
|
323
|
use base qw( DBM::Deep::Sector ); |
|
|
50
|
|
|
|
|
123
|
|
|
|
50
|
|
|
|
|
22454
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
50
|
|
|
50
|
|
25189
|
use DBM::Deep::Sector::File::BucketList (); |
|
|
50
|
|
|
|
|
145
|
|
|
|
50
|
|
|
|
|
1205
|
|
|
11
|
50
|
|
|
50
|
|
23001
|
use DBM::Deep::Sector::File::Index (); |
|
|
50
|
|
|
|
|
143
|
|
|
|
50
|
|
|
|
|
1284
|
|
|
12
|
50
|
|
|
50
|
|
23260
|
use DBM::Deep::Sector::File::Null (); |
|
|
50
|
|
|
|
|
147
|
|
|
|
50
|
|
|
|
|
1345
|
|
|
13
|
50
|
|
|
50
|
|
25813
|
use DBM::Deep::Sector::File::Reference (); |
|
|
50
|
|
|
|
|
147
|
|
|
|
50
|
|
|
|
|
1445
|
|
|
14
|
50
|
|
|
50
|
|
23359
|
use DBM::Deep::Sector::File::Scalar (); |
|
|
50
|
|
|
|
|
184
|
|
|
|
50
|
|
|
|
|
19065
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $STALE_SIZE = 2; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub base_size { |
|
19
|
71541
|
|
|
71541
|
0
|
104138
|
my $self = shift; |
|
20
|
71541
|
|
|
|
|
133709
|
return $self->engine->SIG_SIZE + $STALE_SIZE; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
|
|
0
|
0
|
0
|
sub free_meth { die "free_meth must be implemented in a child class" } |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub free { |
|
26
|
465
|
|
|
465
|
0
|
796
|
my $self = shift; |
|
27
|
|
|
|
|
|
|
|
|
28
|
465
|
|
|
|
|
1226
|
my $e = $self->engine; |
|
29
|
|
|
|
|
|
|
|
|
30
|
465
|
|
|
|
|
1237
|
$e->storage->print_at( $self->offset, $e->SIG_FREE ); |
|
31
|
|
|
|
|
|
|
# Skip staleness counter |
|
32
|
465
|
|
|
|
|
1643
|
$e->storage->print_at( $self->offset + $self->base_size, |
|
33
|
|
|
|
|
|
|
chr(0) x ($self->size - $self->base_size), |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
465
|
|
|
|
|
1965
|
my $free_meth = $self->free_meth; |
|
37
|
465
|
|
|
|
|
1153
|
$e->$free_meth( $self->offset, $self->size ); |
|
38
|
|
|
|
|
|
|
|
|
39
|
465
|
|
|
|
|
1393
|
return; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#=head2 load( $offset ) |
|
43
|
|
|
|
|
|
|
# |
|
44
|
|
|
|
|
|
|
#This will instantiate and return the sector object that represents the data |
|
45
|
|
|
|
|
|
|
#found at $offset. |
|
46
|
|
|
|
|
|
|
# |
|
47
|
|
|
|
|
|
|
#=cut |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub load { |
|
50
|
23033
|
|
|
23033
|
0
|
36161
|
my $self = shift; |
|
51
|
23033
|
|
|
|
|
40027
|
my ($engine, $offset) = @_; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# Add a catch for offset of 0 or 1 |
|
54
|
23033
|
100
|
100
|
|
|
81419
|
return if !$offset || $offset <= 1; |
|
55
|
|
|
|
|
|
|
|
|
56
|
23028
|
|
|
|
|
50413
|
my $type = $engine->storage->read_at( $offset, 1 ); |
|
57
|
23028
|
50
|
|
|
|
67319
|
return if $type eq chr(0); |
|
58
|
|
|
|
|
|
|
|
|
59
|
23028
|
100
|
100
|
|
|
137797
|
if ( $type eq $engine->SIG_ARRAY || $type eq $engine->SIG_HASH ) { |
|
|
|
100
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
60
|
8976
|
|
|
|
|
46507
|
return DBM::Deep::Sector::File::Reference->new({ |
|
61
|
|
|
|
|
|
|
engine => $engine, |
|
62
|
|
|
|
|
|
|
type => $type, |
|
63
|
|
|
|
|
|
|
offset => $offset, |
|
64
|
|
|
|
|
|
|
}); |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
# XXX Don't we need key_md5 here? |
|
67
|
|
|
|
|
|
|
elsif ( $type eq $engine->SIG_BLIST ) { |
|
68
|
5764
|
|
|
|
|
28175
|
return DBM::Deep::Sector::File::BucketList->new({ |
|
69
|
|
|
|
|
|
|
engine => $engine, |
|
70
|
|
|
|
|
|
|
type => $type, |
|
71
|
|
|
|
|
|
|
offset => $offset, |
|
72
|
|
|
|
|
|
|
}); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
elsif ( $type eq $engine->SIG_INDEX ) { |
|
75
|
4089
|
|
|
|
|
20116
|
return DBM::Deep::Sector::File::Index->new({ |
|
76
|
|
|
|
|
|
|
engine => $engine, |
|
77
|
|
|
|
|
|
|
type => $type, |
|
78
|
|
|
|
|
|
|
offset => $offset, |
|
79
|
|
|
|
|
|
|
}); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
elsif ( $type eq $engine->SIG_NULL ) { |
|
82
|
27
|
|
|
|
|
163
|
return DBM::Deep::Sector::File::Null->new({ |
|
83
|
|
|
|
|
|
|
engine => $engine, |
|
84
|
|
|
|
|
|
|
type => $type, |
|
85
|
|
|
|
|
|
|
offset => $offset, |
|
86
|
|
|
|
|
|
|
}); |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
elsif ( $type eq $engine->SIG_DATA || $type eq $engine->SIG_UNIDATA ) { |
|
89
|
4167
|
|
|
|
|
20258
|
return DBM::Deep::Sector::File::Scalar->new({ |
|
90
|
|
|
|
|
|
|
engine => $engine, |
|
91
|
|
|
|
|
|
|
type => $type, |
|
92
|
|
|
|
|
|
|
offset => $offset, |
|
93
|
|
|
|
|
|
|
}); |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
# This was deleted from under us, so just return and let the caller figure it out. |
|
96
|
|
|
|
|
|
|
elsif ( $type eq $engine->SIG_FREE ) { |
|
97
|
5
|
|
|
|
|
38
|
return; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
DBM::Deep->_throw_error( "'$offset': Don't know what to do with type '$type'" ); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
|
104
|
|
|
|
|
|
|
__END__ |