fluent-plugin-droonga 0.9.0 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/Gemfile +8 -1
  4. data/fluent-plugin-droonga.gemspec +2 -2
  5. data/lib/droonga/adapter.rb +39 -0
  6. data/lib/droonga/adapter_runner.rb +99 -0
  7. data/lib/droonga/catalog/base.rb +11 -11
  8. data/lib/droonga/catalog/dataset.rb +54 -0
  9. data/lib/droonga/catalog/version1.rb +1 -1
  10. data/lib/droonga/collector.rb +5 -7
  11. data/lib/droonga/collector_plugin.rb +7 -7
  12. data/lib/droonga/command.rb +36 -0
  13. data/lib/droonga/{plugin/input_adapter/crud.rb → command_repository.rb} +14 -8
  14. data/lib/droonga/dispatcher.rb +86 -54
  15. data/lib/droonga/distributed_command_planner.rb +183 -0
  16. data/lib/droonga/distributor.rb +43 -17
  17. data/lib/droonga/handler.rb +13 -72
  18. data/lib/droonga/handler_message.rb +5 -5
  19. data/lib/droonga/handler_messenger.rb +4 -1
  20. data/lib/droonga/handler_plugin.rb +2 -2
  21. data/lib/droonga/handler_runner.rb +104 -0
  22. data/lib/droonga/input_message.rb +4 -4
  23. data/lib/droonga/legacy_pluggable.rb +66 -0
  24. data/lib/droonga/{input_adapter.rb → legacy_plugin.rb} +27 -22
  25. data/lib/droonga/{plugin_repository.rb → legacy_plugin_repository.rb} +2 -4
  26. data/lib/droonga/message_matcher.rb +101 -0
  27. data/lib/droonga/{input_adapter_plugin.rb → planner.rb} +14 -10
  28. data/lib/droonga/planner_plugin.rb +54 -0
  29. data/lib/droonga/pluggable.rb +9 -45
  30. data/lib/droonga/plugin.rb +9 -33
  31. data/lib/droonga/plugin/collector/basic.rb +2 -0
  32. data/lib/droonga/plugin/collector/search.rb +31 -37
  33. data/lib/droonga/plugin/{handler/groonga/table_remove.rb → metadata/adapter_message.rb} +23 -18
  34. data/lib/droonga/plugin/{handler/search.rb → metadata/handler_action.rb} +19 -15
  35. data/lib/droonga/plugin/metadata/input_message.rb +39 -0
  36. data/lib/droonga/plugin/planner/crud.rb +49 -0
  37. data/lib/droonga/plugin/{distributor → planner}/distributed_search_planner.rb +62 -70
  38. data/lib/droonga/plugin/{distributor → planner}/groonga.rb +11 -32
  39. data/lib/droonga/plugin/{distributor → planner}/search.rb +5 -5
  40. data/lib/droonga/plugin/{distributor → planner}/watch.rb +15 -6
  41. data/lib/droonga/plugin_loader.rb +10 -0
  42. data/lib/droonga/plugin_registerable.rb +34 -10
  43. data/lib/droonga/plugin_registry.rb +58 -0
  44. data/lib/droonga/plugins/crud.rb +124 -0
  45. data/lib/droonga/plugins/error.rb +50 -0
  46. data/lib/droonga/{output_adapter_plugin.rb → plugins/groonga.rb} +9 -13
  47. data/lib/droonga/plugins/groonga/column_create.rb +123 -0
  48. data/lib/droonga/plugins/groonga/generic_command.rb +65 -0
  49. data/lib/droonga/{plugin/output_adapter/groonga.rb → plugins/groonga/generic_response.rb} +16 -15
  50. data/lib/droonga/plugins/groonga/select.rb +124 -0
  51. data/lib/droonga/plugins/groonga/table_create.rb +106 -0
  52. data/lib/droonga/plugins/groonga/table_remove.rb +57 -0
  53. data/lib/droonga/plugins/search.rb +40 -0
  54. data/lib/droonga/plugins/watch.rb +156 -0
  55. data/lib/droonga/processor.rb +8 -10
  56. data/lib/droonga/searcher.rb +14 -4
  57. data/lib/droonga/searcher/mecab_filter.rb +67 -0
  58. data/lib/droonga/session.rb +5 -5
  59. data/lib/droonga/test.rb +1 -1
  60. data/lib/droonga/test/stub_handler_message.rb +1 -1
  61. data/lib/droonga/test/{stub_distributor.rb → stub_planner.rb} +1 -1
  62. data/lib/droonga/worker.rb +7 -8
  63. data/lib/fluent/plugin/out_droonga.rb +0 -1
  64. data/sample/cluster/catalog.json +2 -4
  65. data/sample/mecab_filter/data.grn +7 -0
  66. data/sample/mecab_filter/ddl.grn +7 -0
  67. data/sample/mecab_filter/search_with_mecab_filter.json +21 -0
  68. data/sample/mecab_filter/search_without_mecab_filter.json +21 -0
  69. data/test/command/config/default/catalog.json +2 -5
  70. data/test/command/suite/search/error/no-query.expected +13 -0
  71. data/test/command/suite/search/error/no-query.test +7 -0
  72. data/test/command/suite/search/error/unknown-source.expected +26 -0
  73. data/test/command/suite/watch/subscribe.expected +3 -3
  74. data/test/command/suite/watch/unsubscribe.expected +3 -3
  75. data/test/unit/catalog/test_dataset.rb +385 -0
  76. data/test/unit/catalog/test_version1.rb +111 -45
  77. data/test/unit/fixtures/catalog/version1.json +0 -3
  78. data/test/unit/helper.rb +2 -1
  79. data/test/unit/helper/distributed_search_planner_helper.rb +83 -0
  80. data/test/unit/plugin/collector/test_basic.rb +233 -376
  81. data/test/unit/plugin/collector/test_search.rb +8 -17
  82. data/test/unit/plugin/planner/search_planner/test_basic.rb +120 -0
  83. data/test/unit/plugin/planner/search_planner/test_group_by.rb +573 -0
  84. data/test/unit/plugin/planner/search_planner/test_output.rb +388 -0
  85. data/test/unit/plugin/planner/search_planner/test_sort_by.rb +938 -0
  86. data/test/unit/plugin/{distributor → planner}/test_search.rb +20 -75
  87. data/test/unit/{plugin/handler → plugins/crud}/test_add.rb +11 -11
  88. data/test/unit/plugins/groonga/select/test_adapter_input.rb +213 -0
  89. data/test/unit/{plugin/output_adapter/groonga/test_select.rb → plugins/groonga/select/test_adapter_output.rb} +12 -13
  90. data/test/unit/{plugin/handler → plugins}/groonga/test_column_create.rb +20 -5
  91. data/test/unit/{plugin/handler → plugins}/groonga/test_table_create.rb +5 -0
  92. data/test/unit/{plugin/handler → plugins}/groonga/test_table_remove.rb +8 -1
  93. data/test/unit/{plugin/handler → plugins}/test_groonga.rb +5 -5
  94. data/test/unit/{plugin/handler → plugins}/test_search.rb +21 -5
  95. data/test/unit/{plugin/handler → plugins}/test_watch.rb +29 -10
  96. data/{lib/droonga/command_mapper.rb → test/unit/test_command_repository.rb} +16 -22
  97. data/test/unit/{test_plugin.rb → test_legacy_plugin.rb} +3 -3
  98. data/test/unit/{test_plugin_repository.rb → test_legacy_plugin_repository.rb} +3 -3
  99. data/test/unit/test_message_matcher.rb +137 -0
  100. metadata +86 -66
  101. data/bin/grn2jsons +0 -82
  102. data/lib/droonga/distribution_planner.rb +0 -76
  103. data/lib/droonga/distributor_plugin.rb +0 -95
  104. data/lib/droonga/output_adapter.rb +0 -53
  105. data/lib/droonga/plugin/collector/groonga.rb +0 -83
  106. data/lib/droonga/plugin/distributor/crud.rb +0 -84
  107. data/lib/droonga/plugin/handler/add.rb +0 -109
  108. data/lib/droonga/plugin/handler/forward.rb +0 -75
  109. data/lib/droonga/plugin/handler/groonga.rb +0 -99
  110. data/lib/droonga/plugin/handler/groonga/column_create.rb +0 -106
  111. data/lib/droonga/plugin/handler/groonga/table_create.rb +0 -91
  112. data/lib/droonga/plugin/handler/watch.rb +0 -108
  113. data/lib/droonga/plugin/input_adapter/groonga.rb +0 -49
  114. data/lib/droonga/plugin/input_adapter/groonga/select.rb +0 -63
  115. data/lib/droonga/plugin/output_adapter/crud.rb +0 -51
  116. data/lib/droonga/plugin/output_adapter/groonga/select.rb +0 -54
  117. data/lib/groonga_command_converter.rb +0 -143
  118. data/sample/fluentd.conf +0 -8
  119. data/test/unit/plugin/distributor/test_search_planner.rb +0 -1102
  120. data/test/unit/plugin/input_adapter/groonga/test_select.rb +0 -248
  121. data/test/unit/test_command_mapper.rb +0 -44
  122. data/test/unit/test_groonga_command_converter.rb +0 -242
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2013 Droonga Project
1
+ # Copyright (C) 2013-2014 Droonga Project
4
2
  #
