1 # -*- encoding: binary -*-
3 # To read more about \MogileFS, go to http://mogilefs.org/
5 # Client usage information is available in MogileFS::MogileFS.
9 if defined?(Process::CLOCK_MONOTONIC)
11 Process.clock_gettime(Process::CLOCK_MONOTONIC)
20 # Standard error class for most MogileFS-specific errors
21 Error = Class.new(StandardError)
23 # Raised when a socket remains unreadable for too long.
24 UnreadableSocketError = Class.new(Error)
26 # Raised when a response is truncated while reading
27 # due to network/server # errors)
28 SizeMismatchError = Class.new(Error)
30 # Raised when checksum verification fails (only while reading deprecated
31 # "bigfiles" from the deprecated mogtool(1).
32 ChecksumMismatchError = Class.new(RuntimeError)
34 # Raised when a backend is in read-only mode
35 class ReadOnlyError < Error
41 # Raised when an upload is impossible
42 EmptyPathError = Class.new(Error)
44 # Raised when we are given an unsupported protocol to upload to.
45 # Currently, the \MogileFS (2.XX) server only supports HTTP and
46 # this library is only capable of HTTP.
47 UnsupportedPathError = Class.new(Error)
49 # Raised when a request (HTTP or tracker) was truncated due to a network or
50 # server error. It may be possible to retry idempotent requests from this.
51 RequestTruncatedError = Class.new(Error)
53 # Raised when a response from a server (HTTP or tracker) is not in a format
54 # that we expected (or truncated..
55 InvalidResponseError = Class.new(Error)
57 # Raised when all known backends have failed.
58 UnreachableBackendError = Class.new(Error)
60 # There was an error as a result of the use of the (experimental)
61 # pipelining code to the tracker backend
62 PipelineError = Class.new(Error)
66 # somebody could use IO::Splice from the "io_splice" RubyGem, too
67 # don't consider this a stable API, though...
71 # IO.copy_stream was buggy in Ruby 1.9.2 and earlier
72 if RUBY_VERSION >= "1.9.3"
75 require "mogilefs/copy_stream"
76 @io = MogileFS::CopyStream
80 require 'net/http/persistent'
81 NHP = Net::HTTP::Persistent
83 require 'mogilefs/nhp_fake'
84 NHP = MogileFS::NhpFake
87 # autoload rarely-used things:
88 autoload :Mysql, 'mogilefs/mysql'
89 autoload :Pool, 'mogilefs/pool'
90 autoload :Admin, 'mogilefs/admin'
94 require 'mogilefs/util'
95 require 'mogilefs/socket'
96 require 'mogilefs/backend'
97 require 'mogilefs/http_file'
98 require 'mogilefs/http_reader'
99 require 'mogilefs/client'
100 require 'mogilefs/bigfile'
101 require 'mogilefs/mogilefs'
102 require 'mogilefs/version' # generated by ./GIT-VERSION-GEN