1
package MogileFS::DeviceState;
5
# read: can it serve traffic?
6
# drain: should its file_on be drained?
7
# new_files: does it get new files
8
# write: is it writable? (for instance, for deletes)
9
# dead: permanently dead, files lost, not coming back to service
18
# Note that 'dead' doesn't include 'drain', since that's
19
# handled (specially) by the reap job.
36
# returns undef if unknown state
38
my ($class, $state) = @_;
39
return $state ? $singleton->{$state} : undef;
42
sub should_drain { $_[0]->{drain} }
43
sub can_delete_from { $_[0]->{write} }
44
sub can_read_from { $_[0]->{read} }
45
sub should_get_new_files { $_[0]->{new_files} }
46
sub should_get_repl_files { $_[0]->{new_files} }
47
sub should_have_files { ! ($_[0]->{drain} || $_[0]->{dead}) }
48
sub should_monitor { $_[0]->{monitor} }
50
# named inconveniently so it's not taken to mean equalling string
52
sub is_perm_dead { $_[0]->{dead} }
54
sub should_wake_reaper { $_[0]->{dead} }
56
sub should_fsck_search_on {
58
return $ds->can_read_from || $ds->should_have_files;