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.18.beta2 lib/rhosync/api/stats.rb
rhosync-2.1.18.beta1 lib/rhosync/api/stats.rb
rhosync-2.1.17 lib/rhosync/api/stats.rb
rhosync-2.1.17.beta7 lib/rhosync/api/stats.rb
rhosync-2.1.17.beta6 lib/rhosync/api/stats.rb
rhosync-2.1.17.beta5 lib/rhosync/api/stats.rb
rhosync-2.1.17.beta4 lib/rhosync/api/stats.rb
rhosync-2.1.17.beta3 lib/rhosync/api/stats.rb
rhosync-2.1.17.beta2 lib/rhosync/api/stats.rb
rhosync-2.1.17.beta1 lib/rhosync/api/stats.rb
rhosync-2.1.16 lib/rhosync/api/stats.rb
rhosync-2.1.15 lib/rhosync/api/stats.rb
rhosync-2.1.14 lib/rhosync/api/stats.rb
rhosync-2.1.13 lib/rhosync/api/stats.rb
rhosync-2.1.12 lib/rhosync/api/stats.rb
rhosync-2.1.11 lib/rhosync/api/stats.rb
rhosync-2.1.10 lib/rhosync/api/stats.rb
rhosync-2.1.7 lib/rhosync/api/stats.rb
rhosync-2.1.6 lib/rhosync/api/stats.rb
rhosync-2.1.3 lib/rhosync/api/stats.rb