Class: Couchbase::PingResult::ServiceInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/diagnostics.rb,
/code/couchbase-ruby-client/lib/couchbase/diagnostics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|self| ... } ⇒ ServiceInfo

Returns a new instance of ServiceInfo.

Yield Parameters:



128
129
130
131
# File 'lib/couchbase/diagnostics.rb', line 128

def initialize
  @error = nil
  yield self if block_given?
end

Instance Attribute Details

#errorString?

Returns optional string with additional explanation for the state.

Returns:

  • (String, nil)

    optional string with additional explanation for the state



116
117
118
# File 'lib/couchbase/diagnostics.rb', line 116

def error
  @error
end

#idString

Returns endpoint unique identifier.

Returns:

  • (String)

    endpoint unique identifier



104
105
106
# File 'lib/couchbase/diagnostics.rb', line 104

def id
  @id
end

#latencyInteger

Returns how long ago the endpoint was active (in microseconds).

Returns:

  • (Integer)

    how long ago the endpoint was active (in microseconds)



119
120
121
# File 'lib/couchbase/diagnostics.rb', line 119

def latency
  @latency
end

#localString

Returns local address of the connection.

Returns:

  • (String)

    local address of the connection



125
126
127
# File 'lib/couchbase/diagnostics.rb', line 125

def local
  @local
end

#remoteString

Returns remote address of the connection.

Returns:

  • (String)

    remote address of the connection



122
123
124
# File 'lib/couchbase/diagnostics.rb', line 122

def remote
  @remote
end

#stateSymbol

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

Returns:

  • (Symbol)

    state of the endpoint



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