5
3
  # This library is free software; you can redistribute it and/or
6
4
  # modify it under the terms of the GNU Lesser General Public
@@ -16,7 +14,7 @@
16
14
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
15
 
18
16
  module Droonga
19
- class PluginRepository
17
+ class LegacyPluginRepository
20
18
  include Enumerable
21
19
 
22
20
  def initialize
@@ -0,0 +1,101 @@
1
+ # Copyright (C) 2014 Droonga Project
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License version 2.1 as published by the Free Software Foundation.
6
+ #
7
+ # This library is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
+ # Lesser General Public License for more details.
11
+ #
12
+ # You should have received a copy of the GNU Lesser General Public
13
+ # License along with this library; if not, write to the Free Software
14
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
+
16
+ module Droonga
17
+ # It checks whether the pattern matches against a message.
18
+ #
19
+ # It provides the small language. Here is the pattern syntax.
20
+ #
21
+ # * PATTERN = [TARGET_PATH, OPERATOR, ARGUMENTS*]
22
+ # * PATTERN = [PATTERN, LOGICAL_OPERATOR, PATTERN]
23
+ # * TARGET_PATH = "COMPONENT(.COMPONENT)*"
24
+ # * OPERATOR = :equal, :in, :include?, :exist?
25
+ # (More operators may be added in the future.
26
+ # For example, :start_with and so on.)
27
+ # * ARGUMENTS = OBJECT_DEFINED_IN_JSON*
28
+ # * LOGICAL_OPERATOR = :or (:add will be added.)
29
+ #
30
+ # For example:
31
+ #
32
+ # ```
33
+ # ["type", :equal, "search"]
34
+ # ```
35
+ #
36
+ # matches to the following message:
37
+ #
38
+ # ```
39
+ # {"type" => "search"}
40
+ # ```
41
+ #
42
+ # Another example:
43
+ #
44
+ # ```
45
+ # ["body.output.limit", :equal, 10]
46
+ # ```
47
+ #
48
+ # matches to the following message:
49
+ #
50
+ # ```
51
+ # {
52
+ # "body" => {
53
+ # "output" => {
54
+ # "limit" => 10,
55
+ # },
56
+ # },
57
+ # }
58
+ # ```
59
+ class MessageMatcher
60
+ # @param [Array] pattern The pattern to be matched against a message.
61
+ def initialize(pattern)
62
+ @pattern = pattern
63
+ end
64
+
65
+ def match?(message)
66
+ return false if @pattern.nil?
67
+ path, operator, *arguments = @pattern
68
+ target = resolve_path(path, message)
69
+ apply_operator(operator, target, arguments)
70
+ end
71
+
72
+ private
73
+ NONEXISTENT_PATH = Object.new
74
+ def resolve_path(path, message)
75
+ path.split(".").inject(message) do |result, component|
76
+ return NONEXISTENT_PATH unless result.is_a?(Hash)
77
+ result[component]
78
+ end
79
+ end
80
+
81
+ def apply_operator(operator, target, arguments)
82
+ case operator
83
+ when :equal
84
+ [target] == arguments
85
+ when :in
86
+ arguments.any? do |argument|
87
+ argument.include?(target)
88
+ end
89
+ when :include?
90
+ return false unless target.respond_to?(:include?)
91
+ arguments.any? do |argument|
92
+ target.include?(argument)
93
+ end
94
+ when :exist?
95
+ target != NONEXISTENT_PATH
96
+ else
97
+ raise ArgumentError, "Unknown operator"
98
+ end
99
+ end
100
+ end
101
+ end
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2013 Droonga Project
1
+ # Copyright (C) 2013-2014 Droonga Project
4
2
  #
