[Groonga-commit] droonga/droonga.org at e2d564d [gh-pages] Update Japanese version pages of plugin API references

Back to archive index

YUKI Hiroshi null+****@clear*****
Thu Mar 6 16:40:01 JST 2014


YUKI Hiroshi	2014-03-06 16:40:01 +0900 (Thu, 06 Mar 2014)

  New Revision: e2d564d01433ba5f97c1dc938424d27d68f3e860
  https://github.com/droonga/droonga.org/commit/e2d564d01433ba5f97c1dc938424d27d68f3e860

  Message:
    Update Japanese version pages of plugin API references

  Added files:
    _po/ja/reference/plugin/collector/index.po
    ja/reference/plugin/collector/index.md
  Modified files:
    _po/ja/reference/plugin/handler/index.po
    _po/ja/reference/plugin/index.po
    ja/reference/plugin/handler/index.md
    ja/reference/plugin/index.md

  Added: _po/ja/reference/plugin/collector/index.po (+88 -0) 100644
===================================================================
--- /dev/null
+++ _po/ja/reference/plugin/collector/index.po    2014-03-06 16:40:01 +0900 (e2c431f)
@@ -0,0 +1,88 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Language: ja\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+
+msgid ""
+"---\n"
+"title: Collector\n"
+"layout: en\n"
+"---"
+msgstr ""
+"---\n"
+"title: Collector\n"
+"layout: ja\n"
+"---"
+
+msgid ""
+"* TOC\n"
+"{:toc}"
+msgstr ""
+
+msgid "## Abstract {#abstract}"
+msgstr "## 概要 {#abstract}"
+
+msgid ""
+"A collector merges two input values to single value.\n"
+"The Droonga Engine tries to collect three or more values by applying the speci"
+"fied collector for two of them again and again."
+msgstr ""
+
+msgid "## Built-in collector classes {#builtin-collectors}"
+msgstr ""
+
+msgid ""
+"There are some pre-defined collector classes used by built-in plugins.\n"
+"Of course they are available for your custom plugins."
+msgstr ""
+
+msgid "### `Droonga::Collectors::And`"
+msgstr ""
+
+msgid ""
+"Returns a result from comparison of two values by the `and` logical operator.\n"
+"If both values are logically equal to `true`, then one of them (it is indeterm"
+"inate) becomes the result."
+msgstr ""
+
+msgid ""
+"Values `null` (`nil`) and `false` are treated as `false`.\n"
+"Otherwise `true`."
+msgstr ""
+
+msgid "### `Droonga::Collectors::Or`"
+msgstr ""
+
+msgid ""
+"Returns a result from comparison of two values by the `or` logical operator.\n"
+"If only one of them is logically equal to `true`, then the value becomes the r"
+"esult.\n"
+"Otherwise, if values are logically same, one of them (it is indeterminate) bec"
+"omes the result."
+msgstr ""
+
+msgid "### `Droonga::Collectors::Sum`"
+msgstr ""
+
+msgid "Returns a summarized value of two input values."
+msgstr ""
+
+msgid "This collector works a little complicatedly."
+msgstr ""
+
+msgid ""
+" * If one of values is equal to `null` (`nil`), then the other value becomes t"
+"he result.\n"
+" * If both values are hash, then a merged hash becomes the result.\n"
+"   * The result hash has all keys of two hashes.\n"
+"     If both have same keys, then one of their values appears as the value of "
+"the key in the reuslt hash.\n"
+"   * It is indeterminate which value becomes the base.\n"
+" * Otherwise the result of `a + b` becomes the result.\n"
+"   * If they are arrays or strings, a concatenated value becomes the result.\n"
+"     It is indeterminate which value becomes the lefthand."
+msgstr ""

  Modified: _po/ja/reference/plugin/handler/index.po (+203 -11)
===================================================================
--- _po/ja/reference/plugin/handler/index.po    2014-03-06 16:25:52 +0900 (40f0695)
+++ _po/ja/reference/plugin/handler/index.po    2014-03-06 16:40:01 +0900 (cc86bf8)
@@ -1,7 +1,6 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"PO-Revision-Date: 2014-03-05 12:52+0900\n"
 "Language: ja\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -14,6 +13,10 @@ msgid ""
 "layout: en\n"
 "---"
 msgstr ""
