Class: Robots::SdrRepo::SdrIngest::CreateReplica

Inherits:
Robots::SdrRepo::SdrRobot show all
Defined in:
lib/sdr_ingest/create_replica.rb

Overview

A robot for creating new entries in the Archive Catalog for the object version

Instance Method Summary collapse

Methods inherited from Robots::SdrRepo::SdrRobot

#create_workflow_rows, #get_workflow_status, #get_workflow_xml, #process_item, #transmit, #update_workflow_error_status, #update_workflow_status

Constructor Details

#initialize(opts = {}) ⇒ CreateReplica

set workflow name, step name, log location, log severity level


16
17
18
# File 'lib/sdr_ingest/create_replica.rb', line 16

def initialize(opts = {})
  super(self.class.workflow_name, self.class.step_name, opts)
end

Instance Method Details

#create_replica(druid) ⇒ void

This method returns an undefined value.

Returns Craeate a replica bag for the new object version in the replica cache and update the Archive Catalog's replica table

Parameters:

  • druid (String)

    The item to be processed


31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sdr_ingest/create_replica.rb', line 31

def create_replica(druid)
  sdr_object = Replication::SdrObject.new(druid)
  latest_version_id = sdr_object.current_version_id
  sdr_object_version = Replication::SdrObjectVersion.new(sdr_object,latest_version_id)
  # Don't rescue any ReplicaExistsError here.
  @replica = sdr_object_version.create_replica
  @replica.get_bag_data
  @replica.catalog_replica_data
  # TODO: replicate to tape
  #replicate_to_tape
  # TODO: replicate to dpn
  #replicate_to_dpn
end

#perform(druid) ⇒ void

This method returns an undefined value.

Returns process an object from the queue through this robot See LyberCore::Robot#work

Parameters:

  • druid (String)

    The item to be processed


23
24
25
26
# File 'lib/sdr_ingest/create_replica.rb', line 23

def perform(druid)
  LyberCore::Log.debug("( #{__FILE__} : #{__LINE__} ) Enter perform")
  create_replica(druid)
end

#replicate_to_dpnObject


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/sdr_ingest/create_replica.rb', line 65

def replicate_to_dpn
  # TODO: create replica in a DPN cache?
  # https://consul.stanford.edu/display/SDRnew/SDR+Replication%2C+DPN+Integration
  # SDR-PC will run a DPN daemon process to handle async messaging
  # it will be able to push out to DPN one replica at a time, it will wait
  # for replication confirmation from DPN.  So it will queue and manage a queue.
  # It might be easiest to wrap the DPN gem in something that will monitor the
  # DPN-cache file system for new content and manage the push and cleanup.  The
  # DPN-cache location and the DPN-rsync deposit location will be config settings,
  # and the fixity algorithm will be a config setting.
  #
  # rsync -av ./{druid}_{ver}.tar [email protected]:/dpn_data/staging/
  # message DPN with:
  #    - druid-id, moab-version, file-name, fixity as sha256 on tar file
  # async DPN response:
  #    - druid-id, moab-version, file-name, fixity, dpn-id
end

#replicate_to_tapeObject


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/sdr_ingest/create_replica.rb', line 45

def replicate_to_tape
  # TODO: push replica to tape?
  # https://consul.stanford.edu/display/SDRnew/SDR+Replication%2C+TSM+Integration
  # Use @replica.bag_pathname
  #dsmc archive
  #http://pic.dhe.ibm.com/infocenter/tsminfo/v6r2/index.jsp?topic=%2Fcom.ibm.itsm.client.doc%2Fc_arc_cmdlinewin.html
  # archive name:
  # 'google spanish collection at /gfetch/languages/spanish/'
  #
  # The data is mostly in the downloads at:
  # ls /gfetch/languages/spanish/download_ouput/
  #
  # The TSM archive session is something like the following:
  #
  # mkdir ~/tsm
  # touch ~/tsm/dsm_error.log  # use a log file with r/w access for gfetch user
  # dsmc -errorlogname=~/tsm/dsm_error.log
  # tsm> ar /home/gfetch/rnanders/* -subdir=yes -desc="Richard Anderson gfetch files in /home/gfetch/rnanders"
end

#verification_files(druid) ⇒ Object


88
89
90
91
# File 'lib/sdr_ingest/create_replica.rb', line 88

def verification_files(druid)
  files = []
  files
end

#verification_queries(druid) ⇒ Object


83
84
85
86
# File 'lib/sdr_ingest/create_replica.rb', line 83

def verification_queries(druid)
  queries = []
  queries
end