Add couchbase with modifications, formalize broadcaster and make testable and some other stuff

This commit is contained in:
2014-03-06 18:08:39 +01:00
parent 3f117c76b0
commit 0e7a39b819
28 changed files with 456 additions and 35 deletions
+6
View File
@@ -0,0 +1,6 @@
module Qwaiter
module Broadcaster
extend ActiveSupport::Autoload
autoload :Faye
end
end
+10
View File
@@ -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
+27
View File
@@ -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