fluent-plugin-droonga 0.9.0 → 0.9.9

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.
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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-droonga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Droonga Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2014-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -181,8 +181,7 @@ dependencies:
181
181
  description: Droonga(distributed Groonga) plugin for Fluent event collector
182
182
  email:
183
183
  - droonga@groonga.org
184
- executables:
185
- - grn2jsons
184
+ executables: []
186
185
  extensions: []
187
186
  extra_rdoc_files: []
188
187
  files:
@@ -199,21 +198,23 @@ files:
199
198
  - benchmark/watch/benchmark-notify.sh
200
199
  - benchmark/watch/benchmark-publish.rb
201
200
  - benchmark/watch/benchmark-scan.rb
202
- - bin/grn2jsons
203
201
  - doc/text/news.md
204
202
  - fluent-plugin-droonga.gemspec
203
+ - lib/droonga/adapter.rb
204
+ - lib/droonga/adapter_runner.rb
205
205
  - lib/droonga/catalog.rb
206
206
  - lib/droonga/catalog/base.rb
207
+ - lib/droonga/catalog/dataset.rb
207
208
  - lib/droonga/catalog/version1.rb
208
209
  - lib/droonga/catalog_loader.rb
209
210
  - lib/droonga/catalog_observer.rb
210
211
  - lib/droonga/collector.rb
211
212
  - lib/droonga/collector_plugin.rb
212
- - lib/droonga/command_mapper.rb
213
+ - lib/droonga/command.rb
214
+ - lib/droonga/command_repository.rb
213
215
  - lib/droonga/dispatcher.rb
214
- - lib/droonga/distribution_planner.rb
216
+ - lib/droonga/distributed_command_planner.rb
215
217
  - lib/droonga/distributor.rb
216
- - lib/droonga/distributor_plugin.rb
217
218
  - lib/droonga/engine.rb
218
219
  - lib/droonga/event_loop.rb
219
220
  - lib/droonga/farm.rb
@@ -223,65 +224,70 @@ files:
223
224
  - lib/droonga/handler_message.rb
224
225
  - lib/droonga/handler_messenger.rb
225
226
  - lib/droonga/handler_plugin.rb
226
- - lib/droonga/input_adapter.rb
227
- - lib/droonga/input_adapter_plugin.rb
227
+ - lib/droonga/handler_runner.rb
228
228
  - lib/droonga/input_message.rb
229
+ - lib/droonga/legacy_pluggable.rb
230
+ - lib/droonga/legacy_plugin.rb
231
+ - lib/droonga/legacy_plugin_repository.rb
229
232
  - lib/droonga/logger.rb
233
+ - lib/droonga/message_matcher.rb
230
234
  - lib/droonga/message_pack_packer.rb
231
235
  - lib/droonga/message_processing_error.rb
232
236
  - lib/droonga/message_pusher.rb
233
237
  - lib/droonga/message_receiver.rb
234
- - lib/droonga/output_adapter.rb
235
- - lib/droonga/output_adapter_plugin.rb
236
238
  - lib/droonga/output_message.rb
237
239
  - lib/droonga/partition.rb
240
+ - lib/droonga/planner.rb
241
+ - lib/droonga/planner_plugin.rb
238
242
  - lib/droonga/pluggable.rb
239
243
  - lib/droonga/plugin.rb
240
244
  - lib/droonga/plugin/collector/basic.rb
241
- - lib/droonga/plugin/collector/groonga.rb
242
245
  - lib/droonga/plugin/collector/search.rb
