fluent-plugin-droonga 0.0.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/.yardopts +7 -0
- data/Gemfile +14 -2
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/Rakefile +27 -5
- data/benchmark/benchmark.rb +1 -1
- data/benchmark/utils.rb +9 -6
- data/benchmark/watch/benchmark-notify.rb +2 -2
- data/benchmark/watch/benchmark-publish.rb +1 -1
- data/benchmark/watch/benchmark-scan.rb +1 -1
- data/benchmark/watch/catalog.json +1 -1
- data/bin/grn2jsons +1 -1
- data/fluent-plugin-droonga.gemspec +5 -3
- data/lib/droonga/adapter.rb +13 -130
- data/lib/droonga/adapter_plugin.rb +51 -0
- data/lib/droonga/catalog.rb +2 -2
- data/lib/droonga/collector.rb +107 -0
- data/lib/droonga/collector_plugin.rb +82 -0
- data/lib/droonga/command_mapper.rb +1 -1
- data/lib/droonga/{proxy.rb → dispatcher.rb} +116 -151
- data/lib/droonga/distributor.rb +51 -0
- data/lib/droonga/distributor_plugin.rb +59 -0
- data/lib/droonga/engine.rb +9 -50
- data/lib/droonga/farm.rb +47 -0
- data/lib/droonga/forwarder.rb +125 -0
- data/lib/droonga/handler.rb +69 -60
- data/lib/droonga/handler_plugin.rb +22 -11
- data/lib/droonga/input_message.rb +51 -0
- data/lib/droonga/job_queue.rb +5 -1
- data/lib/droonga/job_queue_schema.rb +1 -1
- data/lib/droonga/logger.rb +1 -1
- data/lib/droonga/partition.rb +76 -0
- data/lib/droonga/pluggable.rb +62 -0
- data/lib/droonga/plugin.rb +18 -16
- data/lib/droonga/plugin/{adapter_groonga.rb → adapter/groonga.rb} +10 -10
- data/lib/droonga/plugin/adapter/groonga/select.rb +13 -4
- data/lib/droonga/plugin/collector/basic.rb +142 -0
- data/lib/droonga/plugin/distributor/crud.rb +43 -0
- data/lib/droonga/plugin/distributor/groonga.rb +37 -0
- data/lib/droonga/plugin/distributor/search.rb +273 -0
- data/lib/droonga/plugin/distributor/watch.rb +39 -0
- data/lib/droonga/plugin/{handler_add.rb → handler/add.rb} +6 -6
- data/lib/droonga/plugin/{handler_forward.rb → handler/forward.rb} +9 -4
- data/lib/droonga/plugin/{handler_groonga.rb → handler/groonga.rb} +36 -4
- data/lib/droonga/plugin/handler/groonga/column_create.rb +5 -9
- data/lib/droonga/plugin/handler/groonga/table_create.rb +9 -18
- data/lib/droonga/plugin/{handler_search.rb → handler/search.rb} +4 -4
- data/lib/droonga/plugin/{handler_watch.rb → handler/watch.rb} +4 -4
- data/lib/droonga/plugin_loader.rb +45 -0
- data/lib/droonga/plugin_registerable.rb +51 -0
- data/lib/droonga/plugin_repository.rb +56 -0
- data/lib/droonga/processor.rb +64 -0
- data/lib/droonga/searcher.rb +16 -7
- data/lib/droonga/server.rb +5 -9
- data/lib/droonga/sweeper.rb +1 -1
- data/lib/droonga/watch_schema.rb +1 -1
- data/lib/droonga/watcher.rb +1 -1
- data/lib/droonga/worker.rb +21 -9
- data/lib/fluent/plugin/out_droonga.rb +33 -15
- data/lib/groonga_command_converter.rb +1 -1
- data/sample/cluster/fluentd.conf +0 -1
- data/test/command/config/default/catalog.json +43 -0
- data/test/command/config/default/fluentd.conf +11 -0
- data/test/command/fixture/documents.jsons +208 -0
- data/test/command/fixture/user-table-array.jsons +38 -0
- data/test/command/fixture/user-table.jsons +38 -0
- data/test/command/run-test.rb +35 -0
- data/test/command/suite/add/minimum.expected +12 -0
- data/test/command/suite/add/minimum.test +11 -0
- data/test/command/suite/add/with-values.expected +12 -0
- data/test/command/suite/add/with-values.test +17 -0
- data/test/command/suite/add/without-key.expected +12 -0
- data/test/command/suite/add/without-key.test +16 -0
- data/test/command/suite/groonga/column_create/scalar.expected +34 -0
- data/test/command/suite/groonga/column_create/scalar.test +17 -0
- data/test/command/suite/groonga/column_create/vector.expected +34 -0
- data/test/command/suite/groonga/column_create/vector.test +18 -0
- data/test/command/suite/groonga/select/minimum.expected +26 -0
- data/test/command/suite/groonga/select/minimum.test +8 -0
- data/test/command/suite/groonga/table_create/array.expected +17 -0
- data/test/command/suite/groonga/table_create/array.test +8 -0
- data/test/command/suite/groonga/table_create/hash.expected +17 -0
- data/test/command/suite/groonga/table_create/hash.test +8 -0
- data/test/command/suite/search/array-attribute-label.expected +25 -0
- data/test/command/suite/search/array-attribute-label.test +30 -0
- data/test/command/suite/search/chained-queries.expected +45 -0
- data/test/command/suite/search/chained-queries.test +43 -0
- data/test/command/suite/search/complex.expected +52 -0
- data/test/command/suite/search/complex.test +25 -0
- data/test/command/suite/search/condition-nested.expected +19 -0
- data/test/command/suite/search/condition-nested.test +29 -0
- data/test/command/suite/search/condition-query.expected +28 -0
- data/test/command/suite/search/condition-query.test +25 -0
- data/test/command/suite/search/condition-script.expected +28 -0
- data/test/command/suite/search/condition-script.test +28 -0
- data/test/command/suite/search/hash-attribute-label.expected +34 -0
- data/test/command/suite/search/hash-attribute-label.test +38 -0
- data/test/command/suite/search/minimum.expected +13 -0
- data/test/command/suite/search/minimum.test +16 -0
- data/test/command/suite/search/multiple-queries.expected +39 -0
- data/test/command/suite/search/multiple-queries.test +39 -0
- data/test/command/suite/search/output-range.expected +28 -0
- data/test/command/suite/search/output-range.test +25 -0
- data/test/command/suite/search/simple.expected +52 -0
- data/test/command/suite/search/simple.test +24 -0
- data/test/command/suite/search/sort-and-output-range.expected +25 -0
- data/test/command/suite/search/sort-and-output-range.test +29 -0
- data/test/command/suite/search/sort-range.expected +28 -0
- data/test/command/suite/search/sort-range.test +28 -0
- data/test/command/suite/search/sort-with-invisible-column.expected +28 -0
- data/test/command/suite/search/sort-with-invisible-column.test +28 -0
- data/test/unit/fixtures/array.grn +18 -0
- data/test/{fixtures → unit/fixtures}/catalog.json +0 -0
- data/test/{fixtures → unit/fixtures}/document.grn +20 -9
- data/test/unit/fixtures/reference/array.grn +11 -0
- data/test/unit/fixtures/reference/hash.grn +7 -0
- data/test/{helper.rb → unit/helper.rb} +2 -1
- data/test/{helper → unit/helper}/fixture.rb +1 -1
- data/test/unit/helper/plugin_helper.rb +38 -0
- data/test/{helper → unit/helper}/sandbox.rb +19 -6
- data/test/{helper → unit/helper}/stub_worker.rb +1 -1
- data/test/{helper → unit/helper}/watch_helper.rb +1 -13
- data/test/{plugin → unit/plugin}/adapter/groonga/test_select.rb +108 -4
- data/test/unit/plugin/collector/test_basic.rb +558 -0
- data/test/unit/plugin/distributor/test_search.rb +914 -0
- data/test/{plugin → unit/plugin}/handler/groonga/test_column_create.rb +18 -14
- data/test/{plugin → unit/plugin}/handler/groonga/test_table_create.rb +13 -11
- data/test/{plugin/handler/test_handler_add.rb → unit/plugin/handler/test_add.rb} +2 -14
- data/test/{plugin/handler/test_handler_groonga.rb → unit/plugin/handler/test_groonga.rb} +6 -26
- data/test/unit/plugin/handler/test_search.rb +601 -0
- data/test/{plugin/handler/test_handler_watch.rb → unit/plugin/handler/test_watch.rb} +2 -2
- data/test/{run-test.rb → unit/run-test.rb} +3 -3
- data/test/{test_adapter.rb → unit/test_adapter.rb} +17 -14
- data/test/{test_catalog.rb → unit/test_catalog.rb} +4 -4
- data/test/{test_command_mapper.rb → unit/test_command_mapper.rb} +1 -1
- data/test/{test_groonga_command_converter.rb → unit/test_groonga_command_converter.rb} +3 -3
- data/test/{test_job_queue_schema.rb → unit/test_job_queue_schema.rb} +1 -1
- data/test/{test_output.rb → unit/test_output.rb} +9 -9
- data/test/{test_handler.rb → unit/test_plugin.rb} +19 -22
- data/test/unit/test_plugin_repository.rb +89 -0
- data/test/{test_sweeper.rb → unit/test_sweeper.rb} +1 -1
- data/test/{test_watch_schema.rb → unit/test_watch_schema.rb} +1 -1
- data/test/{test_watcher.rb → unit/test_watcher.rb} +1 -1
- metadata +226 -66
- data/lib/droonga/executor.rb +0 -289
- data/lib/droonga/plugin/handler_proxy.rb +0 -82
- data/test/plugin/handler/test_handler_search.rb +0 -512
- data/test/test_worker.rb +0 -144
@@ -0,0 +1,45 @@
|
|
1
|
+
[
|
2
|
+
"droonga.message",
|
3
|
+
0,
|
4
|
+
{
|
5
|
+
"inReplyTo": null,
|
6
|
+
"statusCode": 200,
|
7
|
+
"type": "search.result",
|
8
|
+
"body": {
|
9
|
+
"Groonga": {
|
10
|
+
"count": 4,
|
11
|
+
"records": [
|
12
|
+
[
|
13
|
+
"Groonga overview"
|
14
|
+
],
|
15
|
+
[
|
16
|
+
"Groonga library"
|
17
|
+
],
|
18
|
+
[
|
19
|
+
"Groonga server"
|
20
|
+
],
|
21
|
+
[
|
22
|
+
"Groonga storage engine"
|
23
|
+
]
|
24
|
+
]
|
25
|
+
},
|
26
|
+
"keys": {
|
27
|
+
"count": 4,
|
28
|
+
"records": [
|
29
|
+
[
|
30
|
+
"1.9"
|
31
|
+
],
|
32
|
+
[
|
33
|
+
"1.8"
|
34
|
+
],
|
35
|
+
[
|
36
|
+
"1.7"
|
37
|
+
],
|
38
|
+
[
|
39
|
+
"1.1"
|
40
|
+
]
|
41
|
+
]
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
]
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#@include fixture/documents.jsons
|
2
|
+
{
|
3
|
+
"type": "search",
|
4
|
+
"dataset": "Droonga",
|
5
|
+
"body": {
|
6
|
+
"queries": {
|
7
|
+
"Groonga": {
|
8
|
+
"source": "Sections",
|
9
|
+
"condition": {
|
10
|
+
"query": "groonga",
|
11
|
+
"matchTo": ["title"]
|
12
|
+
},
|
13
|
+
"sortBy": ["_key"],
|
14
|
+
"output": {
|
15
|
+
"elements": [
|
16
|
+
"startTime",
|
17
|
+
"elapsedTime",
|
18
|
+
"count",
|
19
|
+
"attributes",
|
20
|
+
"records"
|
21
|
+
],
|
22
|
+
"limit": -1,
|
23
|
+
"attributes": ["title"]
|
24
|
+
}
|
25
|
+
},
|
26
|
+
"keys": {
|
27
|
+
"source": "Groonga",
|
28
|
+
"sortBy": ["-_key"],
|
29
|
+
"output": {
|
30
|
+
"elements": [
|
31
|
+
"startTime",
|
32
|
+
"elapsedTime",
|
33
|
+
"count",
|
34
|
+
"attributes",
|
35
|
+
"records"
|
36
|
+
],
|
37
|
+
"limit": -1,
|
38
|
+
"attributes": ["_key"]
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
[
|
2
|
+
"droonga.message",
|
3
|
+
0,
|
4
|
+
{
|
5
|
+
"inReplyTo": null,
|
6
|
+
"statusCode": 200,
|
7
|
+
"type": "search.result",
|
8
|
+
"body": {
|
9
|
+
"result": {
|
10
|
+
"count": 9,
|
11
|
+
"records": [
|
12
|
+
{
|
13
|
+
"_key": "1.1",
|
14
|
+
"title": "Groonga overview"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"_key": "1.2",
|
18
|
+
"title": "Full text search and Instant update"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"_key": "1.3",
|
22
|
+
"title": "Column store and aggregate query"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"_key": "1.4",
|
26
|
+
"title": "Inverted index and tokenizer"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"_key": "1.5",
|
30
|
+
"title": "Sharable storage and read lock-free"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"_key": "1.6",
|
34
|
+
"title": "Geo-location (latitude and longitude) search"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"_key": "1.7",
|
38
|
+
"title": "Groonga library"
|
39
|
+
},
|
40
|
+
{
|
41
|
+
"_key": "1.8",
|
42
|
+
"title": "Groonga server"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"_key": "1.9",
|
46
|
+
"title": "Groonga storage engine"
|
47
|
+
}
|
48
|
+
]
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
]
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#@include fixture/documents.jsons
|
2
|
+
{
|
3
|
+
"type": "search",
|
4
|
+
"dataset": "Droonga",
|
5
|
+
"body": {
|
6
|
+
"queries": {
|
7
|
+
"result": {
|
8
|
+
"source": "Sections",
|
9
|
+
"sortBy": ["_key"],
|
10
|
+
"output": {
|
11
|
+
"elements": [
|
12
|
+
"startTime",
|
13
|
+
"elapsedTime",
|
14
|
+
"count",
|
15
|
+
"attributes",
|
16
|
+
"records"
|
17
|
+
],
|
18
|
+
"format": "complex",
|
19
|
+
"limit": -1,
|
20
|
+
"attributes": ["_key", "title"]
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#@include fixture/documents.jsons
|
2
|
+
{
|
3
|
+
"type": "search",
|
4
|
+
"dataset": "Droonga",
|
5
|
+
"body": {
|
6
|
+
"queries": {
|
7
|
+
"result": {
|
8
|
+
"source": "Sections",
|
9
|
+
"condition": [
|
10
|
+
"&&",
|
11
|
+
"title @ 'groonga'",
|
12
|
+
"title @ 'engine'"
|
13
|
+
],
|
14
|
+
"sortBy": ["_key"],
|
15
|
+
"output": {
|
16
|
+
"elements": [
|
17
|
+
"startTime",
|
18
|
+
"elapsedTime",
|
19
|
+
"count",
|
20
|
+
"attributes",
|
21
|
+
"records"
|
22
|
+
],
|
23
|
+
"limit": -1,
|
24
|
+
"attributes": ["title"]
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
[
|
2
|
+
"droonga.message",
|
3
|
+
0,
|
4
|
+
{
|
5
|
+
"inReplyTo": null,
|
6
|
+
"statusCode": 200,
|
7
|
+
"type": "search.result",
|
8
|
+
"body": {
|
9
|
+
"result": {
|
10
|
+
"count": 4,
|
11
|
+
"records": [
|
12
|
+
[
|
13
|
+
"Groonga overview"
|
14
|
+
],
|
15
|
+
[
|
16
|
+
"Groonga library"
|
17
|
+
],
|
18
|
+
[
|
19
|
+
"Groonga server"
|
20
|
+
],
|
21
|
+
[
|
22
|
+
"Groonga storage engine"
|
23
|
+
]
|
24
|
+
]
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
]
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#@include fixture/documents.jsons
|
2
|
+
{
|
3
|
+
"type": "search",
|
4
|
+
"dataset": "Droonga",
|
5
|
+
"body": {
|
6
|
+
"queries": {
|
7
|
+
"result": {
|
8
|
+
"source": "Sections",
|
9
|
+
"condition": "title @ 'groonga'",
|
10
|
+
"sortBy": ["_key"],
|
11
|
+
"output": {
|
12
|
+
"elements": [
|
13
|
+
"startTime",
|
14
|
+
"elapsedTime",
|
15
|
+
"count",
|
16
|
+
"attributes",
|
17
|
+
"records"
|
18
|
+
],
|
19
|
+
"limit": -1,
|
20
|
+
"attributes": ["title"]
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
[
|
2
|
+
"droonga.message",
|
3
|
+
0,
|
4
|
+
{
|
5
|
+
"inReplyTo": null,
|
6
|
+
"statusCode": 200,
|
7
|
+
"type": "search.result",
|
8
|
+
"body": {
|
9
|
+
"result": {
|
10
|
+
"count": 4,
|
11
|
+
"records": [
|
12
|
+
[
|
13
|
+
"Groonga overview"
|
14
|
+
],
|
15
|
+
[
|
16
|
+
"Groonga library"
|
17
|
+
],
|
18
|
+
[
|
19
|
+
"Groonga server"
|
20
|
+
],
|
21
|
+
[
|
22
|
+
"Groonga storage engine"
|
23
|
+
]
|
24
|
+
]
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
]
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#@include fixture/documents.jsons
|
2
|
+
{
|
3
|
+
"type": "search",
|
4
|
+
"dataset": "Droonga",
|
5
|
+
"body": {
|
6
|
+
"queries": {
|
7
|
+
"result": {
|
8
|
+
"source": "Sections",
|
9
|
+
"condition": {
|
10
|
+
"query": "groonga",
|
11
|
+
"matchTo": ["title"]
|
12
|
+
},
|
13
|
+
"sortBy": ["_key"],
|
14
|
+
"output": {
|
15
|
+
"elements": [
|
16
|
+
"startTime",
|
17
|
+
"elapsedTime",
|
18
|
+
"count",
|
19
|
+
"attributes",
|
20
|
+
"records"
|
21
|
+
],
|
22
|
+
"limit": -1,
|
23
|
+
"attributes": ["title"]
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
[
|
2
|
+
"droonga.message",
|
3
|
+
0,
|
4
|
+
{
|
5
|
+
"inReplyTo": null,
|
6
|
+
"statusCode": 200,
|
7
|
+
"type": "search.result",
|
8
|
+
"body": {
|
9
|
+
"result": {
|
10
|
+
"count": 9,
|
11
|
+
"records": [
|
12
|
+
{
|
13
|
+
"section-id": "1.1",
|
14
|
+
"label": "Groonga overview",
|
15
|
+
"fixed-number": 29,
|
16
|
+
"fixed-string": "Groonga"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"section-id": "1.2",
|
20
|
+
"label": "Full text search and Instant update",
|
21
|
+
"fixed-number": 29,
|
22
|
+
"fixed-string": "Groonga"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"section-id": "1.3",
|
26
|
+
"label": "Column store and aggregate query",
|
27
|
+
"fixed-number": 29,
|
28
|
+
"fixed-string": "Groonga"
|
29
|
+
}
|
30
|
+
]
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
]
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#@include fixture/documents.jsons
|
2
|
+
{
|
3
|
+
"type": "search",
|
4
|
+
"dataset": "Droonga",
|
5
|
+
"body": {
|
6
|
+
"queries": {
|
7
|
+
"result": {
|
8
|
+
"source": "Sections",
|
9
|
+
"sortBy": ["_key"],
|
10
|
+
"output": {
|
11
|
+
"elements": [
|
12
|
+
"startTime",
|
13
|
+
"elapsedTime",
|
14
|
+
"count",
|
15
|
+
"attributes",
|
16
|
+
"records"
|
17
|
+
],
|
18
|
+
"format": "complex",
|
19
|
+
"limit": 3,
|
20
|
+
"attributes": {
|
21
|
+
"section-id": {
|
22
|
+
"source": "_key"
|
23
|
+
},
|
24
|
+
"label": {
|
25
|
+
"source": "title"
|
26
|
+
},
|
27
|
+
"fixed-number": {
|
28
|
+
"source": "29"
|
29
|
+
},
|
30
|
+
"fixed-string": {
|
31
|
+
"source": "\"Groonga\""
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
[
|
2
|
+
"droonga.message",
|
3
|
+
0,
|
4
|
+
{
|
5
|
+
"inReplyTo": null,
|
6
|
+
"statusCode": 200,
|
7
|
+
"type": "search.result",
|
8
|
+
"body": {
|
9
|
+
"keys": {
|
10
|
+
"count": 9,
|
11
|
+
"records": [
|
12
|
+
[
|
13
|
+
"1.1"
|
14
|
+
],
|
15
|
+
[
|
16
|
+
"1.2"
|
17
|
+
],
|
18
|
+
[
|
19
|
+
"1.3"
|
20
|
+
]
|
21
|
+
]
|
22
|
+
},
|
23
|
+
"titles": {
|
24
|
+
"count": 9,
|
25
|
+
"records": [
|
26
|
+
[
|
27
|
+
"Groonga storage engine"
|
28
|
+
],
|
29
|
+
[
|
30
|
+
"Groonga server"
|
31
|
+
],
|
32
|
+
[
|
33
|
+
"Groonga library"
|
34
|
+
]
|
35
|
+
]
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
]
|