Navigation Menu

Skip to content

Commit

Permalink
Add utility method to send Serf events and queries
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jun 27, 2014
1 parent 22cf097 commit ee0e271
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/droonga/serf.rb
Expand Up @@ -15,6 +15,8 @@

require "English"

require "json"

require "droonga/path"
require "droonga/loggable"
require "droonga/catalog_loader"
Expand Down Expand Up @@ -53,6 +55,18 @@ def load_status
end
{}
end

def send_event(name, event, payload)
serf = new(nul, name)
serf.run("event", JSON.generate(payload))
serf.shutdown
end

def send_query(name, query, payload)
serf = new(nul, name)
serf.run("query", JSON.generate(payload))
serf.shutdown
end
end

include Loggable
Expand Down

0 comments on commit ee0e271

Please sign in to comment.