class Bundler::CompactIndexClient

As a result, some methods may look more complex than necessary to save memory or time.
It may be called concurrently without global interpreter lock in some Rubies.
It is called 100s or 1000s of times, parsing files with hundreds of thousands of lines.
The client is intended to optimize memory usage and performance.
- ‘CacheFile`: a concurrency safe file reader/writer that verifies checksums
- `Parser`: parses the compact index file data
- `Cache`: calls the updater, caches files, read and return them from disk
- `Updater`: updates the cached files on disk using the fetcher.
The client is organized into:
If the `fetcher` is not provided, the client will only read cached files from disk.
- `fetcher`: (optional) an object that responds to #call(uri_path, headers) and returns an http response.
- `directory`: the root directory where the cache files are stored.
The client is instantiated with:
- info/: a list of all versions of a gem
- versions: a list of all gem versions
- names: a list of all gem names
The files are:
The compact index is a set of caching optimized files that are used to fetch gem information.
The CompactIndexClient is responsible for fetching and parsing the compact index.

def self.debug

def self.debug
  return unless ENV["DEBUG_COMPACT_INDEX"]
  DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") }
end

def available?

def available?
  Bundler::CompactIndexClient.debug { "available?" }
  @parser.available?
end

def dependencies(names)

def dependencies(names)
  Bundler::CompactIndexClient.debug { "dependencies(#{names})" }
  names.map {|name| info(name) }
end

def info(name)

def info(name)
  Bundler::CompactIndexClient.debug { "info(#{name})" }
  @parser.info(name)
end

def initialize(directory, fetcher = nil)

def initialize(directory, fetcher = nil)
  @cache = Cache.new(directory, fetcher)
  @parser = Parser.new(@cache)
end

def latest_version(name)

def latest_version(name)
  Bundler::CompactIndexClient.debug { "latest_version(#{name})" }
  @parser.info(name).map {|d| Gem::Version.new(d[INFO_VERSION]) }.max
end

def names

def names
  Bundler::CompactIndexClient.debug { "names" }
  @parser.names
end

def reset!

def reset!
  Bundler::CompactIndexClient.debug { "reset!" }
  @cache.reset!
end

def versions

def versions
  Bundler::CompactIndexClient.debug { "versions" }
  @parser.versions
end