243
- - lib/droonga/plugin/distributor/crud.rb
244
- - lib/droonga/plugin/distributor/distributed_search_planner.rb
245
- - lib/droonga/plugin/distributor/groonga.rb
246
- - lib/droonga/plugin/distributor/search.rb
247
- - lib/droonga/plugin/distributor/watch.rb
248
- - lib/droonga/plugin/handler/add.rb
249
- - lib/droonga/plugin/handler/forward.rb
250
- - lib/droonga/plugin/handler/groonga.rb
251
- - lib/droonga/plugin/handler/groonga/column_create.rb
252
- - lib/droonga/plugin/handler/groonga/table_create.rb
253
- - lib/droonga/plugin/handler/groonga/table_remove.rb
254
- - lib/droonga/plugin/handler/search.rb
255
- - lib/droonga/plugin/handler/watch.rb
256
- - lib/droonga/plugin/input_adapter/crud.rb
257
- - lib/droonga/plugin/input_adapter/groonga.rb
258
- - lib/droonga/plugin/input_adapter/groonga/select.rb
259
- - lib/droonga/plugin/output_adapter/crud.rb
260
- - lib/droonga/plugin/output_adapter/groonga.rb
261
- - lib/droonga/plugin/output_adapter/groonga/select.rb
246
+ - lib/droonga/plugin/metadata/adapter_message.rb
247
+ - lib/droonga/plugin/metadata/handler_action.rb
248
+ - lib/droonga/plugin/metadata/input_message.rb
249
+ - lib/droonga/plugin/planner/crud.rb
250
+ - lib/droonga/plugin/planner/distributed_search_planner.rb
251
+ - lib/droonga/plugin/planner/groonga.rb
252
+ - lib/droonga/plugin/planner/search.rb
253
+ - lib/droonga/plugin/planner/watch.rb
262
254
  - lib/droonga/plugin_loader.rb
263
255
  - lib/droonga/plugin_registerable.rb
264
- - lib/droonga/plugin_repository.rb
256
+ - lib/droonga/plugin_registry.rb
257
+ - lib/droonga/plugins/crud.rb
258
+ - lib/droonga/plugins/error.rb
259
+ - lib/droonga/plugins/groonga.rb
260
+ - lib/droonga/plugins/groonga/column_create.rb
261
+ - lib/droonga/plugins/groonga/generic_command.rb
262
+ - lib/droonga/plugins/groonga/generic_response.rb
263
+ - lib/droonga/plugins/groonga/select.rb
264
+ - lib/droonga/plugins/groonga/table_create.rb
265
+ - lib/droonga/plugins/groonga/table_remove.rb
266
+ - lib/droonga/plugins/search.rb
267
+ - lib/droonga/plugins/watch.rb
265
268
  - lib/droonga/processor.rb
266
269
  - lib/droonga/replier.rb
267
270
  - lib/droonga/searcher.rb
271
+ - lib/droonga/searcher/mecab_filter.rb
268
272
  - lib/droonga/server.rb
269
273
  - lib/droonga/session.rb
270
274
  - lib/droonga/sweeper.rb
271
275
  - lib/droonga/test.rb
272
- - lib/droonga/test/stub_distributor.rb
273
276
  - lib/droonga/test/stub_handler.rb
274
277
  - lib/droonga/test/stub_handler_message.rb
275
278
  - lib/droonga/test/stub_handler_messenger.rb
279
+ - lib/droonga/test/stub_planner.rb
276
280
  - lib/droonga/time_formatter.rb
277
281
  - lib/droonga/watch_schema.rb
278
282
  - lib/droonga/watcher.rb
279
283
  - lib/droonga/worker.rb
280
284
  - lib/fluent/plugin/out_droonga.rb
281
- - lib/groonga_command_converter.rb
282
285
  - sample/cluster/catalog.json
283
286
  - sample/cluster/fluentd.conf
284
- - sample/fluentd.conf
287
+ - sample/mecab_filter/data.grn
288
+ - sample/mecab_filter/ddl.grn
289
+ - sample/mecab_filter/search_with_mecab_filter.json
290
+ - sample/mecab_filter/search_without_mecab_filter.json
285
291
  - test/command/config/default/catalog.json
286
292
  - test/command/config/default/fluentd.conf
287
293
  - test/command/fixture/documents.jsons
@@ -347,6 +353,8 @@ files:
347
353
  - test/command/suite/search/error/deeply-cyclic-source.test
348
354
  - test/command/suite/search/error/missing-source-parameter.expected
349
355
  - test/command/suite/search/error/missing-source-parameter.test
356
+ - test/command/suite/search/error/no-query.expected
357
+ - test/command/suite/search/error/no-query.test
350
358
  - test/command/suite/search/error/unknown-source.expected
351
359
  - test/command/suite/search/error/unknown-source.test
352
360
  - test/command/suite/search/group/count.expected
@@ -386,6 +394,7 @@ files:
386
394
  - test/performance/watch/feed.json
387
395
  - test/performance/watch/fluentd.conf
388
396
  - test/performance/watch/subscribe.json
397
+ - test/unit/catalog/test_dataset.rb
389
398
  - test/unit/catalog/test_version1.rb
390
399
  - test/unit/fixtures/array.grn
