Module: Nutella::Framework
- Defined in:
- lib/nutella_lib/framework_core.rb,
lib/nutella_lib/framework_log.rb,
lib/nutella_lib/framework_net.rb,
lib/nutella_lib/framework_persist.rb
Overview
Framework-level APIs sub-module
Defined Under Namespace
Class Method Summary collapse
-
.extract_component_id ⇒ String
Extracts the component name from the folder where the code for this component is located.
-
.init(broker_hostname, component_id) ⇒ Object
Initializes this component as a framework component.
- .log ⇒ Object
-
.net ⇒ Object
Accessors for sub-modules.
-
.parse_args(args) ⇒ Object
Parse command line arguments for framework-level components.
- .persist ⇒ Object
-
.set_resource_id(resource_id) ⇒ Object
Sets the resource id.
Class Method Details
.extract_component_id ⇒ String
Extracts the component name from the folder where the code for this component is located
43 44 45 |
# File 'lib/nutella_lib/framework_core.rb', line 43 def self.extract_component_id Nutella.extract_component_id end |
.init(broker_hostname, component_id) ⇒ Object
Initializes this component as a framework component
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/nutella_lib/framework_core.rb', line 8 def self.init( broker_hostname, component_id ) Nutella.app_id = nil Nutella.run_id = nil Nutella.component_id = component_id Nutella.resource_id = nil Nutella.mongo_host = broker_hostname Nutella.mqtt = SimpleMQTTClient.new broker_hostname # Start pinging Nutella.net.start_pinging # Fetch the `run_id`s list for this application and subscribe to its updates # net.async_request('app_runs_list', lambda { |res| Nutella.app.app_runs_list = res }) # self.net.subscribe('app_runs_list', lambda {|message, _| Nutella.app.app_runs_list = message }) end |
.log ⇒ Object
25 |
# File 'lib/nutella_lib/framework_core.rb', line 25 def self.log; Nutella::Framework::Log; end |
.net ⇒ Object
Accessors for sub-modules
24 |
# File 'lib/nutella_lib/framework_core.rb', line 24 def self.net; Nutella::Framework::Net; end |
.parse_args(args) ⇒ Object
Parse command line arguments for framework-level components
32 33 34 35 36 37 38 |
# File 'lib/nutella_lib/framework_core.rb', line 32 def self.parse_args(args) if args.length < 1 STDERR.puts 'Couldn\'t read broker address from the command line, impossible to initialize component!' return end return args[0] end |
.persist ⇒ Object
26 |
# File 'lib/nutella_lib/framework_core.rb', line 26 def self.persist; Nutella::Framework::Persist; end |
.set_resource_id(resource_id) ⇒ Object
Sets the resource id
50 51 52 |
# File 'lib/nutella_lib/framework_core.rb', line 50 def self.set_resource_id( resource_id ) Nutella.set_resource_id resource_id end |