Class: EMogileFS::Request
- Inherits:
-
Object
- Object
- EMogileFS::Request
- Defined in:
- lib/emogilefs.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#options ⇒ Object
Returns the value of attribute options.
-
#request ⇒ Object
Returns the value of attribute request.
-
#socket ⇒ Object
Returns the value of attribute socket.
Instance Method Summary collapse
- #callback(options = {}, &block) ⇒ Object
-
#initialize(client, request) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Object
Constructor Details
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
76 77 78 |
# File 'lib/emogilefs.rb', line 76 def client @client end |
#options ⇒ Object
Returns the value of attribute options.
76 77 78 |
# File 'lib/emogilefs.rb', line 76 def @options end |
#request ⇒ Object
Returns the value of attribute request.
76 77 78 |
# File 'lib/emogilefs.rb', line 76 def request @request end |
#socket ⇒ Object
Returns the value of attribute socket.
76 77 78 |
# File 'lib/emogilefs.rb', line 76 def socket @socket end |
Instance Method Details
#callback(options = {}, &block) ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/emogilefs.rb', line 83 def callback( = {}, &block) if block @options = @callback = block else @callback end end |
#perform ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/emogilefs.rb', line 92 def perform begin bytes_sent = socket.send request, 0 rescue SystemCallError client.send :shutdown raise MogileFS::UnreachableBackendError end unless bytes_sent == request.length then raise MogileFS::RequestTruncatedError, "request truncated (sent #{bytes_sent} expected #{request.length})" end end |