droonga-engine 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.dir-locals.el +3 -0
- data/.gitignore +6 -0
- data/.travis.yml +15 -0
- data/.yardopts +7 -0
- data/Gemfile +66 -0
- data/LICENSE.txt +14 -0
- data/README.md +17 -0
- data/Rakefile +64 -0
- data/benchmark/benchmark.rb +123 -0
- data/benchmark/utils.rb +246 -0
- data/benchmark/watch/benchmark-notify.rb +143 -0
- data/benchmark/watch/benchmark-notify.sh +20 -0
- data/benchmark/watch/benchmark-publish.rb +120 -0
- data/benchmark/watch/benchmark-scan.rb +213 -0
- data/bin/droonga-catalog-generate +103 -0
- data/bin/droonga-engine +20 -0
- data/bin/droonga-engine-service +20 -0
- data/doc/text/news.md +106 -0
- data/droonga-engine.gemspec +52 -0
- data/lib/droonga/adapter.rb +48 -0
- data/lib/droonga/adapter_runner.rb +104 -0
- data/lib/droonga/catalog/base.rb +41 -0
- data/lib/droonga/catalog/collection_volume.rb +106 -0
- data/lib/droonga/catalog/dataset.rb +69 -0
- data/lib/droonga/catalog/errors.rb +113 -0
- data/lib/droonga/catalog/schema.rb +186 -0
- data/lib/droonga/catalog/single_volume.rb +28 -0
- data/lib/droonga/catalog/slice.rb +41 -0
- data/lib/droonga/catalog/version1.rb +427 -0
- data/lib/droonga/catalog/version2.rb +96 -0
- data/lib/droonga/catalog/version2_validator.rb +63 -0
- data/lib/droonga/catalog/volume.rb +33 -0
- data/lib/droonga/catalog/volume_collection.rb +56 -0
- data/lib/droonga/catalog_generator.rb +156 -0
- data/lib/droonga/catalog_loader.rb +56 -0
- data/lib/droonga/catalog_observer.rb +83 -0
- data/lib/droonga/collector.rb +38 -0
- data/lib/droonga/collector_message.rb +71 -0
- data/lib/droonga/collector_runner.rb +64 -0
- data/lib/droonga/collectors/and.rb +26 -0
- data/lib/droonga/collectors/or.rb +26 -0
- data/lib/droonga/collectors/sum.rb +26 -0
- data/lib/droonga/collectors.rb +18 -0
- data/lib/droonga/dispatcher.rb +326 -0
- data/lib/droonga/distributed_command_planner.rb +179 -0
- data/lib/droonga/distributor.rb +87 -0
- data/lib/droonga/engine/command/droonga_engine.rb +441 -0
- data/lib/droonga/engine/version.rb +20 -0
- data/lib/droonga/engine.rb +80 -0
- data/lib/droonga/engine_state.rb +79 -0
- data/lib/droonga/error.rb +73 -0
- data/lib/droonga/error_messages.rb +33 -0
- data/lib/droonga/event_loop.rb +46 -0
- data/lib/droonga/farm.rb +58 -0
- data/lib/droonga/fluent_message_receiver.rb +191 -0
- data/lib/droonga/fluent_message_sender.rb +140 -0
- data/lib/droonga/forwarder.rb +119 -0
- data/lib/droonga/handler.rb +49 -0
- data/lib/droonga/handler_message.rb +61 -0
- data/lib/droonga/handler_messenger.rb +119 -0
- data/lib/droonga/handler_runner.rb +125 -0
- data/lib/droonga/input_message.rb +51 -0
- data/lib/droonga/job_protocol.rb +20 -0
- data/lib/droonga/job_pusher.rb +179 -0
- data/lib/droonga/job_receiver.rb +70 -0
- data/lib/droonga/loggable.rb +29 -0
- data/lib/droonga/logger.rb +142 -0
- data/lib/droonga/message_matcher.rb +109 -0
- data/lib/droonga/output_message.rb +55 -0
- data/lib/droonga/planner.rb +47 -0
- data/lib/droonga/pluggable.rb +31 -0
- data/lib/droonga/plugin/metadata/adapter_input_message.rb +39 -0
- 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/handler_action.rb +39 -0
- data/lib/droonga/plugin/metadata/input_message.rb +54 -0
- data/lib/droonga/plugin.rb +43 -0
- data/lib/droonga/plugin_loader.rb +63 -0
- data/lib/droonga/plugin_registry.rb +66 -0
- data/lib/droonga/plugins/basic.rb +54 -0
- data/lib/droonga/plugins/crud.rb +145 -0
- data/lib/droonga/plugins/dump.rb +97 -0
- data/lib/droonga/plugins/error.rb +51 -0
- data/lib/droonga/plugins/groonga/column_create.rb +123 -0
- data/lib/droonga/plugins/groonga/column_list.rb +124 -0
- data/lib/droonga/plugins/groonga/column_remove.rb +65 -0
- data/lib/droonga/plugins/groonga/column_rename.rb +67 -0
- data/lib/droonga/plugins/groonga/delete.rb +117 -0
- data/lib/droonga/plugins/groonga/generic_command.rb +105 -0
- data/lib/droonga/plugins/groonga/generic_response.rb +43 -0
- data/lib/droonga/plugins/groonga/select.rb +236 -0
- data/lib/droonga/plugins/groonga/table_create.rb +111 -0
- data/lib/droonga/plugins/groonga/table_list.rb +120 -0
- data/lib/droonga/plugins/groonga/table_remove.rb +57 -0
- data/lib/droonga/plugins/groonga.rb +37 -0
- data/lib/droonga/plugins/search/distributed_search_planner.rb +407 -0
- data/lib/droonga/plugins/search.rb +146 -0
- data/lib/droonga/plugins/watch.rb +178 -0
- data/lib/droonga/processor.rb +63 -0
- data/lib/droonga/reducer.rb +169 -0
- data/lib/droonga/replier.rb +49 -0
- data/lib/droonga/schema_applier.rb +167 -0
- data/lib/droonga/searcher/mecab_filter.rb +67 -0
- data/lib/droonga/searcher.rb +733 -0
- data/lib/droonga/server.rb +45 -0
- data/lib/droonga/session.rb +99 -0
- data/lib/droonga/single_step.rb +68 -0
- data/lib/droonga/single_step_definition.rb +54 -0
- data/lib/droonga/slice.rb +122 -0
- data/lib/droonga/status_code.rb +25 -0
- data/lib/droonga/step_runner.rb +64 -0
- data/lib/droonga/sweeper.rb +42 -0
- data/lib/droonga/test/stub_handler.rb +37 -0
- data/lib/droonga/test/stub_handler_message.rb +35 -0
- data/lib/droonga/test/stub_handler_messenger.rb +34 -0
- data/lib/droonga/test/stub_planner.rb +31 -0
- data/lib/droonga/test.rb +21 -0
- data/lib/droonga/watch_schema.rb +92 -0
- data/lib/droonga/watcher.rb +257 -0
- data/lib/droonga/worker.rb +61 -0
- data/sample/cluster/catalog.json +42 -0
- data/sample/mecab_filter/data.grn +7 -0
- data/sample/mecab_filter/ddl.grn +7 -0
- data/sample/mecab_filter/search_with_mecab_filter.json +21 -0
- data/sample/mecab_filter/search_without_mecab_filter.json +21 -0
- data/test/command/config/default/catalog.json +85 -0
- data/test/command/config/default/fluentd.conf +11 -0
- data/test/command/config/version1/catalog.json +68 -0
- data/test/command/config/version1/fluentd.conf +11 -0
- data/test/command/fixture/documents.jsons +208 -0
- data/test/command/fixture/event.jsons +41 -0
- data/test/command/fixture/user-table-array.jsons +38 -0
- data/test/command/fixture/user-table.jsons +47 -0
- data/test/command/run-test.rb +34 -0
- data/test/command/suite/add/dimension/column.catalog.json +28 -0
- data/test/command/suite/add/dimension/column.expected +41 -0
- data/test/command/suite/add/dimension/column.test +51 -0
- data/test/command/suite/add/dimension/integer.catalog.json +19 -0
- data/test/command/suite/add/dimension/integer.expected +41 -0
- data/test/command/suite/add/dimension/integer.test +51 -0
- data/test/command/suite/add/error/invalid-integer.expected +46 -0
- data/test/command/suite/add/error/invalid-integer.test +12 -0
- data/test/command/suite/add/error/invalid-time.expected +46 -0
- data/test/command/suite/add/error/invalid-time.test +12 -0
- data/test/command/suite/add/error/missing-key.expected +25 -0
- data/test/command/suite/add/error/missing-key.test +16 -0
- data/test/command/suite/add/error/missing-table.expected +25 -0
- data/test/command/suite/add/error/missing-table.test +16 -0
- data/test/command/suite/add/error/unknown-column.expected +46 -0
- data/test/command/suite/add/error/unknown-column.test +12 -0
- data/test/command/suite/add/error/unknown-table.expected +25 -0
- data/test/command/suite/add/error/unknown-table.test +17 -0
- data/test/command/suite/add/minimum.expected +6 -0
- data/test/command/suite/add/minimum.test +11 -0
- data/test/command/suite/add/with-values.expected +6 -0
- data/test/command/suite/add/with-values.test +17 -0
- data/test/command/suite/add/without-key.expected +6 -0
- data/test/command/suite/add/without-key.test +16 -0
- data/test/command/suite/groonga/column_create/scalar.expected +26 -0
- data/test/command/suite/groonga/column_create/scalar.test +17 -0
- data/test/command/suite/groonga/column_create/unknown-table.expected +14 -0
- data/test/command/suite/groonga/column_create/unknown-table.test +7 -0
- data/test/command/suite/groonga/column_create/vector.expected +26 -0
- data/test/command/suite/groonga/column_create/vector.test +18 -0
- data/test/command/suite/groonga/column_list/success.expected +86 -0
- data/test/command/suite/groonga/column_list/success.test +24 -0
- data/test/command/suite/groonga/column_list/unknown-table.expected +13 -0
- data/test/command/suite/groonga/column_list/unknown-table.test +7 -0
- data/test/command/suite/groonga/column_remove/success.expected +39 -0
- data/test/command/suite/groonga/column_remove/success.test +25 -0
- data/test/command/suite/groonga/column_remove/unknown-column.expected +27 -0
- data/test/command/suite/groonga/column_remove/unknown-column.test +16 -0
- data/test/command/suite/groonga/column_remove/unknown-table.expected +14 -0
- data/test/command/suite/groonga/column_remove/unknown-table.test +7 -0
- data/test/command/suite/groonga/column_rename/success.expected +39 -0
- data/test/command/suite/groonga/column_rename/success.test +26 -0
- data/test/command/suite/groonga/column_rename/unknown-column.expected +27 -0
- data/test/command/suite/groonga/column_rename/unknown-column.test +16 -0
- data/test/command/suite/groonga/column_rename/unknown-table.expected +14 -0
- data/test/command/suite/groonga/column_rename/unknown-table.test +7 -0
- data/test/command/suite/groonga/delete/duplicated-identifiers.expected +27 -0
- data/test/command/suite/groonga/delete/duplicated-identifiers.test +17 -0
- data/test/command/suite/groonga/delete/filter.expected +19 -0
- data/test/command/suite/groonga/delete/filter.test +19 -0
- data/test/command/suite/groonga/delete/invalid-filter.expected +14 -0
- data/test/command/suite/groonga/delete/invalid-filter.test +9 -0
- data/test/command/suite/groonga/delete/no-identifier.expected +27 -0
- data/test/command/suite/groonga/delete/no-identifier.test +15 -0
- data/test/command/suite/groonga/delete/success.expected +19 -0
- data/test/command/suite/groonga/delete/success.test +19 -0
- data/test/command/suite/groonga/delete/unknown-table.expected +14 -0
- data/test/command/suite/groonga/delete/unknown-table.test +7 -0
- data/test/command/suite/groonga/select/minimum.expected +22 -0
- data/test/command/suite/groonga/select/minimum.test +8 -0
- data/test/command/suite/groonga/table_create/array.expected +14 -0
- data/test/command/suite/groonga/table_create/array.test +8 -0
- data/test/command/suite/groonga/table_create/hash.expected +13 -0
- data/test/command/suite/groonga/table_create/hash.test +8 -0
- data/test/command/suite/groonga/table_list/success.expected +71 -0
- data/test/command/suite/groonga/table_list/success.test +15 -0
- data/test/command/suite/groonga/table_remove/success.expected +13 -0
- data/test/command/suite/groonga/table_remove/success.test +8 -0
- data/test/command/suite/groonga/table_remove/unknown-table.expected +14 -0
- data/test/command/suite/groonga/table_remove/unknown-table.test +7 -0
- data/test/command/suite/message/error/missing-dataset.expected +9 -0
- data/test/command/suite/message/error/missing-dataset.test +5 -0
- data/test/command/suite/message/error/unknown-dataset.expected +9 -0
- data/test/command/suite/message/error/unknown-dataset.test +6 -0
- data/test/command/suite/message/error/unknown-type.expected +9 -0
- data/test/command/suite/message/error/unknown-type.test +6 -0
- data/test/command/suite/search/adjusters/multiple.catalog.json +38 -0
- data/test/command/suite/search/adjusters/multiple.expected +19 -0
- data/test/command/suite/search/adjusters/multiple.test +75 -0
- data/test/command/suite/search/adjusters/one.catalog.json +38 -0
- data/test/command/suite/search/adjusters/one.expected +19 -0
- data/test/command/suite/search/adjusters/one.test +66 -0
- data/test/command/suite/search/attributes/array.expected +21 -0
- data/test/command/suite/search/attributes/array.test +28 -0
- data/test/command/suite/search/attributes/hash.expected +30 -0
- data/test/command/suite/search/attributes/hash.test +36 -0
- data/test/command/suite/search/complex.expected +48 -0
- data/test/command/suite/search/complex.test +23 -0
- data/test/command/suite/search/condition/nested.expected +15 -0
- data/test/command/suite/search/condition/nested.test +27 -0
- data/test/command/suite/search/condition/query/nonexistent_column.catalog.json +37 -0
- data/test/command/suite/search/condition/query/nonexistent_column.expected +48 -0
- data/test/command/suite/search/condition/query/nonexistent_column.test +33 -0
- data/test/command/suite/search/condition/query/syntax_error.catalog.json +36 -0
- data/test/command/suite/search/condition/query/syntax_error.expected +48 -0
- data/test/command/suite/search/condition/query/syntax_error.test +33 -0
- data/test/command/suite/search/condition/query.expected +24 -0
- data/test/command/suite/search/condition/query.test +23 -0
- data/test/command/suite/search/condition/script.expected +24 -0
- data/test/command/suite/search/condition/script.test +26 -0
- data/test/command/suite/search/error/cyclic-source.expected +14 -0
- data/test/command/suite/search/error/cyclic-source.test +12 -0
- data/test/command/suite/search/error/deeply-cyclic-source.expected +17 -0
- data/test/command/suite/search/error/deeply-cyclic-source.test +15 -0
- data/test/command/suite/search/error/missing-source-parameter.expected +13 -0
- data/test/command/suite/search/error/missing-source-parameter.test +11 -0
- data/test/command/suite/search/error/no-query.expected +9 -0
- data/test/command/suite/search/error/no-query.test +7 -0
- data/test/command/suite/search/error/unknown-source.expected +52 -0
- data/test/command/suite/search/error/unknown-source.test +12 -0
- data/test/command/suite/search/group/count.expected +10 -0
- data/test/command/suite/search/group/count.test +18 -0
- data/test/command/suite/search/group/limit.expected +15 -0
- data/test/command/suite/search/group/limit.test +20 -0
- data/test/command/suite/search/group/string.expected +32 -0
- data/test/command/suite/search/group/string.test +40 -0
- data/test/command/suite/search/group/subrecord/with-sort.catalog.json +33 -0
- data/test/command/suite/search/group/subrecord/with-sort.expected +30 -0
- data/test/command/suite/search/group/subrecord/with-sort.test +81 -0
- data/test/command/suite/search/multiple/chained.expected +41 -0
- data/test/command/suite/search/multiple/chained.test +39 -0
- data/test/command/suite/search/multiple/parallel.expected +35 -0
- data/test/command/suite/search/multiple/parallel.test +35 -0
- data/test/command/suite/search/output/attributes/invalid.catalog.json +13 -0
- data/test/command/suite/search/output/attributes/invalid.expected +44 -0
- data/test/command/suite/search/output/attributes/invalid.test +28 -0
- data/test/command/suite/search/range/only-output.expected +24 -0
- data/test/command/suite/search/range/only-output.test +23 -0
- data/test/command/suite/search/range/only-sort.expected +24 -0
- data/test/command/suite/search/range/only-sort.test +26 -0
- data/test/command/suite/search/range/sort-and-output.expected +21 -0
- data/test/command/suite/search/range/sort-and-output.test +27 -0
- data/test/command/suite/search/range/too-large-output-offset.expected +12 -0
- data/test/command/suite/search/range/too-large-output-offset.test +23 -0
- data/test/command/suite/search/range/too-large-sort-offset.expected +12 -0
- data/test/command/suite/search/range/too-large-sort-offset.test +26 -0
- data/test/command/suite/search/response/elapsed_time.catalog.json +13 -0
- data/test/command/suite/search/response/elapsed_time.expected +11 -0
- data/test/command/suite/search/response/elapsed_time.test +26 -0
- data/test/command/suite/search/response/records/value/time.expected +20 -0
- data/test/command/suite/search/response/records/value/time.test +22 -0
- data/test/command/suite/search/simple.expected +48 -0
- data/test/command/suite/search/simple.test +22 -0
- data/test/command/suite/search/sort/default-offset-limit.expected +39 -0
- data/test/command/suite/search/sort/default-offset-limit.test +24 -0
- data/test/command/suite/search/sort/invisible-column.expected +24 -0
- data/test/command/suite/search/sort/invisible-column.test +26 -0
- data/test/command/suite/watch/subscribe.expected +6 -0
- data/test/command/suite/watch/subscribe.test +9 -0
- data/test/command/suite/watch/unsubscribe.expected +6 -0
- data/test/command/suite/watch/unsubscribe.test +9 -0
- data/test/performance/run-test.rb +56 -0
- data/test/performance/watch/catalog.json +33 -0
- data/test/performance/watch/feed.json +9 -0
- data/test/performance/watch/fluentd.conf +11 -0
- data/test/performance/watch/subscribe.json +3 -0
- data/test/unit/catalog/test_collection_volume.rb +103 -0
- data/test/unit/catalog/test_dataset.rb +104 -0
- data/test/unit/catalog/test_schema.rb +226 -0
- data/test/unit/catalog/test_single_volume.rb +31 -0
- data/test/unit/catalog/test_slice.rb +92 -0
- data/test/unit/catalog/test_version1.rb +361 -0
- data/test/unit/catalog/test_version2.rb +124 -0
- data/test/unit/catalog/test_version2_validator.rb +66 -0
- data/test/unit/catalog/test_volume_collection.rb +50 -0
- data/test/unit/fixtures/array.grn +18 -0
- data/test/unit/fixtures/catalog/version1.json +40 -0
- data/test/unit/fixtures/catalog/version2.json +62 -0
- data/test/unit/fixtures/document.grn +34 -0
- data/test/unit/fixtures/reference/array.grn +11 -0
- data/test/unit/fixtures/reference/hash.grn +7 -0
- data/test/unit/helper/distributed_search_planner_helper.rb +83 -0
- data/test/unit/helper/fixture.rb +28 -0
- data/test/unit/helper/plugin_helper.rb +38 -0
- data/test/unit/helper/sandbox.rb +86 -0
- data/test/unit/helper/stub_worker.rb +27 -0
- data/test/unit/helper/watch_helper.rb +23 -0
- data/test/unit/helper.rb +28 -0
- data/test/unit/plugins/crud/test_add.rb +190 -0
- data/test/unit/plugins/groonga/select/test_adapter_input.rb +510 -0
- data/test/unit/plugins/groonga/select/test_adapter_output.rb +201 -0
- data/test/unit/plugins/groonga/test_column_create.rb +171 -0
- data/test/unit/plugins/groonga/test_column_list.rb +170 -0
- data/test/unit/plugins/groonga/test_column_remove.rb +98 -0
- data/test/unit/plugins/groonga/test_column_rename.rb +105 -0
- data/test/unit/plugins/groonga/test_delete.rb +127 -0
- data/test/unit/plugins/groonga/test_table_create.rb +147 -0
- data/test/unit/plugins/groonga/test_table_list.rb +184 -0
- data/test/unit/plugins/groonga/test_table_remove.rb +61 -0
- data/test/unit/plugins/search/planner/test_basic.rb +120 -0
- data/test/unit/plugins/search/planner/test_group_by.rb +573 -0
- data/test/unit/plugins/search/planner/test_output.rb +388 -0
- data/test/unit/plugins/search/planner/test_sort_by.rb +938 -0
- data/test/unit/plugins/search/test_collector.rb +806 -0
- data/test/unit/plugins/search/test_handler.rb +930 -0
- data/test/unit/plugins/search/test_planner.rb +174 -0
- data/test/unit/plugins/test_basic.rb +510 -0
- data/test/unit/plugins/test_groonga.rb +70 -0
- data/test/unit/plugins/test_watch.rb +211 -0
- data/test/unit/run-test.rb +56 -0
- data/test/unit/test_catalog_generator.rb +93 -0
- data/test/unit/test_message_matcher.rb +160 -0
- data/test/unit/test_schema_applier.rb +59 -0
- data/test/unit/test_sweeper.rb +95 -0
- data/test/unit/test_watch_schema.rb +57 -0
- data/test/unit/test_watcher.rb +336 -0
- metadata +759 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
#@include fixture/documents.jsons
|
2
|
+
{
|
3
|
+
"type": "search",
|
4
|
+
"dataset": "Droonga",
|
5
|
+
"body": {
|
6
|
+
"queries": {
|
7
|
+
"result": {
|
8
|
+
"source": "Sections",
|
9
|
+
"sortBy": {
|
10
|
+
"keys": ["-_key"]
|
11
|
+
},
|
12
|
+
"output": {
|
13
|
+
"elements": [
|
14
|
+
"count",
|
15
|
+
"attributes",
|
16
|
+
"records"
|
17
|
+
],
|
18
|
+
"limit": -1,
|
19
|
+
"attributes": ["_key"]
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"inReplyTo": "request-id",
|
3
|
+
"statusCode": 200,
|
4
|
+
"type": "search.result",
|
5
|
+
"body": {
|
6
|
+
"result": {
|
7
|
+
"count": 9,
|
8
|
+
"records": [
|
9
|
+
[
|
10
|
+
"Groonga library"
|
11
|
+
],
|
12
|
+
[
|
13
|
+
"Geo-location (latitude and longitude) search"
|
14
|
+
],
|
15
|
+
[
|
16
|
+
"Sharable storage and read lock-free"
|
17
|
+
],
|
18
|
+
[
|
19
|
+
"Inverted index and tokenizer"
|
20
|
+
]
|
21
|
+
]
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#@include fixture/documents.jsons
|
2
|
+
{
|
3
|
+
"type": "search",
|
4
|
+
"dataset": "Droonga",
|
5
|
+
"body": {
|
6
|
+
"queries": {
|
7
|
+
"result": {
|
8
|
+
"source": "Sections",
|
9
|
+
"sortBy": {
|
10
|
+
"keys": ["-_key"],
|
11
|
+
"offset": 2,
|
12
|
+
"limit": 4
|
13
|
+
},
|
14
|
+
"output": {
|
15
|
+
"elements": [
|
16
|
+
"count",
|
17
|
+
"attributes",
|
18
|
+
"records"
|
19
|
+
],
|
20
|
+
"limit": -1,
|
21
|
+
"attributes": ["title"]
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Copyright (C) 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 "rbconfig"
|
19
|
+
require "fileutils"
|
20
|
+
|
21
|
+
def run(*command_line)
|
22
|
+
command_line = command_line.collect do |argument|
|
23
|
+
argument.to_s
|
24
|
+
end
|
25
|
+
return if system(*command_line)
|
26
|
+
puts("failed to run: #{command_line.join(' ')}")
|
27
|
+
exit(false)
|
28
|
+
end
|
29
|
+
|
30
|
+
base_dir = File.dirname(__FILE__)
|
31
|
+
lib_dir = File.expand_path(File.join(base_dir, "..", "..", "lib"))
|
32
|
+
|
33
|
+
drnbench_options = []
|
34
|
+
drnbench_options.concat(["--start-n-subscribers", 10])
|
35
|
+
drnbench_options.concat(["--n-publishings", 10])
|
36
|
+
drnbench_options.concat(["--n-steps", 9])
|
37
|
+
drnbench_options.concat(["--timeout", 5])
|
38
|
+
drnbench_options.concat(["--subscribe-request-file",
|
39
|
+
File.join(base_dir, "watch", "subscribe.json")])
|
40
|
+
drnbench_options.concat(["--feed-file",
|
41
|
+
File.join(base_dir, "watch", "feed.json")])
|
42
|
+
|
43
|
+
protocol_adapter_dir = File.join(base_dir, "..", "..", "..", "express-droonga")
|
44
|
+
if File.exist?(protocol_adapter_dir)
|
45
|
+
drnbench_options.concat(["--protocol-adapter-application-dir", protocol_adapter_dir])
|
46
|
+
drnbench_options.concat(["--protocol-adapter-port", 13000])
|
47
|
+
end
|
48
|
+
|
49
|
+
drnbench_options.concat(["--engine-config-path",
|
50
|
+
File.join(base_dir, "watch")])
|
51
|
+
drnbench_options.concat(["--fluentd-options", "-I#{lib_dir}"])
|
52
|
+
drnbench_options.concat(ARGV)
|
53
|
+
|
54
|
+
drnbench_publish_subscribe = Gem.bin_path("drnbench",
|
55
|
+
"drnbench-publish-subscribe")
|
56
|
+
run(drnbench_publish_subscribe, *drnbench_options)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
{
|
2
|
+
"versoin": 1,
|
3
|
+
"effective_date": "2013-09-01T00:00:00Z",
|
4
|
+
"zones": ["localhost:23003/droonga"],
|
5
|
+
"farms": {
|
6
|
+
"localhost:23003/droonga": {
|
7
|
+
"device": ".",
|
8
|
+
"capacity": 10
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"datasets": {
|
12
|
+
"Watch": {
|
13
|
+
"workers": 2,
|
14
|
+
"plugins": ["search", "groonga", "add", "watch"],
|
15
|
+
"number_of_replicas": 1,
|
16
|
+
"number_of_partitions": 1,
|
17
|
+
"partition_key": "_key",
|
18
|
+
"date_range": "infinity",
|
19
|
+
"ring": {
|
20
|
+
"localhost:23041": {
|
21
|
+
"weight": 50,
|
22
|
+
"partitions": {
|
23
|
+
"2013-09-01": [
|
24
|
+
"localhost:23003/droonga.watch"
|
25
|
+
]
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"options": {
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,103 @@
|
|
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
|
+
require "droonga/catalog/dataset"
|
17
|
+
|
18
|
+
class CatalogSingleVolumeTest < Test::Unit::TestCase
|
19
|
+
def create_collection_volume(data)
|
20
|
+
minimum_dataset_data = {
|
21
|
+
"replicas" => {
|
22
|
+
},
|
23
|
+
}
|
24
|
+
dataset = Droonga::Catalog::Dataset.new("DatasetName", minimum_dataset_data)
|
25
|
+
Droonga::Catalog::CollectionVolume.new(dataset, data)
|
26
|
+
end
|
27
|
+
|
28
|
+
class DimensionTest < self
|
29
|
+
def test_default
|
30
|
+
data = {
|
31
|
+
"slices" => [],
|
32
|
+
}
|
33
|
+
volume = create_collection_volume(data)
|
34
|
+
assert_equal("_key", volume.dimension)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_specified
|
38
|
+
data = {
|
39
|
+
"dimension" => "group",
|
40
|
+
"slices" => [],
|
41
|
+
}
|
42
|
+
volume = create_collection_volume(data)
|
43
|
+
assert_equal("group", volume.dimension)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class SlicerTest < self
|
48
|
+
def test_default
|
49
|
+
data = {
|
50
|
+
"slices" => [],
|
51
|
+
}
|
52
|
+
volume = create_collection_volume(data)
|
53
|
+
assert_equal("hash", volume.slicer)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_specified
|
57
|
+
data = {
|
58
|
+
"slicer" => "ordinal",
|
59
|
+
}
|
60
|
+
volume = create_collection_volume(data)
|
61
|
+
assert_equal("ordinal", volume.slicer)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class SlicesTest < self
|
66
|
+
def test_empty
|
67
|
+
data = {
|
68
|
+
"slices" => [],
|
69
|
+
}
|
70
|
+
volume = create_collection_volume(data)
|
71
|
+
assert_equal([], volume.slices)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class RatioOrderSlicerTest < self
|
76
|
+
class TotalWeightTest < self
|
77
|
+
def test_three_slices
|
78
|
+
data = {
|
79
|
+
"slicer" => "hash",
|
80
|
+
"slices" => [
|
81
|
+
{
|
82
|
+
"weight" => 10,
|
83
|
+
},
|
84
|
+
{
|
85
|
+
"weight" => 20,
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"weight" => 30,
|
89
|
+
},
|
90
|
+
],
|
91
|
+
}
|
92
|
+
assert_equal(10 + 20 + 30,
|
93
|
+
total_weight(data))
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
def total_weight(data)
|
98
|
+
volume = create_collection_volume(data)
|
99
|
+
volume.send(:compute_total_weight)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,104 @@
|
|
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
|
+
require "droonga/catalog/dataset"
|
17
|
+
|
18
|
+
class CatalogDatasetTest < Test::Unit::TestCase
|
19
|
+
private
|
20
|
+
def create_dataset(data)
|
21
|
+
Droonga::Catalog::Dataset.new("DatasetName", data)
|
22
|
+
end
|
23
|
+
|
24
|
+
class NameTest < self
|
25
|
+
def test_reader
|
26
|
+
dataset = Droonga::Catalog::Dataset.new("DatasetName", {})
|
27
|
+
assert_equal("DatasetName", dataset.name)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class NWorkersTest < self
|
32
|
+
def test_default
|
33
|
+
data = {
|
34
|
+
}
|
35
|
+
dataset = create_dataset(data)
|
36
|
+
assert_equal(0, dataset.n_workers)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_specified
|
40
|
+
data = {
|
41
|
+
"nWorkers" => 2
|
42
|
+
}
|
43
|
+
dataset = create_dataset(data)
|
44
|
+
assert_equal(2, dataset.n_workers)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class SchemaTest < self
|
49
|
+
def test_empty
|
50
|
+
data = {
|
51
|
+
"schema" => {
|
52
|
+
}
|
53
|
+
}
|
54
|
+
dataset = create_dataset(data)
|
55
|
+
assert_equal(Droonga::Catalog::Schema.new("dataset_name", {}),
|
56
|
+
dataset.schema)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class PluginsTest < self
|
61
|
+
def test_default
|
62
|
+
data = {
|
63
|
+
}
|
64
|
+
dataset = create_dataset(data)
|
65
|
+
assert_equal([], dataset.plugins)
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_multiple
|
69
|
+
data = {
|
70
|
+
"plugins" => ["groonga", "crud"],
|
71
|
+
}
|
72
|
+
dataset = create_dataset(data)
|
73
|
+
assert_equal(["groonga", "crud"], dataset.plugins)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class FactTest < self
|
78
|
+
def test_default
|
79
|
+
data = {
|
80
|
+
}
|
81
|
+
dataset = create_dataset(data)
|
82
|
+
assert_nil(dataset.fact)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_specified
|
86
|
+
data = {
|
87
|
+
"fact" => "Users",
|
88
|
+
}
|
89
|
+
dataset = create_dataset(data)
|
90
|
+
assert_equal("Users", dataset.fact)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
class ReplicasTest < self
|
95
|
+
def test_empty
|
96
|
+
data = {
|
97
|
+
"replicas" => [],
|
98
|
+
}
|
99
|
+
dataset = create_dataset(data)
|
100
|
+
assert_equal(Droonga::Catalog::VolumeCollection.new([]),
|
101
|
+
dataset.replicas)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,226 @@
|
|
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
|
+
require "droonga/catalog/schema"
|
17
|
+
|
18
|
+
class CatalogSchemaTest < Test::Unit::TestCase
|
19
|
+
class SchemaTest < self
|
20
|
+
def create_schema(dataset_name, data)
|
21
|
+
Droonga::Catalog::Schema.new(dataset_name, data)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class TableTest < self
|
26
|
+
def create_table(name, data)
|
27
|
+
Droonga::Catalog::Schema::Table.new(name, data)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_name
|
31
|
+
assert_equal("table_name",
|
32
|
+
create_table("table_name",
|
33
|
+
{}).name)
|
34
|
+
end
|
35
|
+
|
36
|
+
class TypeTest < self
|
37
|
+
def type(data)
|
38
|
+
create_table("table_name", data).type
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_default
|
42
|
+
assert_equal("Hash", type({}))
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_array
|
46
|
+
create_table("Array", type("Array"))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class TypeSymbolTest < self
|
51
|
+
def type_symbol(type)
|
52
|
+
data = {
|
53
|
+
"type" => type,
|
54
|
+
}
|
55
|
+
create_table("table_name", data).type_symbol
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_array
|
59
|
+
assert_equal(:array, type_symbol("Array"))
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_hash
|
63
|
+
assert_equal(:hash, type_symbol("Hash"))
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_patricia_trie
|
67
|
+
assert_equal(:patricia_trie, type_symbol("PatriciaTrie"))
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_double_array_trie
|
71
|
+
assert_equal(:double_array_trie, type_symbol("DoubleArrayTrie"))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_key_type
|
76
|
+
assert_equal("ShortText",
|
77
|
+
create_table("table_name",
|
78
|
+
{
|
79
|
+
"keyType" => "ShortText"
|
80
|
+
}).key_type)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_key_type_groonga
|
84
|
+
assert_equal("Int64",
|
85
|
+
create_table("table_name",
|
86
|
+
{
|
87
|
+
"keyType" => "Integer"
|
88
|
+
}).key_type_groonga)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_tokenizer
|
92
|
+
assert_equal("TokenBigram",
|
93
|
+
create_table("table_name",
|
94
|
+
{
|
95
|
+
"tokenizer" => "TokenBigram"
|
96
|
+
}).tokenizer)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_normalizer
|
100
|
+
assert_equal("NormalizerAuto",
|
101
|
+
create_table("table_name",
|
102
|
+
{
|
103
|
+
"normalizer" => "NormalizerAuto"
|
104
|
+
}).normalizer)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class ColumnTest < self
|
109
|
+
def create_column(name, data)
|
110
|
+
Droonga::Catalog::Schema::Column.new("table_name", name, data)
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_name
|
114
|
+
assert_equal("column_name",
|
115
|
+
create_column("column_name",
|
116
|
+
{}).name)
|
117
|
+
end
|
118
|
+
|
119
|
+
class TypeTest < self
|
120
|
+
def type(data)
|
121
|
+
create_column("column_name", data).type
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_scalar
|
125
|
+
assert_equal("Scalar", type("type" => "Scalar"))
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_default
|
129
|
+
assert_equal("Scalar", type({}))
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
class TypeSymbolTest < self
|
134
|
+
def type_symbol(type)
|
135
|
+
data = {
|
136
|
+
"type" => type,
|
137
|
+
}
|
138
|
+
create_column("column_name", data).type_symbol
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_scalar
|
142
|
+
assert_equal(:scalar, type_symbol("Scalar"))
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_vector
|
146
|
+
assert_equal(:vector, type_symbol("Vector"))
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_index
|
150
|
+
assert_equal(:index, type_symbol("Index"))
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
class ValueType < self
|
155
|
+
def value_type(data)
|
156
|
+
create_column("column_name", data).value_type
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_data_type
|
160
|
+
assert_equal("ShortText", value_type("valueType" => "ShortText"))
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_reference_type
|
164
|
+
assert_equal("Users", value_type("valueType" => "Users"))
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_default
|
168
|
+
assert_nil(value_type({}))
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
class ValueTypeGroonga < self
|
173
|
+
def value_type_groonga(type)
|
174
|
+
data = {
|
175
|
+
"valueType" => type,
|
176
|
+
}
|
177
|
+
create_column("column_name", data).value_type_groonga
|
178
|
+
end
|
179
|
+
|
180
|
+
def test_integer
|
181
|
+
assert_equal("Int64", value_type_groonga("Integer"))
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
class ColumnVectorOptionsTest < self
|
187
|
+
def create_options(data)
|
188
|
+
Droonga::Catalog::Schema::ColumnVectorOptions.new(data)
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_weight
|
192
|
+
data = {
|
193
|
+
"weight" => true
|
194
|
+
}
|
195
|
+
options = create_options(data)
|
196
|
+
assert_equal(true, options.weight)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
class ColumnIndexOptionsTest < self
|
201
|
+
def create_options(data)
|
202
|
+
Droonga::Catalog::Schema::ColumnIndexOptions.new(data)
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_section
|
206
|
+
assert_equal(true,
|
207
|
+
create_options({
|
208
|
+
"section" => true
|
209
|
+
}).section)
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_weight
|
213
|
+
assert_equal(true,
|
214
|
+
create_options({
|
215
|
+
"weight" => true
|
216
|
+
}).weight)
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_position
|
220
|
+
assert_equal(true,
|
221
|
+
create_options({
|
222
|
+
"position" => true
|
223
|
+
}).position)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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
|
+
require "droonga/catalog/single_volume"
|
17
|
+
|
18
|
+
class CatalogSingleVolumeTest < Test::Unit::TestCase
|
19
|
+
def create_single_volume(data)
|
20
|
+
Droonga::Catalog::SingleVolume.new(data)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_address
|
24
|
+
data = {
|
25
|
+
"address" => "127.0.0.1:10047/volume.000",
|
26
|
+
}
|
27
|
+
volume = create_single_volume(data)
|
28
|
+
assert_equal("127.0.0.1:10047/volume.000",
|
29
|
+
volume.address)
|
30
|
+
end
|
31
|
+
end
|