[Groonga-commit] droonga/fluent-plugin-droonga at 47c2fe6 [master] Use Slice

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Mar 21 16:15:03 JST 2014


Kouhei Sutou	2014-03-21 16:15:03 +0900 (Fri, 21 Mar 2014)

  New Revision: 47c2fe6d19ba859a31d3d0f4119d96bbc57d8f57
  https://github.com/droonga/fluent-plugin-droonga/commit/47c2fe6d19ba859a31d3d0f4119d96bbc57d8f57

  Message:
    Use Slice

  Modified files:
    lib/droonga/catalog/collection_volume.rb
    lib/droonga/catalog/version2.rb

  Modified: lib/droonga/catalog/collection_volume.rb (+5 -1)
===================================================================
--- lib/droonga/catalog/collection_volume.rb    2014-03-21 16:13:06 +0900 (6f0718d)
+++ lib/droonga/catalog/collection_volume.rb    2014-03-21 16:15:03 +0900 (8b9964b)
@@ -13,6 +13,8 @@
 # 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/slice"
+
 module Droonga
   module Catalog
     class CollectionVolume
@@ -29,7 +31,9 @@ module Droonga
       end
 
       def slices
-        @data["slices"]
+        @slices ||= @data["slices"].collect do |raw_slice|
+          Slice.new(raw_slice)
+        end
       end
 
       # Just for backward compatibility

  Modified: lib/droonga/catalog/version2.rb (+2 -2)
===================================================================
--- lib/droonga/catalog/version2.rb    2014-03-21 16:13:06 +0900 (89159a3)
+++ lib/droonga/catalog/version2.rb    2014-03-21 16:15:03 +0900 (2f6c58f)
@@ -39,7 +39,7 @@ module Droonga
           plugins = dataset.plugins
           dataset.replicas.each do |volume|
             volume.slices.each do |slice|
-              volume_address = slice["volume"]["address"]
+              volume_address = slice.volume.address
               if pattern =~ volume_address
                 path = File.join([device, $POSTMATCH, "db"])
                 path = File.expand_path(path, base_path)
@@ -125,7 +125,7 @@ module Droonga
 
       def select_slices(volume, range=0..-1)
         sorted_slices = volume.slices.sort_by do |slice|
-          slice["label"]
+          slice.label
         end
         sorted_slices[range]
       end
-------------- next part --------------
HTML����������������������������...
Download 



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