1 # -*- encoding: binary -*-
3 # To read more about \MogileFS, go to http://mogilefs.org/
5 # Client usage information is available in MogileFS::MogileFS.
8 if defined?(Process::CLOCK_MONOTONIC)
10 Process.clock_gettime(Process::CLOCK_MONOTONIC)
18 # Standard error class for most MogileFS-specific errors
19 Error = Class.new(StandardError)
21 # Raised when a socket remains unreadable for too long.
22 UnreadableSocketError = Class.new(Error)
24 # Raised when a response is truncated while reading
25 # due to network/server # errors)
26 SizeMismatchError = Class.new(Error)
28 # Raised when checksum verification fails (only while reading deprecated
29 # "bigfiles" from the deprecated mogtool(1).
30 ChecksumMismatchError = Class.new(RuntimeError)
32 # Raised when a backend is in read-only mode
33 class ReadOnlyError < Error
39 # Raised when an upload is impossible
40 EmptyPathError = Class.new(Error)
42 # Raised when we are given an unsupported protocol to upload to.
43 # Currently, the \MogileFS (2.XX) server only supports HTTP and
44 # this library is only capable of HTTP.
45 UnsupportedPathError = Class.new(Error)
47 # Raised when a request (HTTP or tracker) was truncated due to a network or
48 # server error. It may be possible to retry idempotent requests from this.
49 RequestTruncatedError = Class.new(Error)
51 # Raised when a response from a server (HTTP or tracker) is not in a format
52 # that we expected (or truncated..
53 InvalidResponseError = Class.new(Error)
55 # Raised when all known backends have failed.
56 UnreachableBackendError = Class.new(Error)
58 # There was an error as a result of the use of the (experimental)
59 # pipelining code to the tracker backend
60 PipelineError = Class.new(Error)
64 # somebody could use IO::Splice from the "io_splice" RubyGem, too
65 # don't consider this a stable API, though...
69 # IO.copy_stream was buggy in Ruby 1.9.2 and earlier
70 if RUBY_VERSION >= "1.9.3"
73 require "mogilefs/copy_stream"
74 @io = MogileFS::CopyStream
78 require 'net/http/persistent'
79 NHP = Net::HTTP::Persistent
81 require 'mogilefs/nhp_fake'
82 NHP = MogileFS::NhpFake
85 # autoload rarely-used things:
86 autoload :Mysql, 'mogilefs/mysql'
87 autoload :Pool, 'mogilefs/pool'
88 autoload :Admin, 'mogilefs/admin'
92 require 'mogilefs/util'
93 require 'mogilefs/socket'
94 require 'mogilefs/backend'
95 require 'mogilefs/http_file'
96 require 'mogilefs/http_reader'
97 require 'mogilefs/client'
98 require 'mogilefs/bigfile'
99 require 'mogilefs/mogilefs'
100 require 'mogilefs/version' # generated by ./GIT-VERSION-GEN