class Rhcf::Timeseries::RedisStringBasedStrategy

Public Instance Methods

events_for_subject_on(manager, subject, point, resolution_id, filter) click to toggle source
# File lib/rhcf/timeseries/redis_strategies.rb, line 46
def events_for_subject_on(manager, subject, point, resolution_id, filter)
  key = [manager.prefix, EVENT_SET_TOKEN, resolution_id, point, subject].join(NAMESPACE_SEPARATOR)
  events = manager.connection_to_use.smembers(key)
  events = events.select{|event| filter.match?(event) } if filter
  events
end
id() click to toggle source
# File lib/rhcf/timeseries/redis_strategies.rb, line 29
def id
  fail 'AbstractStrategy'
end
store_point_event(manager, resolution_name, resolution_value, subject_path, event_path) click to toggle source
# File lib/rhcf/timeseries/redis_strategies.rb, line 40
def store_point_event(manager, resolution_name, resolution_value, subject_path, event_path)
  key = [manager.prefix, EVENT_SET_TOKEN, resolution_name, resolution_value, subject_path].join(NAMESPACE_SEPARATOR)
  manager.connection_to_use.sadd(key, event_path)
  manager.connection_to_use.expire(key, DEFAULT_RESOLUTIONS_MAP[resolution_name][:ttl])
end
store_point_value(manager, subject_path, resolution_name, resolution_value, point_value, event_path) click to toggle source
# File lib/rhcf/timeseries/redis_strategies.rb, line 33
def store_point_value(manager, subject_path, resolution_name, resolution_value, point_value, event_path)
  store_point_event(manager, resolution_name, resolution_value, subject_path, event_path)
  key = [manager.prefix, EVENT_POINT_TOKEN ,subject_path, resolution_name, resolution_value, event_path].join(NAMESPACE_SEPARATOR)
  manager.connection_to_use.incrby(key, point_value)
  manager.connection_to_use.expire(key, DEFAULT_RESOLUTIONS_MAP[resolution_name][:ttl])
end