[groonga-commit:3510] ranguba/hroonga [master] load command
null+ranguba at clear-code.com
null+ranguba at clear-code.com
Sat Jun 18 02:48:54 EDT 2011
SHIMODA Hiroshi 2011-06-18 06:48:54 +0000 (Sat, 18 Jun 2011)
New Revision: 05b25bf8efa73cab6e83ad77ec78242e9748b5c4
Log:
load command
Added files:
lib/hroonga/command/load.rb
Modified files:
lib/hroonga/command/dispatcher.rb
Modified: lib/hroonga/command/dispatcher.rb (+18 -2)
===================================================================
--- lib/hroonga/command/dispatcher.rb 2011-06-18 06:35:37 +0000 (a6601f4)
+++ lib/hroonga/command/dispatcher.rb 2011-06-18 06:48:54 +0000 (2ba813b)
@@ -23,6 +23,7 @@ require "hroonga/command/column-create"
require "hroonga/command/list"
require "hroonga/command/table-list"
require "hroonga/command/column-list"
+require "hroonga/command/load"
module Hroonga
module Command
@@ -49,10 +50,10 @@ module Hroonga
dispatch_table_command
when /\A\/[^\/\?]+\/columns\/[^\/\?]+\/?\z/
dispatch_column_command
+ when /\A\/[^\/\?]+\/records\/?\z/
+ dispatch_record_command
when /\A\/[^\/\?]+\/columns\/?\z/
ColumnList
- when /\A\/[^\/\?]+\/records\/?\z/
- RecordSelect
when /\A\/?\z/
TableList
else
@@ -82,6 +83,21 @@ module Hroonga
end
end
+ def dispatch_record_command
+ case request.method
+ when "GET"
+ RecordSelect
+ when "POST"
+ Load
+ when "PUT"
+ Load
+ when "DELETE"
+ Load
+ else
+ default_command
+ end
+ end
+
def default_command
nil # XXX this should return an error command
end
Added: lib/hroonga/command/load.rb (+42 -0) 100644
===================================================================
--- /dev/null
+++ lib/hroonga/command/load.rb 2011-06-18 06:48:54 +0000 (6b4377d)
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2011 SHIMODA Hiroshi <shimoda at clear-code.com>
+#
+# 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
+
+module Hroonga
+ module Command
+ class Load
+ include Utils
+
+ def initialize(config)
+ @config = config
+ end
+
+ def call(env)
+ @env = env
+ process_request
+ end
+
+ private
+ def process_request
+ load
+ successfully_processed_response
+ end
+
+ def load
+ end
+ end
+ end
+end
More information about the groonga-commit
mailing list