Class: Couchbase::PingResult::ServiceInfo

Inherits:
Object
  • Object
show all
Defined in:
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:



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

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



114
115
116
# File 'lib/couchbase/diagnostics.rb', line 114

def error
  @error
end

#idString

Returns endpoint unique identifier.

Returns:

  • (String)

    endpoint unique identifier



102
103
104
# File 'lib/couchbase/diagnostics.rb', line 102

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)



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

def latency
  @latency
end

#localString

Returns local address of the connection.

Returns:

  • (String)

    local address of the connection



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

def local
  @local
end

#remoteString

Returns remote address of the connection.

Returns:

  • (String)

    remote address of the connection



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

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



111
112
113
# File 'lib/couchbase/diagnostics.rb', line 111

def state
  @state
end

Instance Method Details

#to_json(*args) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/couchbase/diagnostics.rb', line 131

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