5
3
  # This library is free software; you can redistribute it and/or
6
4
  # modify it under the terms of the GNU Lesser General Public
@@ -15,19 +13,25 @@
15
13
  # License along with this library; if not, write to the Free Software
16
14
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
15
 
18
- require "droonga/plugin"
16
+ require "droonga/legacy_pluggable"
17
+ require "droonga/planner_plugin"
19
18
 
20
19
  module Droonga
21
- class InputAdapterPlugin < Plugin
22
- extend PluginRegisterable
20
+ class Planner
21
+ include LegacyPluggable
23
22
 
24
- def initialize(dispatcher)
25
- super()
23
+ def initialize(dispatcher, plugins)
26
24
  @dispatcher = dispatcher
25
+ load_plugins(plugins)
26
+ end
27
+
28
+ private
29
+ def instantiate_plugin(name)
30
+ PlannerPlugin.repository.instantiate(name, self)
27
31
  end
28
32
 
29
- def forward(message, destination)
30
- @dispatcher.forward(message, destination)
33
+ def log_tag
34
+ "[#{Process.pid}] planner"
31
35
  end
32
36
  end
33
37
  end
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013-2014 Droonga Project
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License version 2.1 as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+
18
+ require "droonga/legacy_plugin"
19
+ require "droonga/distributed_command_planner"
20
+
21
+ module Droonga
22
+ class PlannerPlugin < LegacyPlugin
23
+ extend PluginRegisterable
24
+
25
+ def initialize(planner)
26
+ super()
27
+ @planner = planner
28
+ end
29
+
30
+ def scatter(message, options={})
31
+ planner = DistributedCommandPlanner.new(message)
32
+ planner.scatter
33
+ planner.key = options[:key]
34
+ planner.reduce(options[:reduce])
35
+ planner.plan
36
+ end
37
+
38
+ def broadcast(message, options={})
39
+ planner = DistributedCommandPlanner.new(message)
40
+ planner.broadcast(:write => options[:write])
41
+ planner.reduce(options[:reduce])
42
+ planner.plan
43
+ end
44
+
45
+ private
46
+ def process_error(command, error, arguments)
47
+ if error.is_a?(MessageProcessingError)
48
+ raise error
49
+ else
50
+ super
51
+ end
52
+ end
53
+ end
54
+ end
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2013 Droonga Project
1
+ # Copyright (C) 2014 Droonga Project
4
2
  #
