mogilefs-client.git  about / heads / tags
MogileFS client library for Ruby
blob e05d2890f45e5d4c4785b5267da3416f0c5a5c49 2171 bytes (raw)
$ git show pipeline:lib/mogilefs.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
# -*- encoding: binary -*-
#
# To read more about \MogileFS, go to http://mogilefs.org/
#
# Client usage information is available in MogileFS::MogileFS.
module MogileFS
  # :stopdoc:

  VERSION = '2.2.0'

  # Standard error class for most MogileFS-specific errors
  class Error < StandardError; end

  # Raised when a socket remains unreadable for too long.
  class UnreadableSocketError < Error; end

  # Raised when a response is truncated while reading
  # due to network/server # errors)
  class SizeMismatchError < Error; end

  # Raised when checksum verification fails (only while reading deprecated
  # "bigfiles" from the deprecated mogtool(1).
  class ChecksumMismatchError < RuntimeError; end

  # Raised when a backend is in read-only mode
  class ReadOnlyError < Error
    def message; 'readonly mogilefs'; end
  end

  # Raised when an upload is impossible
  class EmptyPathError < Error; end

  # Raised when we are given an unsupported protocol to upload to.
  # Currently, the \MogileFS (2.54) server only supports HTTP and
  # this library is only capable of HTTP.
  class UnsupportedPathError < Error; end

  # Raised when a request (HTTP or tracker) was truncated due to a network or
  # server error.  It may be possible to retry idempotent requests from this.
  class RequestTruncatedError < Error; end

  # Raised when a response from a server (HTTP or tracker) is not in a format
  # that we expected (or truncated..
  class InvalidResponseError < Error; end

  # Raised when all known backends have failed.
  class UnreachableBackendError < Error; end

  class BackendPipelineError < Error; end

  # IO.copy_stream was buggy in Ruby 1.9.2 and earlier
  if RUBY_VERSION >= "1.9.3"
    X = IO
  else
    require "mogilefs/copy_stream"
    X = MogileFS::CopyStream
  end

  # autoload rarely-used things:
  autoload :Mysql, 'mogilefs/mysql'
  autoload :Pool, 'mogilefs/pool'
  autoload :Admin, 'mogilefs/admin'
  # :startdoc:
end

require 'mogilefs/util'
require 'mogilefs/socket'
require 'mogilefs/backend'
require 'mogilefs/http_file'
require 'mogilefs/http_reader'
require 'mogilefs/client'
require 'mogilefs/bigfile'
require 'mogilefs/mogilefs'

git clone https://yhbt.net/mogilefs-client.git