Sha256: fe1a7caee49e9e8aab49b2b848b3724cdac2bc675bc7edb00990c859c0aa55ef
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module Ddr module Events class FixityCheckEvent < Event include PreservationEventBehavior include ReindexObjectAfterSave self.preservation_event_type = :fix self.description = "Validation of datastream checksums" DETAIL_PREAMBLE = "Datastream checksum validation results:" DETAIL_TEMPLATE = "%{dsid} ... %{validation}" # Message sent by ActiveSupport::Notifications def self.call(*args) notification = ActiveSupport::Notifications::Event.new(*args) result = notification.payload[:result] # FixityCheck::Result instance detail = [DETAIL_PREAMBLE] result.results.each do |dsid, dsProfile| validation = dsProfile["dsChecksumValid"] ? VALID : INVALID detail << DETAIL_TEMPLATE % {dsid: dsid, validation: validation} end create(pid: result.pid, event_date_time: notification.time, outcome: result.success ? SUCCESS : FAILURE, detail: detail.join("\n") ) end def to_solr { Ddr::Index::Fields::LAST_FIXITY_CHECK_ON => event_date_time_s, Ddr::Index::Fields::LAST_FIXITY_CHECK_OUTCOME => outcome } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ddr-models-3.0.0.alpha.2 | lib/ddr/events/fixity_check_event.rb |
ddr-models-3.0.0.alpha.1 | lib/ddr/events/fixity_check_event.rb |