Class: GlusterFS::Volume
- Inherits:
-
Object
- Object
- GlusterFS::Volume
- Defined in:
- lib/glusterfs/volume.rb
Instance Attribute Summary collapse
-
#fs ⇒ Object
readonly
Returns the value of attribute fs.
-
#mounted ⇒ Object
readonly
Returns the value of attribute mounted.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Volume
constructor
A new instance of Volume.
- #mount(host, port = 24007, protocol = 'tcp') ⇒ Object
- #mounted? ⇒ Boolean
- #unmount ⇒ Object
Constructor Details
Instance Attribute Details
#fs ⇒ Object (readonly)
Returns the value of attribute fs.
2 3 4 |
# File 'lib/glusterfs/volume.rb', line 2 def fs @fs end |
#mounted ⇒ Object (readonly)
Returns the value of attribute mounted.
2 3 4 |
# File 'lib/glusterfs/volume.rb', line 2 def mounted @mounted end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/glusterfs/volume.rb', line 2 def name @name end |
Instance Method Details
#mount(host, port = 24007, protocol = 'tcp') ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/glusterfs/volume.rb', line 10 def mount(host, port = 24007, protocol = 'tcp') GlusterFS.set_volfile_server(@fs, protocol, host, port) result = GlusterFS.init(@fs) if result != 0 raise GlusterFS::Error, "Failed to mount volume '#{volume_name}' on #{protocol}://#{host}:#{port}" end @mounted = true self end |
#mounted? ⇒ Boolean
21 22 23 |
# File 'lib/glusterfs/volume.rb', line 21 def mounted? @mounted end |
#unmount ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/glusterfs/volume.rb', line 25 def unmount if mounted? GlusterFS.fini(@fs) @mounted = false true end end |