Class: MogileFS::Client
- Inherits:
-
Object
- Object
- MogileFS::Client
- Defined in:
- lib/mogilefs/client.rb
Overview
MogileFS::Client is the MogileFS client base class. Concrete clients like MogileFS::MogileFS and MogileFS::Admin are implemented atop this one to do real work.
Instance Attribute Summary collapse
-
#backend ⇒ Object
readonly
The backend connection for this client.
-
#hosts ⇒ Object
:stopdoc:.
Instance Method Summary collapse
-
#err ⇒ Object
The last error reported by the backend.
-
#errstr ⇒ Object
The last error message reported by the backend.
-
#initialize(args) ⇒ Client
constructor
Creates a new Client.
-
#readonly? ⇒ Boolean
Is this a read-only client?.
-
#reload ⇒ Object
Creates a new MogileFS::Backend.
Constructor Details
#initialize(args) ⇒ Client
Creates a new Client. See MogileFS::Backend#initialize for how to specify hosts. If :readonly is set to true, the client will not modify anything on the server.
MogileFS::Client.new :hosts => ['kaa:6001', 'ziz:6001'], :readonly => true
25 26 27 28 29 30 31 32 33 |
# File 'lib/mogilefs/client.rb', line 25 def initialize(args) @hosts = args[:hosts] @readonly = args[:readonly] ? true : false @timeout = args[:timeout] @fail_timeout = args[:fail_timeout] @connect_timeout = args[:connect_timeout] reload end |
Instance Attribute Details
#backend ⇒ Object (readonly)
The backend connection for this client
12 13 14 |
# File 'lib/mogilefs/client.rb', line 12 def backend @backend end |
#hosts ⇒ Object
:stopdoc:
15 16 17 |
# File 'lib/mogilefs/client.rb', line 15 def hosts @hosts end |
Instance Method Details
#err ⇒ Object
The last error reported by the backend.
48 49 50 |
# File 'lib/mogilefs/client.rb', line 48 def err @backend.lasterr end |
#errstr ⇒ Object
The last error message reported by the backend.
55 56 57 |
# File 'lib/mogilefs/client.rb', line 55 def errstr @backend.lasterrstr end |
#readonly? ⇒ Boolean
Is this a read-only client?
62 63 64 |
# File 'lib/mogilefs/client.rb', line 62 def readonly? @readonly end |
#reload ⇒ Object
Creates a new MogileFS::Backend.
38 39 40 41 42 43 |
# File 'lib/mogilefs/client.rb', line 38 def reload @backend = MogileFS::Backend.new(:hosts => @hosts, :timeout => @timeout, :fail_timeout => @fail_timeout, :connect_timeout => @connect_timeout) end |