def refresh
      # This iteration might look scary as we iterate over the entries while
      # while we are rearranging them. Re-inserted items may be inserted
      # before or at the current entry and this is fine. They also may be
      # inserted after the current entry and will be re-read again unless they
      # are inserted after the original file end.
      file_size = @f.size

      # We don't update the index and the space list during this operation as
      # we defragmentize the blob file at the end. We'll end the operation
      # with an empty space list.
      clear_index_files

      @progressmeter.start('Converting objects to new storage format',
                           @f.size) do |pm|
        each_blob_header do |header|
          if header.is_valid?
            buf = read_obj_by_address(header.addr, header.id)
            delete_obj_by_address(header.addr, header.id)
            write_obj_by_id(header.id, buf)
          end

          # Some re-inserted blobs may be inserted after the original file end.
          # No need to process those blobs again.
          break if header.addr >= file_size

          pm.update(header.addr)
        end
      end

      # Reclaim the space saved by compressing entries.
      defragmentize

      # Recreate the index file and create an empty space list.
      regenerate_index_and_spaces
    end
def refresh
      # This iteration might look scary as we iterate over the entries while
      # while we are rearranging them. Re-inserted items may be inserted
      # before or at the current entry and this is fine. They also may be
      # inserted after the current entry and will be re-read again unless they
      # are inserted after the original file end.
      file_size = @f.size

      # We don't update the index and the space list during this operation as
      # we defragmentize the blob file at the end. We'll end the operation
      # with an empty space list.
      clear_index_files

      @progressmeter.start('Converting objects to new storage format',
                           @f.size) do |pm|
        each_blob_header do |header|
          if header.is_valid?
            buf = read_obj_by_address(header.addr, header.id)
            delete_obj_by_address(header.addr, header.id)
            write_obj_by_id(header.id, buf)
          end

          # Some re-inserted blobs may be inserted after the original file end.
          # No need to process those blobs again.
          break if header.addr >= file_size

          pm.update(header.addr)
        end
      end

      # Reclaim the space saved by compressing entries.
      defragmentize

      # Recreate the index file and create an empty space list.
      regenerate_index_and_spaces
    end
This method iterates over all entries in the FlatFile and removes the
 entry and inserts it again. This is useful to update all entries in
 case the storage format has changed.