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