about summary refs log tree commit
path: root/lib/metropolis/tc/hdb.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-11-23 13:11:52 -0800
committerEric Wong <normalperson@yhbt.net>2010-11-23 13:11:52 -0800
commit861f7759a53b37f76a9b64710b2312a1fd1365a8 (patch)
tree9d28b608d52e3a263bf7eb2a1dfeab474053f9dc /lib/metropolis/tc/hdb.rb
parent9b6c5f2fdf5cac77fda7fb506fe09d22cd18b8ab (diff)
downloadmetropolis-861f7759a53b37f76a9b64710b2312a1fd1365a8.tar.gz
use common setup elements
Some other databases will be able to utilize these
variables.
Diffstat (limited to 'lib/metropolis/tc/hdb.rb')
-rw-r--r--lib/metropolis/tc/hdb.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/metropolis/tc/hdb.rb b/lib/metropolis/tc/hdb.rb
index 871876d..ebd7a17 100644
--- a/lib/metropolis/tc/hdb.rb
+++ b/lib/metropolis/tc/hdb.rb
@@ -9,9 +9,7 @@ module Metropolis::TC::HDB
   include Metropolis::Common
 
   def setup(opts)
-    @headers = { 'Content-Type' => 'application/octet-stream' }
-    @headers.merge!(opts[:response_headers] || {})
-    @nr_slots = opts[:nr_slots] || 3
+    super
     path_pattern = opts[:path_pattern]
     path_pattern.scan(/%\d*x/).size == 1 or
       raise ArgumentError, "only one '/%\d*x/' may appear in #{path_pattern}"
@@ -41,7 +39,7 @@ module Metropolis::TC::HDB
     @dbv = (0...@nr_slots).to_a.map do |slot|
       path = sprintf(path_pattern, slot)
       hdb = TCHDB.new
-      unless opts[:readonly]
+      unless @readonly
         hdb.open(path, TCHDB::OWRITER | TCHDB::OCREAT) or ex!(:open, hdb)
         if @optimize
           hdb.optimize(*@optimize) or ex!(:optimize, hdb)
@@ -52,9 +50,7 @@ module Metropolis::TC::HDB
     end
     @rd_flags = TCHDB::OREADER
     @wr_flags = TCHDB::OWRITER
-    if opts[:readonly]
-      extend(RO)
-    end
+    extend(RO) if @readonly
   end