+"---\n"
+"title: Handling PhaseでのプラグインAPI\n"
+"layout: ja\n"
+"---"
 
 msgid ""
 "* TOC\n"
@@ -70,7 +73,8 @@ msgid ""
 " 1. Define a module for your plugin (ex. `Droonga::Plugins::FooPlugin`) and re"
 "gister it as a plugin. (required)\n"
 " 2. Define a \"single step\" corresponding to the handler you are going to imple"
-"ment. (required)\n"
+"ment, via [`Droonga::SingleStepDefinition`](#class-Droonga-SingleStepDefinitio"
+"n). (required)\n"
 " 2. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheri"
 "ting [`Droonga::Handler`](#classes-Droonga-Handler). (required)\n"
 " 4. Define handling logic for requests as [`#handle`](#classes-Droonga-Handler"
@@ -122,22 +126,128 @@ msgid ""
 msgstr ""
 
 msgid "## Configurations {#config}"
-msgstr ""
+msgstr "## 設定 {#config}"
 
 msgid ""
-"`action.synchronous` (boolean, optional, default=false)\n"
-": (TBD)"
+"`action.synchronous` (boolean, optional, default=`false`)\n"
+": Indicates that the request must be processed synchronously.\n"
+"  For example, a request to define a new column in a table must be processed a"
+"fter a request to define the table itself, if the table does not exist yet.\n"
+"  Then handlers for these requests have the configuration `action.synchronous "
+"= true`."
 msgstr ""
 
 msgid "## Classes and methods {#classes}"
 msgstr ""
 
+msgid "### `Droonga::SingleStepDefinition` {#classes-Droonga-SingleStepDefinition}"
+msgstr ""
+
+msgid "This provides methods to describe the \"step\" corresponding to the handler."
+msgstr ""
+
+msgid "#### `#name=(name)` {#classes-Droonga-SingleStepDefinition-name}"
+msgstr ""
+
+msgid ""
+"Describes the name of the step itself.\n"
+"Possible value is a string."
+msgstr ""
+
+msgid ""
+"The Droonga Engine treats an incoming message as a request of a \"command\", if "
+"there is any step with the `name` which equals to the message's `type`.\n"
+"In other words, this defines the name of the command corresponding to the step"
+" itself."
+msgstr ""
+
+msgid "#### `#handler=(handler)` {#classes-Droonga-SingleStepDefinition-handler}"
+msgstr ""
+
+msgid ""
+"Associates a specific handler class to the step itself.\n"
+"You can specify the class as any one of following choices:"
+msgstr ""
+
+msgid ""
+" * A reference to a handler class itself, like `Handler` or `Droonga::Plugins:"
+":FooPlugin::Handler`.\n"
+"   Of course, the class have to be already defined at the time.\n"
+" * A symbol which refers the name of a handler class in the current namespace,"
+" like `:Handler`.\n"
+"   This is useful if you want to describe the step at first and define the act"
+"ual class after that.\n"
+"   You must define the referenced class by the time the Droonga Engine actuall"
+"y processes the step.\n"
+" * A class path string of a handler class, like `\"Droonga::Plugins::FooPlugin:"
+":Handler\"`.\n"
+"   This is also useful to define the class itself after the description.\n"
+"   You must define the class by the time it is actually used."
+msgstr ""
+
+msgid ""
+"#### `#collector=(collector)` {#classes-Droonga-SingleStepDefinition-collector"
+"}"
+msgstr ""
+
+msgid ""
+"Associates a specific collector class to the step itself.\n"
+"You can specify the class as any one of following choices:"
+msgstr ""
+
+msgid ""
+" * A reference to a collector class itself, like `Collectors::Something` or `D"
+"roonga::Plugins::FooPlugin::MyCollector`.\n"
+"   Of course, the class have to be already defined at the time.\n"
+" * A symbol which refers the name of a collector class in the current namespac"
+"e, like `:MyCollector`.\n"
+"   This is useful if you want to describe the step at first and define the act"
+"ual class after that.\n"
+"   You must define the referenced class by the time the Droonga Engine actuall"
+"y collects results.\n"
+" * A class path string of a collector class, like `\"Droonga::Plugins::FooPlugi"
+"n::MyCollector\"`.\n"
+"   This is also useful to define the class itself after the description.\n"
+"   You must define the class by the time it is actually used."
+msgstr ""
+
+msgid "See also [descriptions of collectors][collector]."
+msgstr ""
+
+msgid "#### `#write=(write)` {#classes-Droonga-SingleStepDefinition-write}"
+msgstr ""
+
+msgid ""
+"Describes whether the step modifies any data in the storage or don't.\n"
+"If a request aims to modify some data in the storage, the request must be proc"
+"essed for all replicas.\n"
+"Otherwise the Droonga Engine can optimize handling of the step.\n"
+"For example, caching of results, reducing of CPU/memory usage, and so on."
+msgstr ""
+
+msgid "Possible values are:"
+msgstr ""
+
+msgid ""
+" * `true`, means \"this step can modify the storage.\"\n"
+" * `false`, means \"this step never modifies the storage.\""
+msgstr ""
+
+msgid "#### `#inputs=(inputs)` {#classes-Droonga-SingleStepDefinition-inputs}"
+msgstr ""
+
+msgid "(TBD)"
+msgstr ""
+
+msgid "#### `#output=(output)` {#classes-Droonga-SingleStepDefinition-output}"
+msgstr ""
+
 msgid "### `Droonga::Handler` {#classes-Droonga-Handler}"
 msgstr ""
 
 msgid ""