391
400
  - test/unit/fixtures/catalog/version1.json
@@ -393,6 +402,7 @@ files:
393
402
  - test/unit/fixtures/reference/array.grn
394
403
  - test/unit/fixtures/reference/hash.grn
395
404
  - test/unit/helper.rb
405
+ - test/unit/helper/distributed_search_planner_helper.rb
396
406
  - test/unit/helper/fixture.rb
397
407
  - test/unit/helper/plugin_helper.rb
398
408
  - test/unit/helper/sandbox.rb
@@ -400,24 +410,27 @@ files:
400
410
  - test/unit/helper/watch_helper.rb
401
411
  - test/unit/plugin/collector/test_basic.rb
402
412
  - test/unit/plugin/collector/test_search.rb
403
- - test/unit/plugin/distributor/test_search.rb
404
- - test/unit/plugin/distributor/test_search_planner.rb
405
- - test/unit/plugin/handler/groonga/test_column_create.rb
406
- - test/unit/plugin/handler/groonga/test_table_create.rb
407
- - test/unit/plugin/handler/groonga/test_table_remove.rb
408
- - test/unit/plugin/handler/test_add.rb
409
- - test/unit/plugin/handler/test_groonga.rb
410
- - test/unit/plugin/handler/test_search.rb
411
- - test/unit/plugin/handler/test_watch.rb
412
- - test/unit/plugin/input_adapter/groonga/test_select.rb
413
- - test/unit/plugin/output_adapter/groonga/test_select.rb
413
+ - test/unit/plugin/planner/search_planner/test_basic.rb
414
+ - test/unit/plugin/planner/search_planner/test_group_by.rb
415
+ - test/unit/plugin/planner/search_planner/test_output.rb
416
+ - test/unit/plugin/planner/search_planner/test_sort_by.rb
417
+ - test/unit/plugin/planner/test_search.rb
418
+ - test/unit/plugins/crud/test_add.rb
419
+ - test/unit/plugins/groonga/select/test_adapter_input.rb
420
+ - test/unit/plugins/groonga/select/test_adapter_output.rb
421
+ - test/unit/plugins/groonga/test_column_create.rb
422
+ - test/unit/plugins/groonga/test_table_create.rb
423
+ - test/unit/plugins/groonga/test_table_remove.rb
424
+ - test/unit/plugins/test_groonga.rb
425
+ - test/unit/plugins/test_search.rb
426
+ - test/unit/plugins/test_watch.rb
414
427
  - test/unit/run-test.rb
415
- - test/unit/test_command_mapper.rb
416
- - test/unit/test_groonga_command_converter.rb
428
+ - test/unit/test_command_repository.rb
429
+ - test/unit/test_legacy_plugin.rb
430
+ - test/unit/test_legacy_plugin_repository.rb
431
+ - test/unit/test_message_matcher.rb
417
432
  - test/unit/test_message_pack_packer.rb
418
433
  - test/unit/test_output.rb
419
- - test/unit/test_plugin.rb
420
- - test/unit/test_plugin_repository.rb
421
434
  - test/unit/test_sweeper.rb
422
435
  - test/unit/test_time_formatter.rb
423
436
  - test/unit/test_watch_schema.rb
@@ -511,6 +524,8 @@ test_files:
511
524
  - test/command/suite/search/error/deeply-cyclic-source.test
512
525
  - test/command/suite/search/error/missing-source-parameter.expected
513
526
  - test/command/suite/search/error/missing-source-parameter.test
527
+ - test/command/suite/search/error/no-query.expected
528
+ - test/command/suite/search/error/no-query.test
514
529
  - test/command/suite/search/error/unknown-source.expected
515
530
  - test/command/suite/search/error/unknown-source.test
516
531
  - test/command/suite/search/group/count.expected
@@ -550,6 +565,7 @@ test_files:
550
565
  - test/performance/watch/feed.json
551
566
  - test/performance/watch/fluentd.conf
552
567
  - test/performance/watch/subscribe.json
568
+ - test/unit/catalog/test_dataset.rb
553
569
  - test/unit/catalog/test_version1.rb
554
570
  - test/unit/fixtures/array.grn
555
571
  - test/unit/fixtures/catalog/version1.json
@@ -557,6 +573,7 @@ test_files:
557
573
  - test/unit/fixtures/reference/array.grn
558
574
  - test/unit/fixtures/reference/hash.grn
559
575
  - test/unit/helper.rb
