Class: Couchbase::DiagnosticsResult::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:



44
45
46
# File 'lib/couchbase/diagnostics.rb', line 44

def initialize
  yield self if block_given?
end

Instance Attribute Details

#detailsString?

Returns optional string with additional explanation for the state.

Returns:

  • (String, nil)

    optional string with additional explanation for the state



32
33
34
# File 'lib/couchbase/diagnostics.rb', line 32

def details
  @details
end

#idString

Returns endpoint unique identifier.

Returns:

  • (String)

    endpoint unique identifier



19
20
21
# File 'lib/couchbase/diagnostics.rb', line 19

def id
  @id
end

#last_activity_usInteger

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

Returns:

  • (Integer)

    how long ago the endpoint was active (in microseconds)



35
36
37
# File 'lib/couchbase/diagnostics.rb', line 35

def last_activity_us
  @last_activity_us
end

#localString

Returns local address of the connection.

Returns:

  • (String)

    local address of the connection



41
42
43
# File 'lib/couchbase/diagnostics.rb', line 41

def local
  @local
end

#remoteString

Returns remote address of the connection.

Returns:

  • (String)

    remote address of the connection



38
39
40
# File 'lib/couchbase/diagnostics.rb', line 38

def remote
  @remote
end

#stateSymbol

Possible states are:

:disconnected

the endpoint is not reachable

:connecting

currently connecting (includes auth, handshake, etc.)

:connected

connected and ready

:disconnecting

disconnecting (after being connected)

Returns:

  • (Symbol)

    state of the endpoint



29
30
31
# File 'lib/couchbase/diagnostics.rb', line 29

def state
  @state
end

Instance Method Details

#to_json(*args) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/couchbase/diagnostics.rb', line 48

def to_json(*args)
  data = {
    id: @id,
    state: @state,
    remote: @remote,
    local: @local,
  }
  data[:details] = @details if @details
  data[:last_activity_us] = @last_activity_us if @last_activity_us
  data.to_json(*args)
end