5
3
  # This library is free software; you can redistribute it and/or
6
4
  # modify it under the terms of the GNU Lesser General Public
@@ -17,51 +15,17 @@
17
15
 
18
16
  module Droonga
19
17
  module Pluggable
20
- class UnknownPlugin < StandardError
21
- attr_reader :command
22
-
23
- def initialize(command)
24
- @command = command
25
- end
26
- end
27
-
28
- def shutdown
29
- $log.trace("#{log_tag}: shutdown: plugin: start")
30
- @plugins.each do |plugin|
31
- plugin.shutdown
32
- end
33
- $log.trace("#{log_tag}: shutdown: plugin: done")
34
- end
35
-
36
- def processable?(command)
37
- not find_plugin(command).nil?
38
- end
39
-
40
- def process(command, *arguments)
41
- plugin = find_plugin(command)
42
- $log.trace("#{log_tag}: process: start: <#{command}>",
43
- :plugin => plugin.class)
44
- raise UnknownPlugin.new(command) if plugin.nil?
45
- plugin.process(command, *arguments)
46
- $log.trace("#{log_tag}: process: done: <#{command}>",
47
- :plugin => plugin.class)
48
- end
49
-
50
- private
51
- def load_plugins(names)
52
- @plugins = names.collect do |name|
53
- plugin = instantiate_plugin(name)
54
- if plugin.nil?
55
- raise "unknown plugin: <#{name}>: TODO: improve error handling"
56
- end
57
- plugin
58
- end
18
+ def options
19
+ @options ||= {}
59
20
  end
