Class: Downloadable::VerificationCache Private
- Includes:
- Context, Utils::Output::Mixin
- Defined in:
- downloadable.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Remembers which files have already been checksum-verified in this process, so the same unchanged file is not hashed once per download object that references it.
Instance Method Summary collapse
- #initialize ⇒ void constructor private
-
#verify(filename, checksum) ⇒ void
private
Verifies the file against the checksum unless this file, in this state, has already been verified against it in this process.
Methods included from Utils::Output::Mixin
#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning
Methods included from Context
current, current=, #debug?, #deferred_environment_expansion?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
26 27 28 |
# File 'downloadable.rb', line 26 def initialize @verified = T.let(Concurrent::Set.new, Concurrent::Set) end |
Instance Method Details
#verify(filename, checksum) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
Verifies the file against the checksum unless this file, in this state, has already been verified against it in this process.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'downloadable.rb', line 33 def verify(filename, checksum) key = key_for(filename, checksum) if key && @verified.include?(key) odebug "Skipping checksum verification for '#{filename.basename}' (already verified in this run)" return end ohai "Verifying checksum for '#{filename.basename}'" if verbose? filename.verify_checksum(checksum) @verified.add(key) if key end |