anchor.diff:                   to_minute,
                    abort_outside}).
   
  --record(forced_compaction, {type, name}).
  +-record(forced_compaction, {type :: bucket | db | view,
  +                            name :: binary()}).
   
   % If N vbucket databases of a bucket need to be compacted, we trigger compaction
   % for all the vbucket databases of that bucket.
  
positive.code:                               [Type, Name, Reason])
              end,
  
              NewCompactors = dict:erase(Pid, Compactors),
              {next_state, StateName,
               State#state{forced_compactors=NewCompactors}};
          error ->
              ?log_error("Unexpected process termination ~p: ~p. Dying.",
                         [Pid, Reason]),
  
negative.code:         not_present ->
              false
      end.
  
  -spec register_forced_compaction(pid(), #forced_compaction{},
                                   #state{}) -> #state{}.
  register_forced_compaction(Pid, Compaction,
                      #state{running_forced_compactions=Compactions,
                             forced_compaction_pids=CompactionPids} = State) ->
      error = dict:find(Compaction, CompactionPids),
  
      NewCompactions = dict:store(Pid, Compaction, Compactions),
      NewCompactionPids = dict:store(Compaction, Pid, CompactionPids),
  
      State#state{running_forced_compactions=NewCompactions,
                  forced_compaction_pids=NewCompactionPids}.
  
  -spec unregister_forced_compaction(pid(), #state{}) -> #state{}.
  unregister_forced_compaction(Pid,
                               #state{running_forced_compactions=Compactions,
                                      forced_compaction_pids=CompactionPids} = State) ->
      Compaction = dict:fetch(Pid, Compactions),
  
      NewCompactions = dict:erase(Pid, Compactions),
      NewCompactionPids = dict:erase(Compaction, CompactionPids),
  
      State#state{running_forced_compactions=NewCompactions,
                  forced_compaction_pids=NewCompactionPids}.
  
  -spec is_already_being_compacted(#forced_compaction{}, #state{}) -> boolean().
  is_already_being_compacted(Compaction,
                             #state{running_forced_compactions=Compactions}) ->
      dict:find(Compaction, Compactions) =/= error.
  