60
21
 
61
- def find_plugin(command)
62
- @plugins.find do |plugin|
63
- plugin.processable?(command)
22
+ def find_sub_classes(names)
23
+ target_sub_classes = []
24
+ names.each do |name|
25
+ sub_classes = Plugin.registry.find_sub_classes(name, self)
26
+ target_sub_classes.concat(sub_classes)
64
27
  end
28
+ target_sub_classes
65
29
  end
66
30
  end
67
31
  end
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2013 Droonga Project
1
+ # Copyright (C) 2014 Droonga Project
4
2
  #
5
3
  # This library is free software; you can redistribute it and/or
6
4
  # modify it under the terms of the GNU Lesser General Public
@@ -15,38 +13,16 @@
15
13
  # License along with this library; if not, write to the Free Software
16
14
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
15
 
18
- require "droonga/plugin_registerable"
16
+ require "droonga/plugin_registry"
17
+ require "droonga/adapter"
18
+ require "droonga/handler"
19
19
 
20
20
  module Droonga
21
- class Plugin
22
- def initialize
23
- end
24
-
25
- def start
26
- end
27
-
28
- def shutdown
29
- end
30
-
31
- def processable?(command)
32
- self.class.processable?(command)
33
- end
34
-
35
- def process(command, *arguments)
36
- run_command(command, *arguments)
37
- rescue => exception
38
- process_error(command, exception, arguments)
39
- end
40
-
41
- private
42
- def run_command(command, *arguments)
43
- __send__(self.class.method_name(command), *arguments)
44
- end
45
-
46
- def process_error(command, error, arguments)
47
- Logger.error("error while processing #{command}",
48
- error,
49
- :arguments => arguments)
21
+ module Plugin
22
+ class << self
23
+ def registry
24
+ @@registry ||= PluginRegistry.new
25
+ end
50
26
  end
51
27
  end
52
28
  end
@@ -52,6 +52,8 @@ module Droonga
52
52
  case deal["type"]
53
53
  when "and"
54
54
  reduced_value = left_value && right_value
55
+ when "or"
56
+ reduced_value = left_value || right_value
55
57
  when "sum"
56
58
  reduced_value = sum(left_value, right_value)
