diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-11-23 13:16:06 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-11-23 13:16:06 -0800 |
commit | 2bb7406db018e6902aacaf495e63d69cf9b93174 (patch) | |
tree | 77777549533e40170772045fa5984b3a72038ff9 /lib/metropolis/tc/hdb/ro.rb | |
parent | 861f7759a53b37f76a9b64710b2312a1fd1365a8 (diff) | |
download | metropolis-2bb7406db018e6902aacaf495e63d69cf9b93174.tar.gz |
split out common read-only code
It makes sense for other databases to share the same code.
Diffstat (limited to 'lib/metropolis/tc/hdb/ro.rb')
-rw-r--r-- | lib/metropolis/tc/hdb/ro.rb | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/lib/metropolis/tc/hdb/ro.rb b/lib/metropolis/tc/hdb/ro.rb index 4114606..fddd73c 100644 --- a/lib/metropolis/tc/hdb/ro.rb +++ b/lib/metropolis/tc/hdb/ro.rb @@ -1,6 +1,8 @@ # -*- encoding: binary -*- module Metropolis::TC::HDB::RO + include Metropolis::Common::RO + def self.extended(obj) obj.instance_eval do @wr_flags = nil @@ -12,22 +14,6 @@ module Metropolis::TC::HDB::RO end end - def call(env) - if %r{\A/(.*)\z} =~ env["PATH_INFO"] - key = unescape($1) - case env["REQUEST_METHOD"] - when "GET" - get(key) - when "HEAD" - head(key) - else - r(403) - end - else # OPTIONS - r(405) - end - end - def reader(key) yield @ro_dbv[key.hash % @nr_slots] end |