Module: Gauge::Connector Private
- Defined in:
- lib/connector.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- GAUGE_PORT_ENV =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"GAUGE_INTERNAL_PORT"- API_PORT_ENV =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"GAUGE_API_PORT"- HOST_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'localhost'- @@executionSocket =
This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.
nil- @@apiSocket =
This classvariable is part of a private API. You should avoid using this classvariable if possible, as it may be removed or be changed in the future.
nil
Class Method Summary collapse
- .apiSocket ⇒ Object private
- .executionSocket ⇒ Object private
- .get_api_response(apiMessage) ⇒ Object private
- .get_unique_id ⇒ Object private
- .make_connections ⇒ Object private
- .message_length(socket) ⇒ Object private
- .step_value(text) ⇒ Object private
Class Method Details
.apiSocket ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'lib/connector.rb', line 30 def self.apiSocket @@apiSocket end |
.executionSocket ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/connector.rb', line 34 def self.executionSocket @@executionSocket end |
.get_api_response(apiMessage) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/connector.rb', line 58 def self.get_api_response(apiMessage) apiMessage. = get_unique_id dataLen = apiMessage.serialize_to_string.bytesize ProtocolBuffers::Varint.encode @@apiSocket, dataLen apiMessage.serialize(@@apiSocket) responseLen = (@@apiSocket) data = @@apiSocket.read responseLen = Gauge::Messages::APIMessage.parse(data) end |
.get_unique_id ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
69 70 71 |
# File 'lib/connector.rb', line 69 def self.get_unique_id rand(2**63-1) end |
.make_connections ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 41 |
# File 'lib/connector.rb', line 38 def self.make_connections @@executionSocket = TCPSocket.open(HOST_NAME, Runtime.portFromEnvVariable(GAUGE_PORT_ENV)) @@apiSocket = TCPSocket.open(HOST_NAME, Runtime.portFromEnvVariable(API_PORT_ENV)) end |
.message_length(socket) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 |
# File 'lib/connector.rb', line 43 def self.(socket) ProtocolBuffers::Varint.decode socket end |
.step_value(text) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/connector.rb', line 47 def self.step_value text stepValueRequest = Gauge::Messages::GetStepValueRequest.new(:stepText => text) apiMessage = Gauge::Messages::APIMessage.new(:messageType => Gauge::Messages::APIMessage::APIMessageType::GetStepValueRequest, :stepValueRequest => stepValueRequest) response = get_api_response(apiMessage) if (response. == Gauge::Messages::APIMessage::APIMessageType::ErrorResponse) puts "[Error] Failed to load step implementation. #{response.error.error}: \"#{text}\"" return '' end return response.stepValueResponse.stepValue.stepValue end |