line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MogileFS::Class; |
2
|
21
|
|
|
21
|
|
91
|
use strict; |
|
21
|
|
|
|
|
28
|
|
|
21
|
|
|
|
|
628
|
|
3
|
21
|
|
|
21
|
|
90
|
use warnings; |
|
21
|
|
|
|
|
25
|
|
|
21
|
|
|
|
|
486
|
|
4
|
21
|
|
|
21
|
|
76
|
use MogileFS::Util qw(throw); |
|
21
|
|
|
|
|
28
|
|
|
21
|
|
|
|
|
791
|
|
5
|
21
|
|
|
21
|
|
6896
|
use MogileFS::Checksum; |
|
21
|
|
|
|
|
45
|
|
|
21
|
|
|
|
|
5865
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
MogileFS::Class - Class class. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new_from_args { |
14
|
0
|
|
|
0
|
0
|
|
my ($class, $args, $domain_factory) = @_; |
15
|
0
|
|
|
|
|
|
return bless { |
16
|
|
|
|
|
|
|
domain_factory => $domain_factory, |
17
|
|
|
|
|
|
|
mindevcount => 2, |
18
|
0
|
|
|
|
|
|
%{$args}, |
19
|
|
|
|
|
|
|
}, $class; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Instance methods: |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
0
|
0
|
|
sub id { $_[0]{classid} } |
25
|
0
|
|
|
0
|
0
|
|
sub name { $_[0]{classname} } |
26
|
0
|
|
|
0
|
0
|
|
sub mindevcount { $_[0]{mindevcount} } |
27
|
0
|
|
|
0
|
0
|
|
sub dmid { $_[0]{dmid} } |
28
|
0
|
|
|
0
|
0
|
|
sub hashtype { $_[0]{hashtype} } |
29
|
0
|
|
|
0
|
0
|
|
sub hashname { $MogileFS::Checksum::TYPE2NAME{$_[0]{hashtype}} } |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub hashtype_string { |
32
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
33
|
0
|
0
|
|
|
|
|
$self->hashtype ? $self->hashname : "NONE"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub repl_policy_string { |
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
38
|
0
|
0
|
|
|
|
|
return $self->{replpolicy} ? $self->{replpolicy} |
39
|
|
|
|
|
|
|
: 'MultipleHosts()'; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub repl_policy_obj { |
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
44
|
0
|
0
|
|
|
|
|
if (! $self->{_repl_policy_obj}) { |
45
|
0
|
|
|
|
|
|
my $polstr = $self->repl_policy_string; |
46
|
|
|
|
|
|
|
# Parses the string. |
47
|
0
|
|
|
|
|
|
$self->{_repl_policy_obj} = |
48
|
|
|
|
|
|
|
MogileFS::ReplicationPolicy->new_from_policy_string($polstr); |
49
|
|
|
|
|
|
|
} |
50
|
0
|
|
|
|
|
|
return $self->{_repl_policy_obj}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub domain { |
54
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
55
|
0
|
|
|
|
|
|
return $self->{domain_factory}->get_by_id($self->{dmid}); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub has_files { |
59
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
60
|
0
|
|
|
|
|
|
return Mgd::get_store()->class_has_files($self->{dmid}, $self->id); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub observed_fields { |
64
|
0
|
|
|
0
|
0
|
|
return {}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |