Ravn::

Tactical module

Ravn Tactical – the front end user interface for direct interaction with a compute pack.

SBIR DATA RIGHTS

Contract No. FA8649-19-9-9031 Contractor Name: Ravn Inc. Contractor Address: 548 Market Street, PMB 80382, San Francisco, CA 94104, United States Expiration of SBIR Data Rights Period: 7 August 2039

The Government’s rights to use, modify, reproduce, release, perform, display, or disclose technical data or computer software marked with this legend are restricted during the period shown as provided in paragraph (b)(4) of the Rights in Noncommercial Technical Data and Computer Software—Small Business Innovation Research (SBIR) Program clause contained in the above identified contract. No restrictions apply after the expiration date shown above. Any reproduction of technical data, computer software, or portions thereof marked with this legend must also reproduce the markings.

:nocov:

Constants

DEFAULT_PORT

The default port the webservice listens on

Model

Set up an abstract base model class and a factory method for creating subclasses.

VERSION

Package version

Public Class Methods

add_failover_node( node )

Designate the given node as a failover, which allows it to become the control at some future point.

    # File lib/ravn/tactical.rb
208 def self::add_failover_node( node )
209     raise "Must be set up before registering failovers" unless self.is_set_up?
210 
211     self.log.info "Marking node 0x%s as a failover" % [ node.device_id ]
212     node.is_failover = true
213     node.save
214 end
control_device_id()

(Undocumented)

    # File lib/ravn/tactical.rb
184 def self::control_device_id
185     if self.is_control_node?
186         control_device_id = Ravn.device_id
187     else
188         control_device_id = Ravn::Tactical.control_node&.device_id
189     end
190 end
control_node()

Return the Node object of this node’s Control. Returns nil if this node doesn’t yet have one registered, including if it itself is a Control.

    # File lib/ravn/tactical.rb
155 def self::control_node
156     return nil if self.is_control_node?
157 
158     result = Ravn::Tactical::Node.control.all
159     raise "This host has more than one control!" if result.size > 1
160 
161     return result.first
162 end
failovers()

Return the Nodes that have been marked as failovers for this node’s Kit.

    # File lib/ravn/tactical.rb
194 def self::failovers
195     return Ravn::Tactical::Node.failovers.all
196 end
has_control_node?()

Returns true if this node has a control, and is not itself a control node.

    # File lib/ravn/tactical.rb
232 def self::has_control_node?
233     return ! self.is_control_node? && ! Ravn::Tactical::Node.empty?
234 end
is_control_node?()

Returns true if this node has been designated as a control node.

    # File lib/ravn/tactical.rb
225 def self::is_control_node?
226     return ! Ravn::Tactical::Node.local.empty?
227 end
is_set_up?()

Returns true if this host has been set up.

    # File lib/ravn/tactical.rb
218 def self::is_set_up?
219     return ! Ravn::Tactical::Node.empty?
220 end
local_node()

Return the Node object for the host. If the local node is not saved to the database (i.e., it is not a Control or a Failover), its id will be nil.

    # File lib/ravn/tactical.rb
148 def self::local_node
149     return Ravn::Tactical::Node.for_localhost
150 end
make_control_node()

Designate this host as a control node.

    # File lib/ravn/tactical.rb
166 def self::make_control_node
167     self.log.warn "Making this node a control node."
168     Ravn::Tactical::Node.register_self
169 end
production?()

Returns true if the app should be run in production mode.

    # File lib/ravn/tactical.rb
141 def self::production?
142     return self.environment != 'development' && !defined?( RSpec )
143 end
set_control_node( control_node )

Designate this host as a regular node that obeys the given control_node.

    # File lib/ravn/tactical.rb
173 def self::set_control_node( control_node )
174     if (current_control = self.control_node)
175         raise "Already controlled by %s" % [ current_control.device_id ]
176     end
177 
178     self.log.warn "Setting %p as the primary control node." % [ control_node ]
179     control_node.dup.save
180 end
start_changerunner()

Start the distributed change runner.

    # File lib/ravn/tactical.rb
129 def self::start_changerunner
130     Ravn::Tactical::ChangeRunner.start
131 end
start_discovery()

Start the discovery beacon (Ravn::Tactical::Discovery)

    # File lib/ravn/tactical.rb
117 def self::start_discovery
118     Ravn::Tactical::Discovery.start
119 end
stop_changerunner()

Stop the distributed change runner.

    # File lib/ravn/tactical.rb
135 def self::stop_changerunner
136     Ravn::Tactical::ChangeRunner.stop
137 end
stop_discovery()

Stop the discovery beacon (Ravn::Tactical::Discovery)

    # File lib/ravn/tactical.rb
123 def self::stop_discovery
124     Ravn::Tactical::Discovery.stop
125 end