Class: KubeMQ::ServerInfo
- Inherits:
-
Object
- Object
- KubeMQ::ServerInfo
- Defined in:
- lib/kubemq/server_info.rb
Overview
Information about a KubeMQ broker returned by BaseClient#ping.
Instance Attribute Summary collapse
-
#host ⇒ String
readonly
Broker hostname or IP address.
-
#server_start_time ⇒ Integer
readonly
Broker start time as a Unix timestamp.
-
#server_up_time_seconds ⇒ Object
readonly
Returns the value of attribute server_up_time_seconds.
-
#version ⇒ String
readonly
Broker software version.
Class Method Summary collapse
-
.from_proto(ping_result) ⇒ ServerInfo
private
Constructs a ServerInfo from a protobuf ping result.
Instance Method Summary collapse
-
#initialize(host:, version:, server_start_time:, server_up_time_seconds:) ⇒ ServerInfo
constructor
Creates a new ServerInfo instance.
-
#to_s ⇒ String
Returns a human-readable summary of the server information.
Constructor Details
#initialize(host:, version:, server_start_time:, server_up_time_seconds:) ⇒ ServerInfo
Creates a new ServerInfo instance.
28 29 30 31 32 33 |
# File 'lib/kubemq/server_info.rb', line 28 def initialize(host:, version:, server_start_time:, server_up_time_seconds:) @host = host @version = version @server_start_time = server_start_time @server_up_time_seconds = server_up_time_seconds end |
Instance Attribute Details
#host ⇒ String (readonly)
Returns broker hostname or IP address.
20 21 22 |
# File 'lib/kubemq/server_info.rb', line 20 def host @host end |
#server_start_time ⇒ Integer (readonly)
Returns broker start time as a Unix timestamp.
20 |
# File 'lib/kubemq/server_info.rb', line 20 attr_reader :host, :version, :server_start_time, :server_up_time_seconds |
#server_up_time_seconds ⇒ Object (readonly)
Returns the value of attribute server_up_time_seconds.
20 |
# File 'lib/kubemq/server_info.rb', line 20 attr_reader :host, :version, :server_start_time, :server_up_time_seconds |
#version ⇒ String (readonly)
Returns broker software version.
20 |
# File 'lib/kubemq/server_info.rb', line 20 attr_reader :host, :version, :server_start_time, :server_up_time_seconds |
Class Method Details
.from_proto(ping_result) ⇒ ServerInfo
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.
Constructs a KubeMQ::ServerInfo from a protobuf ping result.
40 41 42 43 44 45 46 47 |
# File 'lib/kubemq/server_info.rb', line 40 def self.from_proto(ping_result) new( host: ping_result.Host, version: ping_result.Version, server_start_time: ping_result.ServerStartTime, server_up_time_seconds: ping_result.ServerUpTimeSeconds ) end |
Instance Method Details
#to_s ⇒ String
Returns a human-readable summary of the server information.
52 53 54 55 |
# File 'lib/kubemq/server_info.rb', line 52 def to_s "ServerInfo(host=#{@host}, version=#{@version}, " \ "up_time=#{@server_up_time_seconds}s)" end |