# File lib/fsdb/database.rb, line 378
  def edit(path = "/")
    abs_path = absolute(path)
    file_id = get_file_id(abs_path)
    object_exclusive file_id do |cache_entry|
      open_write_lock(abs_path) do |f|
        object = cache_object(f, cache_entry)
        result = yield object
        dump(object, f)
        cache_entry.update(f.mtime, inc_version_of(f, cache_entry), object)
        result
      end
    end
  rescue MissingFileError
    clear_entry(file_id)
    default_edit(path) {|x| yield x}
  rescue AbortedTransaction
    clear_entry(file_id) # The cached object may have edits which are not valid.
    nil
  rescue Exception
    clear_entry(file_id)
    raise
  end