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:



46
47
48
# File 'lib/couchbase/diagnostics.rb', line 46

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



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

def details
  @details
end

#idString

Returns endpoint unique identifier.

Returns:

  • (String)

    endpoint unique identifier



21
22
23
# File 'lib/couchbase/diagnostics.rb', line 21

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)



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

def last_activity_us
  @last_activity_us
end

#localString

Returns local address of the connection.

Returns:

  • (String)

    local address of the connection



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

def local
  @local
end

#remoteString

Returns remote address of the connection.

Returns:

  • (String)

    remote address of the connection



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

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



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

def state
  @state
end

Instance Method Details

#to_json(*args) ⇒ Object



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

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