Class: Couchbase::PingResult::ServiceInfo
- Inherits:
-
Object
- Object
- Couchbase::PingResult::ServiceInfo
- Defined in:
- lib/couchbase/diagnostics.rb
Instance Attribute Summary collapse
-
#error ⇒ String?
Optional string with additional explanation for the state.
-
#id ⇒ String
Endpoint unique identifier.
-
#latency ⇒ Integer
How long ago the endpoint was active (in microseconds).
-
#local ⇒ String
Local address of the connection.
-
#remote ⇒ String
Remote address of the connection.
-
#state ⇒ Symbol
Possible states are:.
Instance Method Summary collapse
-
#initialize {|self| ... } ⇒ ServiceInfo
constructor
A new instance of ServiceInfo.
- #to_json(*args) ⇒ Object
Constructor Details
#initialize {|self| ... } ⇒ ServiceInfo
Returns a new instance of ServiceInfo.
128 129 130 131 |
# File 'lib/couchbase/diagnostics.rb', line 128 def initialize @error = nil yield self if block_given? end |
Instance Attribute Details
#error ⇒ String?
Returns optional string with additional explanation for the state.
116 117 118 |
# File 'lib/couchbase/diagnostics.rb', line 116 def error @error end |
#id ⇒ String
Returns endpoint unique identifier.
104 105 106 |
# File 'lib/couchbase/diagnostics.rb', line 104 def id @id end |
#latency ⇒ Integer
Returns how long ago the endpoint was active (in microseconds).
119 120 121 |
# File 'lib/couchbase/diagnostics.rb', line 119 def latency @latency end |
#local ⇒ String
Returns local address of the connection.
125 126 127 |
# File 'lib/couchbase/diagnostics.rb', line 125 def local @local end |
#remote ⇒ String
Returns remote address of the connection.
122 123 124 |
# File 'lib/couchbase/diagnostics.rb', line 122 def remote @remote end |
#state ⇒ Symbol
Possible states are:
- :ok
-
endpoint is healthy
- :timeout
-
endpoint didn’t respond in time
- :error
-
request to endpoint has failed, see #error for additional details
113 114 115 |
# File 'lib/couchbase/diagnostics.rb', line 113 def state @state end |
Instance Method Details
#to_json(*args) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/couchbase/diagnostics.rb', line 133 def to_json(*args) data = { id: @id, state: @state, remote: @remote, local: @local, latency: @latency, } data[:error] = @error if @error data.to_json(*args) end |