Module: DPN::Workers

Defined in:
lib/dpn/workers.rb,
lib/dpn/workers/sync.rb,
lib/dpn/workers/node.rb,
lib/dpn/workers/nodes.rb,
lib/dpn/workers/bag_ssh.rb,
lib/dpn/workers/job_data.rb,
lib/dpn/workers/sync_bag.rb,
lib/dpn/workers/sync_bags.rb,
lib/dpn/workers/bag_rsync.rb,
lib/dpn/workers/bag_paths.rb,
lib/dpn/workers/bag_worker.rb,
lib/dpn/workers/sync_nodes.rb,
lib/dpn/workers/sync_member.rb,
lib/dpn/workers/test_worker.rb,
lib/dpn/workers/sync_worker.rb,
lib/dpn/workers/sync_members.rb,
lib/dpn/workers/sync_content.rb,
lib/dpn/workers/test_messages.rb,
lib/dpn/workers/bag_replication.rb,
lib/dpn/workers/sync_replication.rb,
lib/dpn/workers/sync_replications.rb

Overview

DPN Workers

An application for synchronizing DPN registry data from remote nodes. This project uses Sidekiq background jobs.

Components:

  • the DPN nodes are defined in config/settings.yml
  • a set of DPN nodes is modeled by the Nodes class
    • it requires a local_namespace to identify a local_node
    • it makes an important distinction between a local_node and remote_nodes
    • it has methods to sync data from remote_nodes into the local_node
    • various SyncWorker call the sync method
    • various Sync implement the sync details
      • they use JobData for tracking success
  • a node is modeled by the Node class

Defined Under Namespace

Classes: BagPaths, BagReplication, BagRsync, BagSSH, BagWorker, JobData, Node, Nodes, Sync, SyncBag, SyncBags, SyncContent, SyncMember, SyncMembers, SyncNodes, SyncReplication, SyncReplications, SyncWorker, TestMessages, TestWorker

Class Method Summary collapse

Class Method Details

.create_logger(name) ⇒ Logger

Create a log file with monthly rotation


44
45
46
47
48
# File 'lib/dpn/workers.rb', line 44

def create_logger(name)
  logger = Logger.new(File.join('log', "#{name}.log"), 'monthly')
  logger.level = log_level
  logger
end

.nodesDPN::Workers::Nodes

Create a new instance of DPN::Workers::Nodes using the definition in SyncSettings.nodes and SyncSettings.local_namespace


36
37
38
39
# File 'lib/dpn/workers.rb', line 36

def nodes
  DPN::Workers::Nodes.new SyncSettings.nodes.map(&:to_hash),
                          SyncSettings.local_namespace
end