57
59
  reduced_value = apply_output_range(reduced_value,
@@ -27,32 +27,24 @@ module Droonga
27
27
  if output.is_a?(Hash)
28
28
  elements = output["elements"]
29
29
  if elements && elements.is_a?(Hash)
30
- # phase 1: pre-process
31
- elements.each do |element, mapper|
32
- case mapper["type"]
33
- when "count"
34
- result[element] = result[mapper["target"]].size
35
- when "sort"
36
- # do nothing on this phase!
30
+ # because "count" mapper requires all records,
31
+ # I have to apply it at first, before "limit" and "offset" are applied.
32
+ count_mapper = elements["count"]
33
+ if count_mapper
34
+ if count_mapper["no_output"]
35
+ result.delete("count")
36
+ else
37
+ result["count"] = result[count_mapper["target"]].size
37
38
  end
38
39
  end
39
- # phase 2: post-process
40
- elements.each do |element, mapper|
41
- if mapper["no_output"]
42
- result.delete(element)
43
- next
44
- end
45
40
 
46
- case mapper["type"]
47
- when "count"
48
- # do nothing on this phase!
49
- when "sort"
50
- # because "count" type mapper requires all items of the array,
51
- # I have to apply "sort" type mapper later.
52
- if result[element]
53
- result[element] = apply_output_range(result[element], mapper)
54
- result[element] = apply_output_attributes_and_format(result[element], mapper)
55
- end
41
+ records_mapper = elements["records"]
42
+ if records_mapper && result["records"]
43
+ if records_mapper["no_output"]
44
+ result.delete("records")
45
+ else
46
+ result["records"] = apply_output_range(result["records"], records_mapper)
47
+ result["records"] = apply_output_attributes_and_format(result["records"], records_mapper)
56
48
  end
57
49
  end
58
50
  end
@@ -62,21 +54,18 @@ module Droonga
62
54
  end
63
55
 
64
56
  def apply_output_attributes_and_format(items, output)
65
- attributes = output["attributes"]
66
- if attributes
67
- format = output["format"]
68
- if format == "complex"
69
- items.collect! do |item|
70
- complex_item = {}
71
- attributes.each_with_index do |label, index|
72
- complex_item[label] = item[index]
73
- end
74
- complex_item
75
- end
76
- else
77
- items.collect! do |item|
78
- item[0...attributes.size]
57
+ attributes = output["attributes"] || []
58
+ if output["format"] == "complex"
59
+ items.collect! do |item|
60
+ complex_item = {}
61
+ attributes.each_with_index do |label, index|
62
+ complex_item[label] = item[index]
79
63
  end
64
+ complex_item
65
+ end
66
+ else
67
+ items.collect! do |item|
68
+ item[0...attributes.size]
80
69
  end
81
70
  end
82
71
  items
@@ -84,6 +73,11 @@ module Droonga
84
73
 
85
74
  command :collector_search_reduce
86
75
  def collector_search_reduce(request)
76
+ #XXX This is just a workaround. Errors should be handled by the framework itself.
77
+ if input_name == "errors"
78
+ return collector_reduce(request)
79
+ end
80
+
87
81
  return unless request
88
82
  body[input_name].each do |output, elements|
89
83
  value = request
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
1
  # Copyright (C) 2014 Droonga Project
4
2
  #
5
3
  # This library is free software; you can redistribute it and/or
@@ -15,27 +13,34 @@
15
13
  # License along with this library; if not, write to the Free Software
16
14
  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
15
 
18
- require "groonga"
19
- require "groonga/command/table-remove"
20
-
21
16
  module Droonga
22
- class GroongaHandler
23
- class TableRemove < Command
24
- def process_request(request)
25
- command_class = Groonga::Command.find("table_remove")
26
- @command = command_class.new("table_remove", request)
17
+ module Plugin
18
+ module Metadata
19
+ class AdapterMessage
20
+ def initialize(adapter_class)
21
+ @adapter_class = adapter_class
22
+ end
23
+
24
+ def input_pattern
25
+ configuration[:input_pattern]
26
+ end
27
+
28
+ def input_pattern=(pattern)
29
+ configuration[:input_pattern] = pattern
30
+ end
31
+
32
+ def output_pattern
33
+ configuration[:output_pattern]
34
+ end
27
35
 
28
- name = @command["name"]
29
- if name.nil? || @context[name].nil?
30
- raise CommandError.new(:status => Status::INVALID_ARGUMENT,
31
- :message => "table not found",
32
- :result => false)
36
+ def output_pattern=(pattern)
37
+ configuration[:output_pattern] = pattern
33
38
  end
34
39
 
35
- Groonga::Schema.define(:context => @context) do |schema|
36
- schema.remove_table(name)
40
+ private
41
+ def configuration
42
+ @adapter_class.options[:message] ||= {}
37
43
  end
38
- true
39
44
  end
40
45
  end
41
46
  end