about summary refs log tree commit
path: root/lib/metropolis/tdb.rb
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2011-01-17 03:17:28 +0000
committerEric Wong <normalperson@yhbt.net>2011-01-17 09:18:31 +0000
commit2c913347a6e5cc8be776b14e1a177adec0fbd5b6 (patch)
tree8d001fa557ef23c66bc56aa6c2fba943e428382e /lib/metropolis/tdb.rb
parent34a18520286313a05edc9a927ac4bed95b05191c (diff)
downloadmetropolis-2c913347a6e5cc8be776b14e1a177adec0fbd5b6.tar.gz
use constants everywhere to reduce GC thrashing
This makes it easier to notice a typo, too.
Diffstat (limited to 'lib/metropolis/tdb.rb')
-rw-r--r--lib/metropolis/tdb.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/metropolis/tdb.rb b/lib/metropolis/tdb.rb
index 5621d17..56709b1 100644
--- a/lib/metropolis/tdb.rb
+++ b/lib/metropolis/tdb.rb
@@ -44,13 +44,13 @@ module Metropolis::TDB
   end
 
   def put(key, env)
-    value = env["rack.input"].read
+    value = env[Rack_Input].read
     db(key) do |tdb|
-      case env['HTTP_X_TT_PDMODE']
-      when '1'
+      case env[HTTP_X_TT_PDMODE]
+      when "1"
         # TODO: make this atomic
         return r(409) if tdb.include?(key)
-      when '2'
+      when "2"
         value = (tdb.get(key) || "") << value
       end
       tdb.store(key, value)
@@ -64,6 +64,6 @@ module Metropolis::TDB
 
   def get(key, env)
     value = db(key) { |tdb| tdb.fetch(key, @rbuf) } or return r(404)
-    [ 200, { 'Content-Length' => value.size.to_s }.merge!(@headers), [ value ] ]
+    [ 200, { Content_Length => value.size.to_s }.merge!(@headers), [ value ] ]
   end
 end