Class: Bundler::CompactIndexClient
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Exceptions:
| |
Inherits: | Object |
Defined in: | lib/bundler/compact_index_client.rb, lib/bundler/compact_index_client/cache.rb, lib/bundler/compact_index_client/cache_file.rb, lib/bundler/compact_index_client/gem_parser.rb, lib/bundler/compact_index_client/parser.rb, lib/bundler/compact_index_client/updater.rb |
Overview
The CompactIndexClient is responsible for fetching and parsing the compact index.
The compact index is a set of caching optimized files that are used to fetch gem information. The files are:
-
names: a list of all gem names
-
versions: a list of all gem versions
-
info/: a list of all versions of a gem
The client is instantiated with:
-
directory
: the root directory where the cache files are stored. -
fetcher
: (optional) an object that responds to #call(uri_path, headers) and returns an http response.
If the fetcher
is not provided, the client will only read cached files from disk.
The client is organized into:
-
Updater
: updates the cached files on disk using the fetcher. -
Cache
: calls the updater, caches files, read and return them from disk -
Parser
: parses the compact index file data -
CacheFile
: a concurrency safe file reader/writer that verifies checksums
The client is intended to optimize memory usage and performance. It is called 100s or 1000s of times, parsing files with hundreds of thousands of lines. It may be called concurrently without global interpreter lock in some Rubies. As a result, some methods may look more complex than necessary to save memory or time.
Constant Summary
-
DEBUG_MUTEX =
# File 'lib/bundler/compact_index_client.rb', line 36Thread::Mutex.new
-
INFO_DEPS =
# File 'lib/bundler/compact_index_client.rb', line 423
-
INFO_NAME =
info returns an Array of INFO Arrays. Each INFO Array has the following indices:
0
-
INFO_PLATFORM =
# File 'lib/bundler/compact_index_client.rb', line 412
-
INFO_REQS =
# File 'lib/bundler/compact_index_client.rb', line 434
-
INFO_VERSION =
# File 'lib/bundler/compact_index_client.rb', line 401
-
SUPPORTED_DIGESTS =
NOTE: MD5 is here not because we expect a server to respond with it, but because we use it to generate the etag on first request during the upgrade to the compact index client that uses opaque etags saved to files. Remove once 2.5.0 has been out for a while.
{ "sha-256" => :SHA256, "md5" => :MD5 }.freeze
Class Method Summary
Instance Attribute Summary
- #available? ⇒ Boolean readonly
Instance Method Summary
Constructor Details
.new(directory, fetcher = nil) ⇒ CompactIndexClient
Class Method Details
.debug
[ GitHub ]# File 'lib/bundler/compact_index_client.rb', line 45
def self.debug return unless ENV["DEBUG_COMPACT_INDEX"] DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") } end