class Gem::CompactIndexClient::Updater

Updates the cached files on disk, keeping them in sync with the server using conditional requests (ETag) and ranged requests where possible.

Public Class Methods

# File lib/rubygems/compact_index_client/updater.rb, line 24
def initialize(fetcher)
  @fetcher = fetcher
end

Public Instance Methods

# File lib/rubygems/compact_index_client/updater.rb, line 28
def update(remote_path, local_path, etag_path)
  append(remote_path, local_path, etag_path) || replace(remote_path, local_path, etag_path)
rescue CacheFile::DigestMismatchError => e
  raise MismatchedChecksumError.new(remote_path, e.message)
rescue Zlib::GzipFile::Error
  raise Error, "invalid gzip response while fetching /#{remote_path}"
end