YUKI Hiroshi
null+****@clear*****
Mon Feb 3 13:35:00 JST 2014
YUKI Hiroshi 2014-02-03 13:35:00 +0900 (Mon, 03 Feb 2014) New Revision: d0ea2b7f8fc8539b5d905506598c9fd727c258dc https://github.com/droonga/droonga.org/commit/d0ea2b7f8fc8539b5d905506598c9fd727c258dc Message: Describe only about basics in the index page Modified files: tutorial/plugin-development/index.md Modified: tutorial/plugin-development/index.md (+12 -70) =================================================================== --- tutorial/plugin-development/index.md 2014-02-03 13:06:47 +0900 (25ea277) +++ tutorial/plugin-development/index.md 2014-02-03 13:35:00 +0900 (826cc3e) @@ -3,27 +3,25 @@ title: Droonga plugin development tutorial layout: en --- -!!WORK IN PROGRESS!! - * TOC {:toc} ## The goal of this tutorial Learning steps to develop a Droonga plugin by yourself. +You must complete [tutorial][]. before this tutorial. -## Precondition - -* You must complete [tutorial][]. -## Plugin +## What's "plugin"? Plugin is one of the most important concept of Droonga. This makes droonga flexible. Generally, data processing tasks in real word need custom treatments of the data, in various stages of the data stream. This is not easy to done in one-size-fits-all approach. -One may want to modify input queries to work well with other systems, one may want to modify output to help other systems understand the result. One may want to do more complex data processing than that provided by Droonga as built-in, to have direct storage access for efficiency. One may need to control data distribution logic and collection logic of Droonga to profit from distributed nature of Droonga. +One may want to modify input queries to work well with other systems, one may want to modify output to help other systems understand the result. +One may want to do more complex data processing than that provided by Droonga as built-in, to have direct storage access for efficiency. +One may need to control data distribution logic and collection logic of Droonga to profit from distributed nature of Droonga. You can use plugins in those situations. @@ -47,71 +45,15 @@ DistributorPlugin CollectorPlugin : used to control internal message collection. -In this tutorial, we focus on InputAdapterPlugin. This is the most "basic" plugin, so it will help you to understand the overview of Droonga plugin development. - - -## Directory Structure - -Assume that we are going to add `InputAdapterPlugin` to the system built in [tutorial][]. In that tutorial, Groonga engine was placed under `engine` directory. - -Plugins need to be placed in an appropriate directory. For example, `InputAdapterPlugin` should be placed under `lib/droonga/plugin/input_adapter/` directory. Let's create the directory: - - # cd engine - # mkdir -p lib/droonga/plugin/input_adapter - -After creating the directory, the directory structure should be like this: - -``` -engine -├── catalog.json -├── fluentd.conf -└── lib - └── droonga - └── plugin - └── input_adapter -``` - - -## Create a plugin - -Put a plugin code into `input_adapter` directory. - -lib/droonga/plugin/input_adapter/example.rb: - -```ruby -module Droonga - class ExampleInputAdapterPlugin < Droonga::InputAdapterPlugin - repository.register("example", self) - end -end -``` - -This plugin does nothing except registering itself to Droonga. - -## Activate plugin with `catalog.json` - -You need to update `catalog.json` to activate your plugin. -Insert following at the last part of `catalog.json` in order to make `"input_adapter"` become a key of the top level hash: - -catalog.json: -``` -(snip) - }, - "input_adapter": { - "plugins": ["example"] - } -} -``` - -## Run - -Let's Droonga get started. Note that you need to specify `./lib` directory in `RUBYLIB` environment variable in order to make ruby possible to find your plugin. - -``` -RUBYLIB=./lib fluentd --config fluentd.conf -``` +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. +Following this tutorial, you will learn how to write these plugins. This will be the first step to create plugins to achieve your own requirements. +## How to develop plugins? How to operate requests and responses? + 1. [Modify requests and responses][./input-output/] + 2. Process requests (under construction) + 3. [Distribute requests and collect responses][./distribute-collect/] [tutorial]: ../ [overview]: ../../overview/ -------------- next part -------------- HTML����������������������������...Download