-"This is the common base class of any handler. Your plugin's handler class must"
-" inherit this."
+"This is the common base class of any handler.\n"
+"Your plugin's handler class must inherit this."
 msgstr ""
 
 msgid "#### `#handle(message)` {#classes-Droonga-Handler-handle}"
@@ -145,20 +255,102 @@ msgstr ""
 
 msgid ""
 "This method receives a [`Droonga::HandlerMessage`](#classes-Droonga-HandlerMes"
-"sage) wrapped task message."
+"sage) wrapped task message.\n"
+"You can read the request information via its methods."
 msgstr ""
 
-msgid "(TBD)"
+msgid ""
+"In this base class, this method is defined as just a placeholder and it does n"
+"othing.\n"
+"To process messages, you have to override it by yours, like following:"
+msgstr ""
+
+msgid ""
+"~~~ruby\n"
+"module Droonga::Plugins::MySearch\n"
+"  class Handler < Droonga::Handler\n"
+"    def handle(message)\n"
+"      search_query = message.request[\"body\"][\"query\"]\n"
+"      ...\n"
+"      { ... } # the result\n"
+"    end\n"
+"  end\n"
+"end\n"
+"~~~"
+msgstr ""
+
+msgid ""
+"The Droonga Engine uses the returned value of this method as the result of the"
+" handling.\n"
+"It will be used to build the body of the unified response, and delivered to th"
+"e Protocol Adapter."
 msgstr ""
 
 msgid "### `Droonga::HandlerMessage` {#classes-Droonga-HandlerMessage}"
 msgstr ""
 
+msgid "This is a wrapper for a task message."
+msgstr ""
+
+msgid ""
+"The Droonga Engine analyzes a transferred request message, and build multiple "
+"task massages to process the request.\n"
+"A task massage has some information: a request, a step, descendant tasks, and "
+"so on."
+msgstr ""
+
 msgid "#### `#request` {#classes-Droonga-HandlerMessage-request}"
 msgstr ""
 
-msgid "Returns the request message."
+msgid ""
+"This returns the request message.\n"
+"You can read request body via this method. For example:"
+msgstr ""
+
+msgid ""
+"~~~ruby\n"
+"module Droonga::Plugins::MySearch\n"
+"  class Handler < Droonga::Handler\n"
+"    def handle(message)\n"
+"      request = message.request\n"
+"      search_query = request[\"body\"][\"query\"]\n"
+"      ...\n"
+"    end\n"
+"  end\n"
+"end\n"
+"~~~"
+msgstr ""
+
+msgid "#### `@context` {#classes-Droonga-HandlerMessage-context}"
+msgstr ""
+
+msgid ""
+"This is a reference to the `Groonga::Context` instance for the storage of the "
+"partition.\n"
+"See the [class reference of Rroonga][Groonga::Context]."
 msgstr ""
 
