# File lib/fsdb/database.rb, line 333
  def browse(path = "/")                # :yields: object
    abs_path = absolute(path)
    file_id = get_file_id(abs_path)
    
    ## put these outside method, and pass in params?
    do_when_first = proc do |cache_entry|
      raise if cache_entry.file_handle

      begin
        f = File.open(abs_path, "r")
      rescue Errno::ENOENT
        raise MissingFileError
      rescue Errno::EINTR
        retry
      end

      cache_entry.file_handle = f
      f.lock_shared
      identify_file_type(f, path) ## could avoid if cache_object says so
      object = cache_object(f, cache_entry)
    end
    
    do_when_last = proc do |cache_entry|
      # last one out closes the file
      f = cache_entry.file_handle
      if f
        f.close
        cache_entry.file_handle = nil
      end
    end
    
    object_shared(file_id, do_when_first, do_when_last) do |cache_entry|
      object = cache_entry.just_gimme_the_damn_object!
      yield object
    end
  rescue MissingFileError
    clear_entry(file_id)
    default_browse(path) {|x| yield x}
  rescue AbortedTransaction
  end