diff options
author | Jacob Burkhart <jacob@brontes3d.com> | 2009-02-23 13:01:55 -0500 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-02-23 14:39:17 -0800 |
commit | 6cf59a3231bd53a1bfe91df31e900e4349a4746e (patch) | |
tree | df3df76bb141dd88c211dac861cac1f57a0b2bd3 /lib/mogilefs/mogilefs.rb | |
parent | aaf794c5455b17ab8f0a15ccd81f7496bcc0b8d5 (diff) | |
download | mogilefs-client-6cf59a3231bd53a1bfe91df31e900e4349a4746e.tar.gz |
New way to call 'store_content' with a MogileFS::Util::StoreContent allows you to roll your own method of streaming data to mogile on an upload (instead of using a string or file) [ew: this still requires a known content length beforehand] [ew: applied with --whitespace=strip, rewritten subject, 80-column wrapping] Signed-off-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'lib/mogilefs/mogilefs.rb')
-rw-r--r-- | lib/mogilefs/mogilefs.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/mogilefs/mogilefs.rb b/lib/mogilefs/mogilefs.rb index f95cb1c..737f468 100644 --- a/lib/mogilefs/mogilefs.rb +++ b/lib/mogilefs/mogilefs.rb @@ -161,7 +161,11 @@ class MogileFS::MogileFS < MogileFS::Client raise MogileFS::ReadOnlyError if readonly? new_file key, klass do |mfp| - mfp << content + if content.is_a?(MogileFS::Util::StoreContent) + mfp.streaming_io = content + else + mfp << content + end end content.length |