-msgid "  [error handling]: ../error/"
+msgid ""
+"You can use any feature of Rroonga via `@context`.\n"
+"For example, this code returns the number of records in the specified table:"
+msgstr ""
+
+msgid ""
+"~~~ruby\n"
+"module Droonga::Plugins::CountRecords\n"
+"  class Handler < Droonga::Handler\n"
+"    def handle(message)\n"
+"      request = message.request\n"
+"      table_name = request[\"body\"][\"table\"]\n"
+"      count = @context[table_name].size\n"
+"    end\n"
+"  end\n"
+"end\n"
+"~~~"
+msgstr ""
+
+msgid ""
+"  [error handling]: ../error/\n"
+"  [collector]: ../collector/\n"
+"  [Groonga::Context]: http://ranguba.org/rroonga/en/Groonga/Context.html"
 msgstr ""

  Modified: _po/ja/reference/plugin/index.po (+2 -1)
===================================================================
--- _po/ja/reference/plugin/index.po    2014-03-06 16:25:52 +0900 (e357d13)
+++ _po/ja/reference/plugin/index.po    2014-03-06 16:40:01 +0900 (aab40f7)
@@ -1,7 +1,6 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"PO-Revision-Date: 2014-03-05 12:52+0900\n"
 "Language: ja\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -31,9 +30,11 @@ msgid ""
 " * [API set for the adaption phase](adapter/)\n"
 " * [API set for the handling phase](handler/)\n"
 " * [Matching pattern for messages](matching-pattern/)\n"
+" * [Collector](collector/)\n"
 " * [Error handling](error/)"
 msgstr ""
 " * [Adaption PhaseでのAPI](adapter/)\n"
 " * [Handling PhaseでのAPI](handler/)\n"
 " * [メッセージのためのマッチングパターン](matching-pattern/)\n"
+" * [Collector](collector/)\n"
 " * [エラー処理](error/)"

  Added: ja/reference/plugin/collector/index.md (+60 -0) 100644
===================================================================
--- /dev/null
+++ ja/reference/plugin/collector/index.md    2014-03-06 16:40:01 +0900 (5240de5)
@@ -0,0 +1,60 @@
+---
+title: Collector
+layout: ja
+---
+
+{% comment %}
+##############################################
+  THIS FILE IS AUTOMATICALLY GENERATED FROM
+  "_po/ja/reference/plugin/collector/index.po"
+  DO NOT EDIT THIS FILE MANUALLY!
+##############################################
+{% endcomment %}
+
+
+* TOC
+{:toc}
+
+
+## 概要 {#abstract}
+
+A collector merges two input values to single value.
+The Droonga Engine tries to collect three or more values by applying the specified collector for two of them again and again.
+
+## Built-in collector classes {#builtin-collectors}
+
+There are some pre-defined collector classes used by built-in plugins.
+Of course they are available for your custom plugins.
+
+### `Droonga::Collectors::And`
+
+Returns a result from comparison of two values by the `and` logical operator.
+If both values are logically equal to `true`, then one of them (it is indeterminate) becomes the result.
+
+Values `null` (`nil`) and `false` are treated as `false`.
+Otherwise `true`.
+
+### `Droonga::Collectors::Or`
+
+Returns a result from comparison of two values by the `or` logical operator.
+If only one of them is logically equal to `true`, then the value becomes the result.
+Otherwise, if values are logically same, one of them (it is indeterminate) becomes the result.
+
+Values `null` (`nil`) and `false` are treated as `false`.
+Otherwise `true`.
+
+### `Droonga::Collectors::Sum`
+
+Returns a summarized value of two input values.
+
+This collector works a little complicatedly.
+
+ * If one of values is equal to `null` (`nil`), then the other value becomes the result.
+ * If both values are hash, then a merged hash becomes the result.
+   * The result hash has all keys of two hashes.
+     If both have same keys, then one of their values appears as the value of the key in the reuslt hash.
+   * It is indeterminate which value becomes the base.
+ * Otherwise the result of `a + b` becomes the result.
+   * If they are arrays or strings, a concatenated value becomes the result.
+     It is indeterminate which value becomes the lefthand.
+

  Modified: ja/reference/plugin/handler/index.md (+131 -9)
===================================================================
--- ja/reference/plugin/handler/index.md    2014-03-06 16:25:52 +0900 (8747a51)
+++ ja/reference/plugin/handler/index.md    2014-03-06 16:40:01 +0900 (4bf41a7)
@@ -1,6 +1,6 @@
 ---
-title: API set for plugins on the handling phase
-layout: en
+title: Handling PhaseでのプラグインAPI
+layout: ja
 ---
 
 {% comment %}
@@ -50,7 +50,7 @@ end
 Steps to define a handler:
 
  1. Define a module for your plugin (ex. `Droonga::Plugins::FooPlugin`) and register it as a plugin. (required)
- 2. Define a "single step" corresponding to the handler you are going to implement. (required)
+ 2. Define a "single step" corresponding to the handler you are going to implement, via [`Droonga::SingleStepDefinition`](#class-Droonga-SingleStepDefinition). (required)
  2. Define a handler class (ex. `Droonga::Plugins::FooPlugin::Handler`) inheriting [`Droonga::Handler`](#classes-Droonga-Handler). (required)
  4. Define handling logic for requests as [`#handle`](#classes-Droonga-Handler-handle). (optional)
 
@@ -85,28 +85,150 @@ Any error raised from the handler is handled by the Droonga Engine itself. See a
 
 ## 設定 {#config}
 
-`action.synchronous` (boolean, optional, default=false)
-: (TBD)
+`action.synchronous` (boolean, optional, default=`false`)
+: Indicates that the request must be processed synchronously.
+  For example, a request to define a new column in a table must be processed after a request to define the table itself, if the table does not exist yet.
+  Then handlers for these requests have the configuration `action.synchronous = true`.
 
 
 ## Classes and methods {#classes}
 
+### `Droonga::SingleStepDefinition` {#classes-Droonga-SingleStepDefinition}
+
+This provides methods to describe the "step" corresponding to the handler.
+
+#### `#name=(name)` {#classes-Droonga-SingleStepDefinition-name}
+
+Describes the name of the step itself.
+Possible value is a string.
+
+The Droonga Engine treats an incoming message as a request of a "command", if there is any step with the `name` which equals to the message's `type`.
+In other words, this defines the name of the command corresponding to the step itself.
+
+
+#### `#handler=(handler)` {#classes-Droonga-SingleStepDefinition-handler}
+
+Associates a specific handler class to the step itself.
+You can specify the class as any one of following choices:
+
+ * A reference to a handler class itself, like `Handler` or `Droonga::Plugins::FooPlugin::Handler`.
+   Of course, the class have to be already defined at the time.
+ * A symbol which refers the name of a handler class in the current namespace, like `:Handler`.
+   This is useful if you want to describe the step at first and define the actual class after that.
+   You must define the referenced class by the time the Droonga Engine actually processes the step.
+ * A class path string of a handler class, like `"Droonga::Plugins::FooPlugin::Handler"`.
+   This is also useful to define the class itself after the description.
+   You must define the class by the time it is actually used.
+
+#### `#collector=(collector)` {#classes-Droonga-SingleStepDefinition-collector}
+
+Associates a specific collector class to the step itself.
+You can specify the class as any one of following choices:
+
+ * A reference to a collector class itself, like `Collectors::Something` or `Droonga::Plugins::FooPlugin::MyCollector`.
+   Of course, the class have to be already defined at the time.
+ * A symbol which refers the name of a collector class in the current namespace, like `:MyCollector`.
+   This is useful if you want to describe the step at first and define the actual class after that.
+   You must define the referenced class by the time the Droonga Engine actually collects results.
+ * A class path string of a collector class, like `"Droonga::Plugins::FooPlugin::MyCollector"`.
+   This is also useful to define the class itself after the description.
+   You must define the class by the time it is actually used.
+
+See also [descriptions of collectors][collector].
+
+#### `#write=(write)` {#classes-Droonga-SingleStepDefinition-write}
+
+Describes whether the step modifies any data in the storage or don't.
+If a request aims to modify some data in the storage, the request must be processed for all replicas.
+Otherwise the Droonga Engine can optimize handling of the step.
+For example, caching of results, reducing of CPU/memory usage, and so on.
+
+Possible values are:
+
+ * `true`, means "this step can modify the storage."
+ * `false`, means "this step never modifies the storage."
+
+#### `#inputs=(inputs)` {#classes-Droonga-SingleStepDefinition-inputs}
+
+(TBD)
+
+#### `#output=(output)` {#classes-Droonga-SingleStepDefinition-output}
+
+(TBD)
+
 ### `Droonga::Handler` {#classes-Droonga-Handler}
 
-This is the common base class of any handler. Your plugin's handler class must inherit this.
+This is the common base class of any handler.
+Your plugin's handler class must inherit this.
 
 #### `#handle(message)` {#classes-Droonga-Handler-handle}
 
 This method receives a [`Droonga::HandlerMessage`](#classes-Droonga-HandlerMessage) wrapped task message.
+You can read the request information via its methods.
+
+In this base class, this method is defined as just a placeholder and it does nothing.
+To process messages, you have to override it by yours, like following:
+
+~~~ruby
+module Droonga::Plugins::MySearch
+  class Handler < Droonga::Handler
+    def handle(message)
+      search_query = message.request["body"]["query"]
+      ...
+      { ... } # the result
+    end
+  end
+end
+~~~
+
+The Droonga Engine uses the returned value of this method as the result of the handling.
+It will be used to build the body of the unified response, and delivered to the Protocol Adapter.
 
-(TBD)
 
 ### `Droonga::HandlerMessage` {#classes-Droonga-HandlerMessage}
 
+This is a wrapper for a task message.
+
+The Droonga Engine analyzes a transferred request message, and build multiple task massages to process the request.
+A task massage has some information: a request, a step, descendant tasks, and so on.
+
 #### `#request` {#classes-Droonga-HandlerMessage-request}
 
-Returns the request message.
+This returns the request message.
+You can read request body via this method. For example:
 
-(TBD)
+~~~ruby
+module Droonga::Plugins::MySearch
+  class Handler < Droonga::Handler
+    def handle(message)
+      request = message.request
+      search_query = request["body"]["query"]
+      ...
+    end
+  end
+end
+~~~
+
+#### `@context` {#classes-Droonga-HandlerMessage-context}
+
+This is a reference to the `Groonga::Context` instance for the storage of the partition.
+See the [class reference of Rroonga][Groonga::Context].
+
+You can use any feature of Rroonga via `@context`.
+For example, this code returns the number of records in the specified table:
+
+~~~ruby
+module Droonga::Plugins::CountRecords
+  class Handler < Droonga::Handler
+    def handle(message)
+      request = message.request
+      table_name = request["body"]["table"]
+      count = @context[table_name].size
+    end
+  end
+end
+~~~
 
   [error handling]: ../error/
+  [collector]: ../collector/
+  [Groonga::Context]: http://ranguba.org/rroonga/en/Groonga/Context.html

  Modified: ja/reference/plugin/index.md (+1 -0)
===================================================================
--- ja/reference/plugin/index.md    2014-03-06 16:25:52 +0900 (2292c48)
+++ ja/reference/plugin/index.md    2014-03-06 16:40:01 +0900 (d90efee)
@@ -17,4 +17,5 @@ Droonga Engineはプラグインに対して、処理の各段階ごとに異な
  * [Adaption PhaseでのAPI](adapter/)
  * [Handling PhaseでのAPI](handler/)
  * [メッセージのためのマッチングパターン](matching-pattern/)
+ * [Collector](collector/)
  * [エラー処理](error/)
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index