576
+ - test/unit/helper/distributed_search_planner_helper.rb
560
577
  - test/unit/helper/fixture.rb
561
578
  - test/unit/helper/plugin_helper.rb
562
579
  - test/unit/helper/sandbox.rb
@@ -564,24 +581,27 @@ test_files:
564
581
  - test/unit/helper/watch_helper.rb
565
582
  - test/unit/plugin/collector/test_basic.rb
566
583
  - test/unit/plugin/collector/test_search.rb
567
- - test/unit/plugin/distributor/test_search.rb
568
- - test/unit/plugin/distributor/test_search_planner.rb
569
- - test/unit/plugin/handler/groonga/test_column_create.rb
570
- - test/unit/plugin/handler/groonga/test_table_create.rb
571
- - test/unit/plugin/handler/groonga/test_table_remove.rb
572
- - test/unit/plugin/handler/test_add.rb
573
- - test/unit/plugin/handler/test_groonga.rb
574
- - test/unit/plugin/handler/test_search.rb
575
- - test/unit/plugin/handler/test_watch.rb
576
- - test/unit/plugin/input_adapter/groonga/test_select.rb
577
- - test/unit/plugin/output_adapter/groonga/test_select.rb
584
+ - test/unit/plugin/planner/search_planner/test_basic.rb
585
+ - test/unit/plugin/planner/search_planner/test_group_by.rb
586
+ - test/unit/plugin/planner/search_planner/test_output.rb
587
+ - test/unit/plugin/planner/search_planner/test_sort_by.rb
588
+ - test/unit/plugin/planner/test_search.rb
589
+ - test/unit/plugins/crud/test_add.rb
590
+ - test/unit/plugins/groonga/select/test_adapter_input.rb
591
+ - test/unit/plugins/groonga/select/test_adapter_output.rb
592
+ - test/unit/plugins/groonga/test_column_create.rb
593
+ - test/unit/plugins/groonga/test_table_create.rb
594
+ - test/unit/plugins/groonga/test_table_remove.rb
595
+ - test/unit/plugins/test_groonga.rb
596
+ - test/unit/plugins/test_search.rb
597
+ - test/unit/plugins/test_watch.rb
578
598
  - test/unit/run-test.rb
579
- - test/unit/test_command_mapper.rb
580
- - test/unit/test_groonga_command_converter.rb
599
+ - test/unit/test_command_repository.rb
600
+ - test/unit/test_legacy_plugin.rb
601
+ - test/unit/test_legacy_plugin_repository.rb
602
+ - test/unit/test_message_matcher.rb
581
603
  - test/unit/test_message_pack_packer.rb
582
604
  - test/unit/test_output.rb
583
- - test/unit/test_plugin.rb
584
- - test/unit/test_plugin_repository.rb
585
605
  - test/unit/test_sweeper.rb
586
606
  - test/unit/test_time_formatter.rb
587
607
  - test/unit/test_watch_schema.rb
