class Consul::Async::ConsulResult

This keep track of answer from Consul It also keep statistics about result (x_consul_index, stats…)

Attributes

data[R]
http[R]
last_update[R]
retry_in[R]
stats[R]
x_consul_index[R]

Public Class Methods

new(data, modified, http, x_consul_index, stats, retry_in, fake: false) click to toggle source
# File lib/consul/async/consul_endpoint.rb, line 91
def initialize(data, modified, http, x_consul_index, stats, retry_in, fake: false)
  @data = data
  @modified = modified
  @http = http
  @x_consul_index = x_consul_index
  @last_update = Time.now.utc
  @stats = stats
  @retry_in = retry_in
  @fake = fake
end

Public Instance Methods

fake?() click to toggle source
# File lib/consul/async/consul_endpoint.rb, line 102
def fake?
  @fake
end
json() click to toggle source
# File lib/consul/async/consul_endpoint.rb, line 115
def json
  @data_json = JSON.parse(data) if @data_json.nil?
  @data_json
end
modified?() click to toggle source
# File lib/consul/async/consul_endpoint.rb, line 106
def modified?
  @modified
end
mutate(new_data) click to toggle source
# File lib/consul/async/consul_endpoint.rb, line 110
def mutate(new_data)
  @data = new_data.dup
  @data_json = nil
end
next_retry_at() click to toggle source
# File lib/consul/async/consul_endpoint.rb, line 120
def next_retry_at
  next_retry + last_update
end