mog: fix "test -e" on missing files
[ruby-mogilefs-client.git] / lib / mogilefs.rb
blob8193a5f196bea0b1dcf69927bf987c95f41d0a04
1 # -*- encoding: binary -*-
3 # To read more about \MogileFS, go to http://mogilefs.org/
5 # Client usage information is available in MogileFS::MogileFS.
6 module MogileFS
7   # :stopdoc:
8   #
10   # Standard error class for most MogileFS-specific errors
11   class Error < StandardError; end
13   # Raised when a socket remains unreadable for too long.
14   class UnreadableSocketError < Error; end
16   # Raised when a response is truncated while reading
17   # due to network/server # errors)
18   class SizeMismatchError < Error; end
20   # Raised when checksum verification fails (only while reading deprecated
21   # "bigfiles" from the deprecated mogtool(1).
22   class ChecksumMismatchError < RuntimeError; end
24   # Raised when a backend is in read-only mode
25   class ReadOnlyError < Error
26     def message; 'readonly mogilefs'; end
27   end
29   # Raised when an upload is impossible
30   class EmptyPathError < Error; end
32   # Raised when we are given an unsupported protocol to upload to.
33   # Currently, the \MogileFS (2.54) server only supports HTTP and
34   # this library is only capable of HTTP.
35   class UnsupportedPathError < Error; end
37   # Raised when a request (HTTP or tracker) was truncated due to a network or
38   # server error.  It may be possible to retry idempotent requests from this.
39   class RequestTruncatedError < Error; end
41   # Raised when a response from a server (HTTP or tracker) is not in a format
42   # that we expected (or truncated..
43   class InvalidResponseError < Error; end
45   # Raised when all known backends have failed.
46   class UnreachableBackendError < Error; end
48   class PipelineError < Error; end
50   # IO.copy_stream was buggy in Ruby 1.9.2 and earlier
51   if RUBY_VERSION >= "1.9.3"
52     X = IO
53   else
54     require "mogilefs/copy_stream"
55     X = MogileFS::CopyStream
56   end
58   # autoload rarely-used things:
59   autoload :Mysql, 'mogilefs/mysql'
60   autoload :Pool, 'mogilefs/pool'
61   autoload :Admin, 'mogilefs/admin'
62   # :startdoc:
63 end
65 require 'mogilefs/util'
66 require 'mogilefs/socket'
67 require 'mogilefs/backend'
68 require 'mogilefs/http_file'
69 require 'mogilefs/http_reader'
70 require 'mogilefs/client'
71 require 'mogilefs/bigfile'
72 require 'mogilefs/mogilefs'
73 require 'mogilefs/version' # generated by ./GIT-VERSION-GEN