data/bin/grn2jsons DELETED
@@ -1,82 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*- coding: utf-8 -*-
3
- #
4
- # Copyright (C) 2013 Droonga Project
5
- #
6
- # This library is free software; you can redistribute it and/or
7
- # modify it under the terms of the GNU Lesser General Public
8
- # License version 2.1 as published by the Free Software Foundation.
9
- #
10
- # This library is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- # Lesser General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with this library; if not, write to the Free Software
17
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
-
19
- require "groonga_command_converter"
20
- require "json"
21
- require "ostruct"
22
- require "optparse"
23
-
24
- options = OpenStruct.new
25
- option_parser = OptionParser.new do |parser|
26
- parser.on("-i=ID", "--id=ID",
27
- "base id. (optional)") do |id|
28
- options.id = id
29
- end
30
-
31
- parser.on("-d=DATE", "--date=DATE",
32
- "date. (optional)") do |date|
33
- options.date = date
34
- end
35
-
36
- parser.on("-r=REPLYTO", "--reply-to=REPLYTO",
37
- "value of replyTo field.") do |reply_to|
38
- options.reply_to = reply_to
39
- end
40
-
41
- parser.on("-s=DATASET", "--dataset=DATASET",
42
- "dataset.") do |dataset|
43
- options.dataset = dataset
44
- end
45
- end
46
- args = option_parser.parse!(ARGV)
47
-
48
- if options.dataset.nil?
49
- raise "You must specify the name of the dataset by --dataset option."
50
- end
51
-
52
- convert_options = {
53
- :id => options.id,
54
- :date => options.date,
55
- :reply_to => options.reply_to,
56
- :dataset => options.dataset,
57
- }
58
- converter = Droonga::GroongaCommandConverter.new(convert_options)
59
-
60
- source_file = args[0]
61
- result_file = args[1]
62
-
63
- input = nil
64
- if source_file.nil?
65
- input = STDIN.read
66
- else
67
- input = File.read(source_file)
68
- end
69
-
70
- result_file = args[1]
71
-
72
- if result_file.nil?
73
- converter.convert(input) do |command|
74
- puts(JSON.generate(command))
75
- end
76
- else
77
- File.open("w", result_file) do |file|
78
- converter.convert(input) do |command|
79
- file.puts(JSON.generate(command))
80
- end
81
- end
82
- end
@@ -1,76 +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 "tsort"
19
-
20
- module Droonga
21
- class DistributionPlanner
22
- class UndefinedInputError < StandardError
23
- attr_reader :input
24
- def initialize(input)
25
- @input = input
26
- super("undefined input assigned: <#{input}>")
27
- end
28
- end
29
-
30
- class CyclicComponentsError < StandardError
31
- attr_reader :components
32
- def initialize(components)
33
- @components = components
34
- super("cyclic components found: <#{components}>")
35
- end
36
- end
37
-
38
- include TSort
39
-
40
- def initialize(dispatcher, components)
41
- @dispatcher = dispatcher
42
- @components = components
43
- end
44
-
45
- def plan
46
- @dependency = {}
47
- @components.each do |component|
48
- @dependency[component] = component["inputs"]
49
- next unless component["outputs"]
50
- component["outputs"].each do |output|
51
- @dependency[output] = [component]
52
- end
53
- end
54
- components = []
55
- each_strongly_connected_component do |cs|
56
- raise CyclicComponentsError.new(cs) if cs.size > 1
57
- components.concat(cs) unless cs.first.is_a? String
58
- end
59
- components
60
- end
61
-
62
- private
63
- def tsort_each_node(&block)
64
- @dependency.each_key(&block)
65
- end
66
-
67
- def tsort_each_child(node, &block)
68
- if node.is_a? String and @dependency[node].nil?
69
- raise UndefinedInputError.new(node)
70
- end
71
- if @dependency[node]
72
- @dependency[node].each(&block)
73
- end
74
- end
75
- end
76
- end
@@ -1,95 +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/plugin"
19
-
20
- module Droonga
21
- class DistributorPlugin < Plugin
22
- extend PluginRegisterable
23
-
24
- def initialize(distributor)
25
- super()
26
- @distributor = distributor
27
- end
28
-
29
- def distribute(message)
30
- @distributor.distribute(message)
31
- end
32
-
33
- def scatter_all(message, key)
34
- messages = [reducer(message), gatherer(message), scatterer(message, key)]
35
- distribute(messages)
36
- end
37
-
38
- def broadcast_all(message)
39
- messages = [reducer(message), gatherer(message), broadcaster(message)]
40
- distribute(messages)
41
- end
42
-
43
- private
44
- def process_error(command, error, arguments)
45
- if error.is_a?(MessageProcessingError)
46
- raise error
47
- else
48
- super
49
- end
50
- end
51
-
52
- def scatterer(message, key)
53
- {
54
- "command" => message["type"],
55
- "dataset" => message["dataset"],
56
- "body" => message["body"],
57
- "key" => key,
58
- "type" => "scatter",
59
- "outputs" => [],
60
- "replica" => "all",
61
- "post" => true
62
- }
63
- end
64
-
65
- def broadcaster(message)
66
- {
67
- "command" => message["type"],
68
- "dataset" => message["dataset"],
69
- "body" => message["body"],
70
- "type" => "broadcast",
71
- "outputs" => [],
72
- "replica" => "all",
73
- "post" => true
74
- }
75
- end
76
-
77
- def reducer(message)
78
- {
79
- "type" => "reduce",
80
- "body" => {},
81
- "inputs" => [],
82
- "outputs" => [],
83
- }
84
- end
85
-
86
- def gatherer(message)
87
- {
88
- "type" => "gather",
89
- "body" => {},
90
- "inputs" => [],
91
- "post" => true,
92
- }
93
- end
94
- end
95
- end