anchor.diff:  %%% Internal functions
   %%%===================================================================
   
  +%% @doc Filter a list of manifests and accept only manifests whose
  +%% current state is specified in the `AcceptedStates' list.
  +-spec filter_manifests_by_state([lfs_manifest()], [atom()]) -> [lfs_manifest()].
  +filter_manifests_by_state(Manifests, AcceptedStates) ->
  +    AcceptManifest =
  +        fun ({_, ?MANIFEST{state=State}}) ->
  +                lists:member(State, AcceptedStates)
  +        end,
  +    lists:filter(AcceptManifest, Manifests).
  +
   orddict_values(OrdDict) ->
       %% orddict's are by definition
       %% represented as lists, so no
  
positive.code: %% export Public API
  -export([new/2,
           active_manifest/1,
           active_manifests/1,
           overwritten_UUIDs/1,
           mark_pending_delete/2,
           mark_scheduled_delete/2,
  
negative.code:     end.
  
  %% @doc Return a list of all manifests in the
  %% `active' or `writing' state
  -spec active_and_writing_manifests(term()) -> [lfs_manifest()].
  active_and_writing_manifests(Manifests) ->
      filter_manifests_by_state(Manifests, [active, writing]).
  
  %% @doc Mark all active manifests
  %% that are not "the most active"
  