Class: RuntimeBridge
- Inherits:
-
Object
- Object
- RuntimeBridge
- Defined in:
- lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb
Overview
The RuntimeBridge class is a singleton class that serves as the entry point for interacting with Hypertube. It provides methods to activate and initialize the RuntimeBridge SDK. It supports both in-memory and TCP connections.
Class Method Summary collapse
-
.activate(license_key) ⇒ Integer
Activates RuntimeBridge with the provided license key and optionally with proxy data.
-
.add_config(priority, config_source) ⇒ Object
Adds configuration from the given source with specified priority.
-
.get_runtime_info(get_loaded_modules) ⇒ String
Gets information about the current runtime.
-
.http2(http2_connection_data) ⇒ RuntimeFactory
Initializes RuntimeBridge with an HTTP/2 connection to a remote machine.
-
.in_memory ⇒ RuntimeFactory
Initializes RuntimeBridge using an in-memory channel on the same machine.
-
.initialize_rc(config_name) ⇒ RuntimeContext
Initializes RuntimeContext for the given configuration name.
-
.set_config_source(config_source) ⇒ Object
Sets the configuration source for the RuntimeBridge SDK.
-
.set_working_directory(path) ⇒ Object
Sets the working directory for the RuntimeBridge SDK.
-
.tcp(tcp_connection_data) ⇒ RuntimeFactory
Initializes RuntimeBridge with a TCP connection to a remote machine.
-
.web_socket(ws_connection_data) ⇒ RuntimeFactory
Initializes RuntimeBridge with a WebSocket connection to a remote machine.
-
.with_config(path) ⇒ ConfigRuntimeFactory
Initializes RuntimeBridge with a custom configuration file.
Class Method Details
.activate(license_key) ⇒ Integer
Activates RuntimeBridge with the provided license key and optionally with proxy data.
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 64 def self.activate(license_key) if license_key != ActivationHelper.temporary_license_key ActivationHelper.temporary_license_key = license_key SdkMessageHelper.('SdkMessage', 'Activation') end ActivationHelper.temporary_license_key = license_key Transmitter.activate(license_key) rescue Exception => e SdkMessageHelper.('SdkException', e.) raise e end |
.add_config(priority, config_source) ⇒ Object
Adds configuration from the given source with specified priority.
109 110 111 112 113 114 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 109 def self.add_config(priority, config_source) ConfigSourceResolver.add_configs(priority, config_source) rescue Exception => e SdkMessageHelper.('SdkException', e.) raise e end |
.get_runtime_info(get_loaded_modules) ⇒ String
Gets information about the current runtime.
102 103 104 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 102 def self.get_runtime_info(get_loaded_modules) RuntimeLogger.get_runtime_info(get_loaded_modules) end |
.http2(http2_connection_data) ⇒ RuntimeFactory
Initializes RuntimeBridge with an HTTP/2 connection to a remote machine.
45 46 47 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 45 def self.http2(http2_connection_data) RuntimeFactory.new(ConnectionType::HTTP2, http2_connection_data) end |
.in_memory ⇒ RuntimeFactory
Initializes RuntimeBridge using an in-memory channel on the same machine.
22 23 24 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 22 def self.in_memory RuntimeFactory.new(ConnectionType::IN_MEMORY, nil) end |
.initialize_rc(config_name) ⇒ RuntimeContext
Initializes RuntimeContext for the given configuration name.
119 120 121 122 123 124 125 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 119 def self.initialize_rc(config_name) config = ConfigSourceResolver.get_config(config_name) RuntimeContext.initialize_runtime_context(config) rescue Exception => e SdkMessageHelper.('SdkException', e.) raise e end |
.set_config_source(config_source) ⇒ Object
Sets the configuration source for the RuntimeBridge SDK.
79 80 81 82 83 84 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 79 def self.set_config_source(config_source) Transmitter.set_config_source(config_source) rescue Exception => e SdkMessageHelper.('SdkException', e.) raise e end |
.set_working_directory(path) ⇒ Object
Sets the working directory for the RuntimeBridge SDK.
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 88 def self.set_working_directory(path) path.gsub!('\\', '/') path += '/' unless path.end_with?('/') FileUtils.mkdir_p(path, mode: 0o700) ActivationHelper.working_directory = path Transmitter.set_working_directory(path) rescue Exception => e SdkMessageHelper.('SdkException', e.) raise e end |
.tcp(tcp_connection_data) ⇒ RuntimeFactory
Initializes RuntimeBridge with a TCP connection to a remote machine.
30 31 32 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 30 def self.tcp(tcp_connection_data) RuntimeFactory.new(ConnectionType::TCP, tcp_connection_data) end |
.web_socket(ws_connection_data) ⇒ RuntimeFactory
Initializes RuntimeBridge with a WebSocket connection to a remote machine.
38 39 40 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 38 def self.web_socket(ws_connection_data) RuntimeFactory.new(ConnectionType::WEB_SOCKET, ws_connection_data) end |
.with_config(path) ⇒ ConfigRuntimeFactory
Initializes RuntimeBridge with a custom configuration file.
53 54 55 56 57 58 |
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 53 def self.with_config(path) ConfigRuntimeFactory.new(path) rescue Exception => e SdkMessageHelper.('SdkException', e.) raise e end |