Sha256: ddf606db4140a8b6d8269891369010c5cf36d0394f549c1c1ccce2c95edf153d

Contents?: true

Size: 624 Bytes

Versions: 25

Compression:

Stored size: 624 Bytes

Contents

Server.api :stats do |params,user|
  if Rhosync.stats == true
    names = params[:names]
    if names
      Rhosync::Stats::Record.keys(names).to_json
    else
      metric = params[:metric]
      rtype = Rhosync::Stats::Record.rtype(metric)
      if rtype == 'zset'
        # returns [] if no results
        Rhosync::Stats::Record.range(metric,params[:start],params[:finish]).to_json 
      elsif rtype == 'string'
        Rhosync::Stats::Record.get_value(metric) || ''
      else
        raise ApiException.new(404, "Unknown metric")
      end
    end
  else
    raise ApiException.new(500, "Stats not enabled")
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
rhosync-2.1.2 lib/rhosync/api/stats.rb
rhosync-2.1.1 lib/rhosync/api/stats.rb
rhosync-2.1.0 lib/rhosync/api/stats.rb
rhosync-2.1.0.beta.2 lib/rhosync/api/stats.rb
rhosync-2.1.0.beta.1 lib/rhosync/api/stats.rb