YUKI Hiroshi
null+****@clear*****
Thu Jan 16 19:17:54 JST 2014
YUKI Hiroshi 2014-01-16 19:17:54 +0900 (Thu, 16 Jan 2014) New Revision: 12267db66e6fd27391d4576bd50e9086e8be8a33 https://github.com/droonga/drnbench/commit/12267db66e6fd27391d4576bd50e9086e8be8a33 Message: Use configuration class for servers Added files: lib/drnbench/server/configuration.rb Modified files: README.md Renamed files: lib/drnbench/server/protocol-adapter.rb (from lib/drnbench/server/protocol_adapter.rb) Modified: README.md (+6 -4) =================================================================== --- README.md 2014-01-16 18:13:18 +0900 (c3c310f) +++ README.md 2014-01-16 19:17:54 +0900 (7e20b6e) @@ -251,15 +251,17 @@ Steps to run: 2. Create a patterns file for messages to be feeded: { - "type": "(message type)", - "body": (message body) + "type": "(message type)", + "dataset": "(dataset name)", + "body": (message body) } For example, a file "watch-feed.json" like: { - "type": "watch.feed", - "body": { + "type": "watch.feed", + "dataset": "Watch", + "body": { "targets": { "body": "a content including the keyword" } Added: lib/drnbench/server/configuration.rb (+43 -0) 100644 =================================================================== --- /dev/null +++ lib/drnbench/server/configuration.rb 2014-01-16 19:17:54 +0900 (3f01bb2) @@ -0,0 +1,43 @@ +module Drnbench + module Server + class EngineConfiguration + attr_accessor :host, :port, :tag, + attr_accessor :base_path, :engine_config_path + attr_accessor :fluentd, :fluentd_options + + def initialize + @port = 24224 + @host = "localhost" + @tag = "droonga" + @base_path = Pathname(Dir.pwd) + @fluentd = "fluentd" + @fluentd_options = [] + end + + def engine_config_path=(path) + @engine_config_path = path + engine_config_path + end + + def engine_config_path + Pathname(@engine_config_path).expand_path(@base_path) + end + end + + class ProtocolAdapterConfiguration + attr_accessor :application_dir, :port, :receive_port, :default_dataset + attr_accessor :node, :node_options + attr_accessor :engine_config + + def initialize + @application_dir = Pathname(Dir.pwd) + @port = 80 + @receive_port = 14224 + @default_dataset = "Droonga" + @node = "node" + @node_options = [] + @engine_config = nil + end + end + end +end Renamed: lib/drnbench/server/protocol-adapter.rb (+6 -6) 84% =================================================================== --- lib/drnbench/server/protocol_adapter.rb 2014-01-16 18:13:18 +0900 (16a98ef) +++ lib/drnbench/server/protocol-adapter.rb 2014-01-16 19:17:54 +0900 (34c546f) @@ -4,13 +4,13 @@ module Drnbench class ProtocolAdapter attr_reader :port - def initialize(params) - @engine = params[:engine] + def initialize(config) + @config = config - @host = params[:host] || "localhost" - @port = params[:port] || 3003 - @receive_port = params[:receive_port] || 14224 - @default_dataset = params[:default_dataset] || "Droonga" + @host =****@confi***** + @port =****@confi***** + @receive_port =****@confi*****_port + @default_dataset =****@confi*****_dataset @application_dir = Pathname(params[:application_dir]) @node = params[:node] -------------- next part -------------- HTML����������������������������...Descargar