redo IO.copy_stream usage
[ruby-mogilefs-client.git] / lib / mogilefs.rb
blobd0f3e2162761c78967d283ed333830922f56558e
1 # -*- encoding: binary -*-
2 ##
3 # MogileFS is a Ruby client for Danga Interactive's open source distributed
4 # filesystem.
6 # To read more about Danga's MogileFS: http://danga.com/mogilefs/
8 module MogileFS
10   VERSION = '2.2.0'
12   ##
13   # Raised when a socket remains unreadable for too long.
15   class Error < StandardError; end
16   class UnreadableSocketError < Error; end
17   class SizeMismatchError < Error; end
18   class ChecksumMismatchError < RuntimeError; end
19   class ReadOnlyError < Error
20     def message; 'readonly mogilefs'; end
21   end
22   class EmptyPathError < Error; end
23   class UnsupportedPathError < Error; end
24   class RequestTruncatedError < Error; end
25   class InvalidResponseError < Error; end
26   class UnreachableBackendError < Error
27     def message; "couldn't connect to mogilefsd backend"; end
28   end
30   # IO.copy_stream was buggy in Ruby 1.9.2 and earlier
31   if RUBY_VERSION >= "1.9.3"
32     X = IO
33   else
34     require "mogilefs/copy_stream"
35     X = MogileFS::CopyStream
36   end
37 end
39 require 'mogilefs/backend'
40 require 'mogilefs/http_file'
41 require 'mogilefs/client'
42 require 'mogilefs/bigfile'
43 require 'mogilefs/mogilefs'
44 require 'mogilefs/admin'