mogilefs-client.git  about / heads / tags
MogileFS client library for Ruby
blob cd58c49ffc4a1ca5713cab89033b1b42bf5b5d12 2501 bytes (raw)
$ git show pu: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
74
75
76
77
78
79
80
81
82
 
# -*- encoding: binary -*-
#
# To read more about \MogileFS, go to http://mogilefs.org/
#
# Client usage information is available in MogileFS::MogileFS.
module MogileFS

  # 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 # :nodoc:
      '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.XX) 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

  # There was an error as a result of the use of the (experimental)
  # pipelining code to the tracker backend
  class PipelineError < Error; end

  # :stopdoc:
  class << self
    # somebody could use IO::Splice from the "io_splice" RubyGem, too
    # don't consider this a stable API, though...
    attr_accessor :io
  end

  # IO.copy_stream was buggy in Ruby 1.9.2 and earlier
  if RUBY_VERSION >= "1.9.3"
    @io = IO
  else
    require "mogilefs/copy_stream"
    @io = 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'
require 'mogilefs/version' # generated by ./GIT-VERSION-GEN

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