Class: StatHat::Reporter

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/stathat.rb

Instance Method Summary collapse

Constructor Details

#initializeReporter

Returns a new instance of Reporter.



97
98
99
100
101
# File 'lib/stathat.rb', line 97

def initialize
        @que = Queue.new
        @runlock = Mutex.new
        run_pool()
end

Instance Method Details

#ez_post_count(stat_name, ezkey, count, timestamp, cb) ⇒ Object



132
133
134
135
136
137
138
# File 'lib/stathat.rb', line 132

def ez_post_count(stat_name, ezkey, count, timestamp, cb)
        args = { :stat => stat_name,
                :ezkey => ezkey,
                :count => count }
        args[:t] = timestamp unless timestamp.nil?
        enqueue(Common::EZ_URL, args, cb)
end

#ez_post_value(stat_name, ezkey, value, timestamp, cb) ⇒ Object



124
125
126
127
128
129
130
# File 'lib/stathat.rb', line 124

def ez_post_value(stat_name, ezkey, value, timestamp, cb)
        args = { :stat => stat_name,
                :ezkey => ezkey,
                :value => value }
        args[:t] = timestamp unless timestamp.nil?
        enqueue(Common::EZ_URL, args, cb)
end

#finishObject



103
104
105
106
# File 'lib/stathat.rb', line 103

def finish()
        stop_pool
        # XXX serialize queue?
end

#post_count(stat_key, user_key, count, timestamp, cb) ⇒ Object



116
117
118
119
120
121
122
# File 'lib/stathat.rb', line 116

def post_count(stat_key, user_key, count, timestamp, cb)
        args = { :key => stat_key,
                :ukey => user_key,
                :count => count }
        args[:t] = timestamp unless timestamp.nil?
        enqueue(Common::CLASSIC_COUNT_URL, args, cb)
end

#post_value(stat_key, user_key, value, timestamp, cb) ⇒ Object



108
109
110
111
112
113
114
# File 'lib/stathat.rb', line 108

def post_value(stat_key, user_key, value, timestamp, cb)
        args = { :key => stat_key,
                :ukey => user_key,
                :value => value }
        args[:t] = timestamp unless timestamp.nil?
        enqueue(Common::CLASSIC_VALUE_URL, args, cb)
end