fluent-plugin-droonga 0.9.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.dir-locals.el +3 -0
- data/.travis.yml +6 -2
- data/README.md +6 -7
- data/Rakefile +23 -6
- data/fluent-plugin-droonga.gemspec +2 -2
- data/lib/droonga/adapter.rb +12 -3
- data/lib/droonga/adapter_runner.rb +28 -23
- data/lib/droonga/catalog/base.rb +7 -111
- data/lib/droonga/catalog/dataset.rb +13 -25
- data/lib/droonga/catalog/errors.rb +94 -0
- data/lib/droonga/catalog/schema.rb +277 -0
- data/lib/droonga/catalog/version1.rb +404 -0
- data/lib/droonga/catalog/version2.rb +160 -0
- data/lib/droonga/catalog_loader.rb +27 -4
- data/lib/droonga/catalog_observer.rb +44 -6
- data/lib/droonga/collector.rb +12 -10
- data/lib/droonga/{handler_plugin.rb → collector_message.rb} +47 -20
- data/lib/droonga/collector_runner.rb +64 -0
- data/lib/droonga/collectors.rb +18 -0
- data/lib/droonga/{catalog.rb → collectors/add.rb} +9 -7
- data/lib/droonga/{command_repository.rb → collectors/and.rb} +7 -14
- data/lib/droonga/collectors/sum.rb +26 -0
- data/lib/droonga/dispatcher.rb +74 -41
- data/lib/droonga/distributed_command_planner.rb +2 -2
- data/lib/droonga/engine.rb +13 -5
- data/lib/droonga/{message_processing_error.rb → error.rb} +33 -12
- data/lib/droonga/{plugin/planner/search.rb → error_messages.rb} +12 -10
- data/lib/droonga/farm.rb +15 -14
- data/lib/droonga/fluent_message_sender.rb +15 -11
- data/lib/droonga/forwarder.rb +22 -18
- data/lib/droonga/handler.rb +8 -2
- data/lib/droonga/handler_runner.rb +47 -26
- data/lib/droonga/input_message.rb +6 -6
- data/lib/droonga/{command.rb → loggable.rb} +7 -14
- data/lib/droonga/logger.rb +56 -15
- data/lib/droonga/message_matcher.rb +12 -7
- data/lib/droonga/message_pusher.rb +8 -4
- data/lib/droonga/message_receiver.rb +11 -9
- data/lib/droonga/output_message.rb +2 -0
- data/lib/droonga/planner.rb +21 -10
- data/lib/droonga/plugin.rb +15 -0
- data/lib/droonga/plugin/metadata/{adapter_message.rb → adapter_input_message.rb} +6 -14
- data/lib/droonga/plugin/metadata/adapter_output_message.rb +39 -0
- data/lib/droonga/plugin/metadata/collector_message.rb +39 -0
- data/lib/droonga/plugin/metadata/input_message.rb +15 -0
- data/lib/droonga/plugin_loader.rb +33 -25
- data/lib/droonga/plugin_registry.rb +9 -1
- data/lib/droonga/plugins/basic.rb +54 -0
- data/lib/droonga/plugins/crud.rb +36 -15
- data/lib/droonga/plugins/error.rb +5 -4
- data/lib/droonga/plugins/groonga.rb +9 -6
- data/lib/droonga/plugins/groonga/column_create.rb +10 -5
- data/lib/droonga/plugins/groonga/generic_command.rb +2 -8
- data/lib/droonga/plugins/groonga/generic_response.rb +2 -2
- data/lib/droonga/plugins/groonga/select.rb +2 -2
- data/lib/droonga/plugins/groonga/table_create.rb +9 -4
- data/lib/droonga/plugins/groonga/table_remove.rb +10 -5
- data/lib/droonga/plugins/search.rb +106 -5
- data/lib/droonga/plugins/search/distributed_search_planner.rb +398 -0
- data/lib/droonga/plugins/watch.rb +41 -20
- data/lib/droonga/processor.rb +12 -9
- data/lib/droonga/{plugin/collector/basic.rb → reducer.rb} +36 -50
- data/lib/droonga/replier.rb +7 -4
- data/lib/droonga/searcher.rb +40 -37
- data/lib/droonga/server.rb +8 -6
- data/lib/droonga/session.rb +17 -7
- data/lib/droonga/single_step.rb +53 -0
- data/lib/droonga/{plugin/planner/watch.rb → single_step_definition.rb} +27 -26
- data/lib/droonga/{partition.rb → slice.rb} +23 -12
- data/lib/droonga/status_code.rb +25 -0
- data/lib/droonga/step_runner.rb +63 -0
- data/lib/droonga/watch_schema.rb +7 -3
- data/lib/droonga/watcher.rb +4 -4
- data/lib/droonga/worker.rb +6 -6
- data/lib/fluent/plugin/out_droonga.rb +27 -2
- data/sample/cluster/catalog.json +33 -32
- data/test/command/config/default/catalog.json +72 -45
- data/test/command/config/version1/catalog.json +68 -0
- data/test/command/config/version1/fluentd.conf +11 -0
- data/test/command/suite/message/error/missing-dataset.expected +1 -1
- data/test/command/suite/message/error/unknown-dataset.expected +1 -1
- data/test/command/suite/message/error/unknown-type.expected +13 -0
- data/test/command/suite/message/error/{unknown-command.test → unknown-type.test} +1 -1
- data/test/command/suite/search/error/missing-source-parameter.expected +1 -1
- data/test/command/suite/search/error/unknown-source.expected +15 -3
- data/test/command/suite/watch/subscribe.expected +1 -3
- data/test/command/suite/watch/unsubscribe.expected +1 -3
- data/test/performance/watch/catalog.json +1 -0
- data/test/unit/catalog/test_dataset.rb +16 -358
- data/test/unit/catalog/test_schema.rb +285 -0
- data/test/unit/catalog/test_version1.rb +222 -28
- data/test/unit/catalog/test_version2.rb +155 -0
- data/test/unit/fixtures/catalog/version2.json +62 -0
- data/test/unit/helper/distributed_search_planner_helper.rb +2 -2
- data/test/unit/plugins/crud/test_add.rb +13 -13
- data/test/unit/plugins/groonga/test_column_create.rb +14 -11
- data/test/unit/plugins/groonga/test_table_create.rb +4 -9
- data/test/unit/plugins/groonga/test_table_remove.rb +4 -9
- data/test/unit/{plugin/planner/search_planner → plugins/search/planner}/test_basic.rb +0 -0
- data/test/unit/{plugin/planner/search_planner → plugins/search/planner}/test_group_by.rb +0 -0
- data/test/unit/{plugin/planner/search_planner → plugins/search/planner}/test_output.rb +0 -0
- data/test/unit/{plugin/planner/search_planner → plugins/search/planner}/test_sort_by.rb +0 -0
- data/test/unit/{plugin/collector/test_search.rb → plugins/search/test_collector.rb} +40 -39
- data/test/unit/plugins/{test_search.rb → search/test_handler.rb} +6 -5
- data/test/unit/{plugin/planner/test_search.rb → plugins/search/test_planner.rb} +3 -3
- data/test/unit/{plugin/collector → plugins}/test_basic.rb +68 -50
- data/test/unit/plugins/test_groonga.rb +2 -15
- data/test/unit/plugins/test_watch.rb +25 -22
- data/test/unit/test_message_matcher.rb +29 -6
- data/test/unit/test_output.rb +4 -0
- metadata +58 -50
- data/lib/droonga/collector_plugin.rb +0 -50
- data/lib/droonga/legacy_pluggable.rb +0 -66
- data/lib/droonga/legacy_plugin.rb +0 -57
- data/lib/droonga/legacy_plugin_repository.rb +0 -54
- data/lib/droonga/planner_plugin.rb +0 -54
- data/lib/droonga/plugin/collector/search.rb +0 -98
- data/lib/droonga/plugin/planner/crud.rb +0 -49
- data/lib/droonga/plugin/planner/distributed_search_planner.rb +0 -393
- data/lib/droonga/plugin/planner/groonga.rb +0 -54
- data/lib/droonga/plugin_registerable.rb +0 -75
- data/test/command/suite/message/error/unknown-command.expected +0 -13
- data/test/unit/test_command_repository.rb +0 -39
- data/test/unit/test_legacy_plugin.rb +0 -50
- data/test/unit/test_legacy_plugin_repository.rb +0 -89
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2013 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/planner_plugin"
|
|
19
|
-
|
|
20
|
-
module Droonga
|
|
21
|
-
class GroongaPlanner < Droonga::PlannerPlugin
|
|
22
|
-
repository.register("groonga", self)
|
|
23
|
-
|
|
24
|
-
command :table_create
|
|
25
|
-
def table_create(message)
|
|
26
|
-
unless message["dataset"]
|
|
27
|
-
raise "dataset must be set. FIXME: This error should return client."
|
|
28
|
-
end
|
|
29
|
-
broadcast(message)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
command :table_remove
|
|
33
|
-
def table_remove(message)
|
|
34
|
-
unless message["dataset"]
|
|
35
|
-
raise "dataset must be set. FIXME: This error should return client."
|
|
36
|
-
end
|
|
37
|
-
broadcast(message)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
command :column_create
|
|
41
|
-
def column_create(message)
|
|
42
|
-
broadcast(message)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
private
|
|
46
|
-
def broadcast(message)
|
|
47
|
-
super(message,
|
|
48
|
-
:write => true,
|
|
49
|
-
:reduce => {
|
|
50
|
-
"result" => "or"
|
|
51
|
-
})
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
#
|
|
3
|
-
# Copyright (C) 2013 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/command"
|
|
19
|
-
require "droonga/command_repository"
|
|
20
|
-
require "droonga/legacy_plugin_repository"
|
|
21
|
-
|
|
22
|
-
module Droonga
|
|
23
|
-
module PluginRegisterable
|
|
24
|
-
class << self
|
|
25
|
-
def extended(plugin_class)
|
|
26
|
-
super
|
|
27
|
-
plugin_class.class_variable_set(:@@repository,
|
|
28
|
-
LegacyPluginRepository.new)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def repository
|
|
33
|
-
class_variable_get(:@@repository)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def inherited(sub_class)
|
|
37
|
-
super
|
|
38
|
-
sub_class.instance_variable_set(:@command_repository,
|
|
39
|
-
CommandRepository.new)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def command(method_name_or_map, options={})
|
|
43
|
-
if method_name_or_map.is_a?(Hash)
|
|
44
|
-
type, method_name = method_name_or_map.to_a.first
|
|
45
|
-
options[:pattern] ||= ["type", :equal, type.to_s]
|
|
46
|
-
else
|
|
47
|
-
method_name = method_name_or_map
|
|
48
|
-
options[:pattern] ||= ["type", :equal, method_name.to_s]
|
|
49
|
-
end
|
|
50
|
-
command = Command.new(method_name, options)
|
|
51
|
-
@command_repository.register(command)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def commands
|
|
55
|
-
@command_repository.commands
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def find_command(message)
|
|
59
|
-
@command_repository.find(message)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def method_name(message)
|
|
63
|
-
message = {"type" => message.to_s} unless message.is_a?(Hash)
|
|
64
|
-
command = find_command(message)
|
|
65
|
-
return nil if command.nil?
|
|
66
|
-
command.method_name
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def processable?(message)
|
|
70
|
-
message = {"type" => message.to_s} unless message.is_a?(Hash)
|
|
71
|
-
command = find_command(message)
|
|
72
|
-
not command.nil?
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
"droonga.message",
|
|
3
|
-
0,
|
|
4
|
-
{
|
|
5
|
-
"inReplyTo": "request-id",
|
|
6
|
-
"statusCode": 400,
|
|
7
|
-
"type": "unknown-command.result",
|
|
8
|
-
"body": {
|
|
9
|
-
"name": "UnknownCommand",
|
|
10
|
-
"message": "The command \"unknown-command\" is not available for the dataset \"Droonga\"."
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
]
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Copyright (C) 2013 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
|
-
require "droonga/command_repository"
|
|
17
|
-
|
|
18
|
-
class CommandRepositoryTest < Test::Unit::TestCase
|
|
19
|
-
def setup
|
|
20
|
-
@repository = Droonga::CommandRepository.new
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
class FindTest < self
|
|
24
|
-
def setup
|
|
25
|
-
super
|
|
26
|
-
@command = Droonga::Command.new(:select,
|
|
27
|
-
:pattern => ["type", :equal, "select"])
|
|
28
|
-
@repository.register(@command)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_match
|
|
32
|
-
assert_equal(@command, @repository.find({ "type" => "select" }))
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def test_not_match
|
|
36
|
-
assert_nil(@repository.find({ "type" => "search" }))
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Copyright (C) 2013 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
|
-
require "droonga/legacy_plugin"
|
|
17
|
-
|
|
18
|
-
class LegacyPluginTest < Test::Unit::TestCase
|
|
19
|
-
class PluggableTest < self
|
|
20
|
-
class DummyTypePlugin < Droonga::LegacyPlugin
|
|
21
|
-
extend Droonga::PluginRegisterable
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
class DummyPlugin < DummyTypePlugin
|
|
25
|
-
command :dummy
|
|
26
|
-
def dummy(request)
|
|
27
|
-
:dummy_response
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
class UnknownPlugin < DummyTypePlugin
|
|
32
|
-
command :unknown
|
|
33
|
-
def unknown(request)
|
|
34
|
-
:unknown_response
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def setup
|
|
39
|
-
@dummy_plugin = DummyPlugin.new
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def test_processable
|
|
43
|
-
assert_true(@dummy_plugin.processable?(:dummy))
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def test_not_processable
|
|
47
|
-
assert_false(@dummy_plugin.processable?(:unknown))
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# Copyright (C) 2013 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
|
-
require "droonga/legacy_plugin_repository"
|
|
17
|
-
|
|
18
|
-
class LegacyPluginRepositoryTest < Test::Unit::TestCase
|
|
19
|
-
def setup
|
|
20
|
-
@repository = Droonga::LegacyPluginRepository.new
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
class StubPlugin
|
|
24
|
-
attr_reader :arguments
|
|
25
|
-
def initialize(*arguments)
|
|
26
|
-
@arguments = arguments
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def test_register
|
|
31
|
-
@repository.register("stub", StubPlugin)
|
|
32
|
-
assert_equal(StubPlugin, @repository["stub"])
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def test_enumerable
|
|
36
|
-
@repository.register("stub1", StubPlugin)
|
|
37
|
-
@repository.register("stub2", StubPlugin)
|
|
38
|
-
assert_equal([
|
|
39
|
-
["stub1", StubPlugin],
|
|
40
|
-
["stub2", StubPlugin],
|
|
41
|
-
],
|
|
42
|
-
@repository.to_a)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
sub_test_case("[]") do
|
|
46
|
-
def setup
|
|
47
|
-
super
|
|
48
|
-
@repository.register("stub", StubPlugin)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def test_nonexistent
|
|
52
|
-
assert_nil(@repository["nonexistent"])
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def test_existent
|
|
56
|
-
assert_equal(StubPlugin, @repository["stub"])
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
sub_test_case("clear") do
|
|
61
|
-
def setup
|
|
62
|
-
super
|
|
63
|
-
@repository.register("stub", StubPlugin)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def test_clear
|
|
67
|
-
assert_equal([["stub", StubPlugin]], @repository.to_a)
|
|
68
|
-
@repository.clear
|
|
69
|
-
assert_equal([], @repository.to_a)
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
sub_test_case("instantiate") do
|
|
74
|
-
def setup
|
|
75
|
-
super
|
|
76
|
-
@repository.register("stub", StubPlugin)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def test_no_arguments
|
|
80
|
-
plugin = @repository.instantiate("stub")
|
|
81
|
-
assert_equal([], plugin.arguments)
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def test_have_arguments
|
|
85
|
-
plugin = @repository.instantiate("stub", "Hello", "World")
|
|
86
|
-
assert_equal(["Hello", "World"], plugin.arguments)
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|