Kouhei Sutou
null+****@clear*****
Fri Mar 21 16:13:06 JST 2014
Kouhei Sutou 2014-03-21 16:13:06 +0900 (Fri, 21 Mar 2014) New Revision: f17f76f9defd11040b5a3e1aeb394abe45447400 https://github.com/droonga/fluent-plugin-droonga/commit/f17f76f9defd11040b5a3e1aeb394abe45447400 Message: Add missing file... Copied files: lib/droonga/catalog/volume.rb (from lib/droonga/catalog/dataset.rb) Modified files: lib/droonga/catalog/dataset.rb Modified: lib/droonga/catalog/dataset.rb (+2 -7) =================================================================== --- lib/droonga/catalog/dataset.rb 2014-03-21 16:12:46 +0900 (2bd09fc) +++ lib/droonga/catalog/dataset.rb 2014-03-21 16:13:06 +0900 (9351990) @@ -14,8 +14,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA require "droonga/catalog/schema" -require "droonga/catalog/single_volume" -require "droonga/catalog/collection_volume" +require "droonga/catalog/volume" require "droonga/catalog/volume_collection" module Droonga @@ -60,11 +59,7 @@ module Droonga private def create_volumes(raw_volumes) raw_volumes.collect do |raw_volume| - if raw_volume.key?("address") - SingleVolume.new(raw_volume) - else - CollectionVolume.new(raw_volume) - end + Volume.create(raw_volume) end end end Copied: lib/droonga/catalog/volume.rb (+3 -42) 54% =================================================================== --- lib/droonga/catalog/dataset.rb 2014-03-21 16:12:46 +0900 (2bd09fc) +++ lib/droonga/catalog/volume.rb 2014-03-21 16:13:06 +0900 (25f7e5e) @@ -13,53 +13,14 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -require "droonga/catalog/schema" require "droonga/catalog/single_volume" require "droonga/catalog/collection_volume" -require "droonga/catalog/volume_collection" module Droonga module Catalog - class Dataset - def initialize(name, data) - @name = name - @data = data - @schema = nil - end - - # provided for compatibility - def [](key) - @data[key] - end - - # provided for compatibility - def []=(key, value) - @data[key] = value - end - - def schema - @schema ||= Schema.new(@name, @data["schema"]) - end - - def plugins - @data["plugins"] || [] - end - - def fact - @data["fact"] - end - - def n_workers - @data["nWorkers"] || 0 - end - - def replicas - @replicas ||= VolumeCollection.new(create_volumes(@data["replicas"])) - end - - private - def create_volumes(raw_volumes) - raw_volumes.collect do |raw_volume| + module Volume + class << self + def create(raw_volume) if raw_volume.key?("address") SingleVolume.new(raw_volume) else -------------- next part -------------- HTML����������������������������... Download