Add couchbase with modifications, formalize broadcaster and make testable and some other stuff
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
module Qwaiter
|
||||
module Broadcaster
|
||||
extend ActiveSupport::Autoload
|
||||
autoload :Faye
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,10 @@
|
||||
module Qwaiter
|
||||
module Broadcaster
|
||||
class Faye
|
||||
def broadcast(message)
|
||||
@uri ||= URI.parse(Qwaiter.event_host)
|
||||
Net::HTTP.post_form(@uri, :message => message.to_json)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
module Qwaiter
|
||||
module Counter
|
||||
mattr_accessor :connection
|
||||
|
||||
# mainly for testing purposes
|
||||
def self.set(key, value)
|
||||
connection.set(key, value)
|
||||
end
|
||||
|
||||
def self.get(key)
|
||||
connection.get(key).to_i
|
||||
end
|
||||
|
||||
def self.incr(*args)
|
||||
connection.incr(*args)
|
||||
end
|
||||
|
||||
def self.decr(*args)
|
||||
connection.decr(*args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# use the connection from couchbase-structures/documents
|
||||
# will be overwritten in the specs since flushing the real
|
||||
# thing is difficult
|
||||
Qwaiter::Counter.connection = $cb
|
||||
Reference in New Issue
Block a user