Yoji Shidara
null+****@clear*****
Fri Oct 11 14:48:15 JST 2013
Yoji Shidara 2013-10-11 14:48:15 +0900 (Fri, 11 Oct 2013) New Revision: dcfa0213893d221963dc0defef600367c96a46ba https://github.com/droonga/fluent-plugin-droonga/commit/dcfa0213893d221963dc0defef600367c96a46ba Message: Add WatchHandler Added files: lib/droonga/plugin/handler_watch.rb Added: lib/droonga/plugin/handler_watch.rb (+41 -0) 100644 =================================================================== --- /dev/null +++ lib/droonga/plugin/handler_watch.rb 2013-10-11 14:48:15 +0900 (c9d2c8d) @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2013 droonga project +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1 as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +require "droonga/handler" + +module Droonga + class WatchHandler < Droonga::Handler + Droonga::HandlerPlugin.register("watch", self) + + command "watch" + def watch(request) + p parse_request(request) + # TODO + end + + private + def parse_request(request) + user = request["user"] + condition = request["condition"] + route = request["route"] + raise "invalid request" if user.nil? || user.empty? || condition.nil? + query = condition.to_json + raise "too long query" if query.size > 4095 + [user, condition, query, route] + end + end +end -------------- next part -------------- HTML����������������������������...Download