class Longleaf::ServiceRecord

Record for an individual service in a file's metadata record.

Attributes

failure_timestamp[RW]
properties[R]
run_needed[RW]
stale_replicas[RW]
timestamp[RW]

Public Class Methods

new(properties: Hash.new, stale_replicas: false, timestamp: nil, run_needed: false) click to toggle source

@param properties [Hash] initial properties for this service record @param stale_replicas [Boolean] whether there are any stale replicas from this service @param timestamp [String] timestamp when this service last ran or was initialized @param run_needed [Boolean] flag indicating that this service should be run at the next available opportunity

# File lib/longleaf/models/service_record.rb, line 12
def initialize(properties: Hash.new, stale_replicas: false, timestamp: nil, run_needed: false)
  raise ArgumentError.new("Service properties must be a hash") if properties.class != Hash

  @properties = properties
  @timestamp = timestamp
  @stale_replicas = stale_replicas
  @run_needed = run_needed
end

Public Instance Methods

[](key) click to toggle source

@return the value of a service property identified by key

# File lib/longleaf/models/service_record.rb, line 22
def [](key)
  @properties[key]
end
[]=(key, value) click to toggle source

set the value of a service property identified by key

# File lib/longleaf/models/service_record.rb, line 27
def []=(key, value)
  @properties[key] = value
end