Class: Missions::Registry

Inherits:
Object show all
Includes:
Omega::Server::Registry
Defined in:
lib/missions/registry.rb

Overview

Primary server side missions tracker

Constant Summary

Constants included from Omega::Server::Registry

Omega::Server::Registry::DEFAULT_COMMAND_POLL, Omega::Server::Registry::DEFAULT_EVENT_POLL, Omega::Server::Registry::DEFAULT_LOOP_POLL

Instance Attribute Summary

Attributes included from Omega::Server::Registry

#backup_excludes, #node, #retrieval, #user, #validation_methods

Instance Method Summary collapse

Methods included from Omega::Server::Registry

#<<, #cleanup_event, #clear!, #delete, #entities, #entity, #exclude_from_backup, #join, #on, #proxies_for, #proxy_for, #raise_event, #run, #running?, #safe_exec, #save, #start, #stop, #to_s, #update, #validation_callback

Constructor Details

#initializeRegistry

Initialize the Missions::Registry


46
47
48
49
50
51
52
53
54
55
56
# File 'lib/missions/registry.rb', line 46

def initialize
  init_registry

  exclude_from_backup Omega::Server::EventHandler

  # perform a few sanity checks on mission / update missing attributes
  on(:added)   { |m|    check_mission(m)    if m.is_a?(Mission) }

  # run local events
  run { run_events }
end

Instance Method Details

#restore(io) ⇒ Object

Override registry restore operation


59
60
61
62
63
64
65
66
67
# File 'lib/missions/registry.rb', line 59

def restore(io)
  super(io)

  # run through missions, restore callbacks from orig_callbacks
  self.safe_exec { |entities|
    entities.select { |e| e.is_a?(Mission) }.
             each   { |m| m.restore_callbacks }
  }
end