Sha256: ab660183d2814c0e79034d4a8636dbb4469f9ceb760e46ebe1186efb90ae81ad
Contents?: true
Size: 1.06 KB
Versions: 11
Compression:
Stored size: 1.06 KB
Contents
module Ddr module Actions class FixityCheck # Return result of fixity check - wrapped by a notifier def self.execute(object) ActiveSupport::Notifications.instrument(Ddr::Notifications::FIXITY_CHECK) do |payload| payload[:result] = _execute(object) end end # Return result of fixity check def self._execute(object) Result.new(id: object.id).tap do |r| object.datastreams_to_validate.each do |dsid, ds| # r.success &&= ds.dsChecksumValid # r.results[dsid] = ds.profile checksum_valid = ds.check_fixity r.success &&= checksum_valid r.results[dsid] = { 'checksum_valid' => checksum_valid } end end end class Result attr_accessor :id, :success, :results, :checked_at def initialize(args={}) @id = args[:id] @success = args[:success] || true @results = args[:results] || {} @checked_at = args[:checked_at] || Time.now.utc end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems