YUKI Hiroshi
null+****@clear*****
Thu Feb 6 16:49:28 JST 2014
YUKI Hiroshi 2014-02-06 16:49:28 +0900 (Thu, 06 Feb 2014) New Revision: a82ac6d38d5eb692e86c5d593b740d10d361add6 https://github.com/droonga/droonga.org/commit/a82ac6d38d5eb692e86c5d593b740d10d361add6 Message: Don't use "InputAdapter" and "OutputAdapter" in descriptions. Note: sample soucces must be updated. Modified files: tutorial/plugin-development/index.md Renamed files: tutorial/plugin-development/adapter/index.md (from tutorial/plugin-development/input-output/index.md) Renamed: tutorial/plugin-development/adapter/index.md (+13 -12) 95% =================================================================== --- tutorial/plugin-development/input-output/index.md 2014-02-06 16:36:17 +0900 (b37544f) +++ tutorial/plugin-development/adapter/index.md 2014-02-06 16:49:28 +0900 (fbde682) @@ -10,7 +10,7 @@ layout: en Learning steps to develop a Droonga plugin by yourself. -This page focus on InputAdapter first, then OutputAdapter. +This page focus on Adapter plugin. At the last, wraps up them to make a small practical adapter. ## Precondition @@ -18,11 +18,11 @@ At the last, wraps up them to make a small practical adapter. * You must complete [tutorial][]. -## InputAdapter +## Adapter for incoming messages We sometime need to modify requests incoming to Droonga Engine. -We can use InputAdapter for this purpose. -Let's see how to create InputAdapter in this section. +We can use Adapter for this purpose. +Let's see how to create Adapter in this section. ### Directory Structure @@ -188,7 +188,7 @@ And restart fluentd, then send the request same as the previous. You will see so This shows the message is received by our `ExampleInputAdapterPlugin` and then passed to Droonga. Here we can modify the message before the actual data processing. -### Modify messages with InputAdapter +### Modify messages with Adapter Suppose that we want to restrict the number of records returned in the response, say `1`. What we need to do is set `limit` to be `1` for every request. Update plugin like below: @@ -219,7 +219,7 @@ Note that `count` is still `2` because `limit` does not affect `count`. See [sea -## OutputAdapter +## Adapter for outgoing messages In case we need to modify the output, we can define `OutputAdapter`. In this section, we are going to create an `OutputAdapter`. @@ -292,7 +292,7 @@ RUBYLIB=./lib fluentd --config fluentd.conf This OutputAdapterPlugin does not make any differences so far. -### Log messages incoming to OutputAdapter +### Log outgoing messages by Adapter Let's get the plugin to work. Take logs of results of `search` command. @@ -327,7 +327,7 @@ The fluentd's log should be like as follows: This shows that the result of `search` is passed to `ExampleOutputAdapter` (and logged), then outputted. -### Modify results with OutputAdapter +### Modify results with Adapter Let's modify the result. For example, add `completedAt` attribute that shows the time completed the request. @@ -358,12 +358,13 @@ The results will be like this: Now you can see `completedAt` attribute containing the time completed the request. -## Combination of InputAdapter and OutputAdapter +## Adapter for both incoming and outgoing messages We have learned the basics of Adapter so far. Let's try to build more practical plugin. -You may feel the Droonga's `search` command is too flexible for your purpose. Here, we're going to add our own `storeSearch` command to wrap the `search` command in order to provide an application-specific and simple interface. +You may feel the Droonga's `search` command is too flexible for your purpose. +Here, we're going to add our own `storeSearch` command to wrap the `search` command in order to provide an application-specific and simple interface. ### Accept simple requests @@ -498,7 +499,7 @@ module Droonga end ~~~ -Activate OutputAdapter with catalog.json: +Activate Adapter for outgoing messages, with catalog.json: ~~~ (snip) @@ -537,7 +538,7 @@ In the way just described, we can use adapter to implement the application speci ## Conclusion -We have learned how to create InputAdapter and OutputAdapter, how to receive and modify messages in the adapters, both of InputAdapter and OutputAdapter. +We have learned how to create Adapter, how to receive and modify messages in the adapters, both of incoming and outgoing messages. [tutorial]: ../../ Modified: tutorial/plugin-development/index.md (+7 -10) =================================================================== --- tutorial/plugin-development/index.md 2014-02-06 16:36:17 +0900 (2073274) +++ tutorial/plugin-development/index.md 2014-02-06 16:49:28 +0900 (30d209e) @@ -27,14 +27,11 @@ You can use plugins in those situations. ## Types of plugins -Droonga has 5 types of plugins corresponding to the purpose of plugin. +Droonga has 4 types of plugins corresponding to the purpose of plugin. In other words, from the point of view of Droonga internal, the type of a plugin is distinguished by the component which the plugin is plugged in. See [overview][] to grasp the big picture. -InputAdapterPlugin -: used to modify requests. - -OutputAdapterPlugin -: used to modify responses. +AdapterPlugin +: used to modify incoming requests and outgoing responses. HandlerPlugin : used for low-level data handling. @@ -45,17 +42,17 @@ DistributorPlugin CollectorPlugin : used to control internal message collection. -In this tutorial, we focus on InputAdapterPlugin at first. This is the most "basic" plugin, so it will help you to understand the overview of Droonga plugin development. -Then, we focus on OutputAdapterPlugin, HandlerPlugin, DistributorPlugin and CollectorPlugin in this order. +In this tutorial, we focus on AdapterPlugin at first. This is the most "basic" plugin, so it will help you to understand the overview of Droonga plugin development. +Then, we focus on HandlerPlugin, DistributorPlugin and CollectorPlugin in this order. Following this tutorial, you will learn how to write these plugins. This will be the first step to create plugins fit with your own requirements. ## How to develop plugins? How to operate requests and responses? - 1. [Modify requests and responses][input-output] + 1. [Modify requests and responses][adapter] 2. Process requests (under construction) 3. [Distribute requests and collect responses][distribute-collect] [tutorial]: ../ [overview]: ../../overview/ - [input-output]: ./input-output/ + [adapter]: ./adapter/ [distribute-collect]: ./distribute-collect/ -------------- next part -------------- HTML����������������������������...Download