about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-11-23 12:09:56 -0800
committerEric Wong <normalperson@yhbt.net>2010-11-23 12:09:56 -0800
commitdf91c57c312bee97a16bced1035bd704e518ac38 (patch)
tree0678c58830c09e9a8e0de92a33fa078f2445ee4e
parent51d43461adca99482154ddbd337658a70d5ffc3d (diff)
downloadmetropolis-df91c57c312bee97a16bced1035bd704e518ac38.tar.gz
rename internal "TokyoCabinet" => "TC"
It's less typing and less likely to clash on both
the eyes and the interpreter.
-rw-r--r--lib/metropolis.rb4
-rw-r--r--lib/metropolis/tc.rb6
-rw-r--r--lib/metropolis/tc/hdb.rb (renamed from lib/metropolis/tokyocabinet/hdb.rb)6
-rw-r--r--lib/metropolis/tc/hdb/ro.rb (renamed from lib/metropolis/tokyocabinet/hdb/ro.rb)4
-rw-r--r--lib/metropolis/tokyocabinet.rb6
-rw-r--r--test/test_tc_hdb.rb (renamed from test/test_tokyocabinet_hdb.rb)8
6 files changed, 17 insertions, 17 deletions
diff --git a/lib/metropolis.rb b/lib/metropolis.rb
index 987040d..05dc071 100644
--- a/lib/metropolis.rb
+++ b/lib/metropolis.rb
@@ -3,7 +3,7 @@ require 'rack'
 require 'uri'
 
 module Metropolis
-  autoload :TokyoCabinet, 'metropolis/tokyocabinet'
+  autoload :TC, 'metropolis/tc'
 
   def self.new(opts = {})
     opts = opts.dup
@@ -15,7 +15,7 @@ module Metropolis
       opts[:query] = Rack::Utils.parse_query(uri.query) if uri.query
       case ext = File.extname(uri.path)
       when '.tch'
-        rv.extend Metropolis::TokyoCabinet::HDB
+        rv.extend Metropolis::TC::HDB
       else
         raise ArgumentError, "unsupported suffix: #{ext}"
       end
diff --git a/lib/metropolis/tc.rb b/lib/metropolis/tc.rb
new file mode 100644
index 0000000..84dfaff
--- /dev/null
+++ b/lib/metropolis/tc.rb
@@ -0,0 +1,6 @@
+# -*- encoding: binary -*-
+require 'tokyocabinet'
+
+module Metropolis::TC
+  autoload :HDB, 'metropolis/tc/hdb'
+end
diff --git a/lib/metropolis/tokyocabinet/hdb.rb b/lib/metropolis/tc/hdb.rb
index 513d215..ec387b4 100644
--- a/lib/metropolis/tokyocabinet/hdb.rb
+++ b/lib/metropolis/tc/hdb.rb
@@ -2,10 +2,10 @@
 
 # this module is NOT thread-safe, all performance is dependent on the
 # local machine so there is never anything that needs yielding to threads.
-module Metropolis::TokyoCabinet::HDB
-  autoload :RO, 'metropolis/tokyocabinet/hdb/ro'
+module Metropolis::TC::HDB
+  autoload :RO, 'metropolis/tc/hdb/ro'
 
-  TCHDB = ::TokyoCabinet::HDB # :nodoc
+  TCHDB = TokyoCabinet::HDB # :nodoc
   include Rack::Utils # unescape
 
   def r(code)
diff --git a/lib/metropolis/tokyocabinet/hdb/ro.rb b/lib/metropolis/tc/hdb/ro.rb
index 89b4dd6..f348ee4 100644
--- a/lib/metropolis/tokyocabinet/hdb/ro.rb
+++ b/lib/metropolis/tc/hdb/ro.rb
@@ -1,10 +1,10 @@
 # -*- encoding: binary -*-
 
-module Metropolis::TokyoCabinet::HDB::RO
+module Metropolis::TC::HDB::RO
   def self.extended(obj)
    obj.instance_eval do
       @wr_flags = nil
-      @rd_flags |= ::TokyoCabinet::HDB::ONOLCK
+      @rd_flags |= TokyoCabinet::HDB::ONOLCK
       @dbv.each { |(hdb, path)|
         hdb.open(path, @rd_flags) or ex!(:open, path)
       }
diff --git a/lib/metropolis/tokyocabinet.rb b/lib/metropolis/tokyocabinet.rb
deleted file mode 100644
index 86b8104..0000000
--- a/lib/metropolis/tokyocabinet.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- encoding: binary -*-
-require 'tokyocabinet'
-
-module Metropolis::TokyoCabinet
-  autoload :HDB, 'metropolis/tokyocabinet/hdb'
-end
diff --git a/test/test_tokyocabinet_hdb.rb b/test/test_tc_hdb.rb
index 1deea1c..21d89be 100644
--- a/test/test_tokyocabinet_hdb.rb
+++ b/test/test_tc_hdb.rb
@@ -6,7 +6,7 @@ require 'tokyocabinet' # FIXME: emits warning with 1.29 gem
 $-w = true
 require 'metropolis'
 
-class TestTokyocabinetHDB < Test::Unit::TestCase
+class Test_TC_HDB < Test::Unit::TestCase
   attr_reader :tmp, :o, :uri
 
   def setup
@@ -22,7 +22,7 @@ class TestTokyocabinetHDB < Test::Unit::TestCase
 
   def osetup
     o = Object.new
-    o.extend Metropolis::TokyoCabinet::HDB
+    o.extend Metropolis::TC::HDB
     assert_nothing_raised do
       o.setup :path_pattern => @path_pattern
     end
@@ -136,7 +136,7 @@ class TestTokyocabinetHDB < Test::Unit::TestCase
     wr = osetup
     wr.put(key, { "rack.input" => StringIO.new("OK") })
     o = Object.new
-    o.extend Metropolis::TokyoCabinet::HDB
+    o.extend Metropolis::TC::HDB
     assert_nothing_raised do
       o.setup :path_pattern => @path_pattern, :read_only => true
     end
@@ -176,7 +176,7 @@ class TestTokyocabinetHDB < Test::Unit::TestCase
       obj = Metropolis.new(:uri => "#{uri}?#{query}")
     }
     optimize_args = obj.instance_variable_get(:@optimize)
-    flags = ::TokyoCabinet::HDB::TLARGE | ::TokyoCabinet::HDB::TDEFLATE
+    flags = TokyoCabinet::HDB::TLARGE | TokyoCabinet::HDB::TDEFLATE
     assert_equal flags, optimize_args[3]
     assert_equal 65536, optimize_args[0]
     assert_nil optimize_args[2]