Class: CephStorage::Pool
- Inherits:
-
CephRuby::Pool
- Object
- CephRuby::Pool
- CephStorage::Pool
- Extended by:
- PoolWrapper
- Includes:
- Multiton
- Defined in:
- lib/ceph_storage/pool.rb
Overview
A reference to a Ceph pool This is a collection of held open pool IOctx’s for a given pool
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cartridges ⇒ Object
Returns the value of attribute cartridges.
-
#close_lock ⇒ Object
Returns the value of attribute close_lock.
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pop_lock ⇒ Object
Returns the value of attribute pop_lock.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(cluster, name) ⇒ Pool
constructor
A new instance of Pool.
- #log(message) ⇒ Object
- #num_free ⇒ Object
- #num_locked ⇒ Object
- #path ⇒ Object
- #rados_pool ⇒ Object
- #rados_pool=(pool) ⇒ Object
- #size ⇒ Object
- #storage_object(name, &block) ⇒ Object
- #storage_object_enumerator(&block) ⇒ Object
Methods included from PoolWrapper
Constructor Details
#initialize(cluster, name) ⇒ Pool
Returns a new instance of Pool.
16 17 18 19 20 21 22 23 |
# File 'lib/ceph_storage/pool.rb', line 16 def initialize(cluster, name) log("init #{name}") self.close_lock = Mutex.new self.pop_lock = Mutex.new self.cluster = cluster self.name = name.to_s self.cartridges = [] end |
Instance Attribute Details
#cartridges ⇒ Object
Returns the value of attribute cartridges.
7 8 9 |
# File 'lib/ceph_storage/pool.rb', line 7 def cartridges @cartridges end |
#close_lock ⇒ Object
Returns the value of attribute close_lock.
7 8 9 |
# File 'lib/ceph_storage/pool.rb', line 7 def close_lock @close_lock end |
#cluster ⇒ Object
Returns the value of attribute cluster.
7 8 9 |
# File 'lib/ceph_storage/pool.rb', line 7 def cluster @cluster end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/ceph_storage/pool.rb', line 7 def name @name end |
#pop_lock ⇒ Object
Returns the value of attribute pop_lock.
7 8 9 |
# File 'lib/ceph_storage/pool.rb', line 7 def pop_lock @pop_lock end |
Instance Method Details
#close ⇒ Object
70 71 72 73 74 75 |
# File 'lib/ceph_storage/pool.rb', line 70 def close close_lock.synchronize do close_group(false) close_group(true) end end |
#log(message) ⇒ Object
48 49 50 |
# File 'lib/ceph_storage/pool.rb', line 48 def log() CephStorage.log("pool #{name} #{}") end |
#num_free ⇒ Object
64 65 66 67 68 |
# File 'lib/ceph_storage/pool.rb', line 64 def num_free pop_lock.synchronize do cartridges.count { |c| c[:lock].locked? == false } end end |
#num_locked ⇒ Object
58 59 60 61 62 |
# File 'lib/ceph_storage/pool.rb', line 58 def num_locked pop_lock.synchronize do cartridges.count { |c| c[:lock].locked? == true } end end |
#path ⇒ Object
77 78 79 |
# File 'lib/ceph_storage/pool.rb', line 77 def path "ceph://#{cluster.cluster}/#{name}" end |
#rados_pool ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ceph_storage/pool.rb', line 25 def rados_pool close_lock.synchronize {} h = pop return h unless block_given? begin yield(h) ensure push(h) end end |
#rados_pool=(pool) ⇒ Object
36 37 38 |
# File 'lib/ceph_storage/pool.rb', line 36 def rados_pool=(pool) push(pool) end |
#size ⇒ Object
52 53 54 55 56 |
# File 'lib/ceph_storage/pool.rb', line 52 def size pop_lock.synchronize do cartridges.size end end |
#storage_object(name, &block) ⇒ Object
40 41 42 |
# File 'lib/ceph_storage/pool.rb', line 40 def storage_object(name, &block) CephStorage::StorageObject::RadosStorageObject.new(self, name, &block) end |
#storage_object_enumerator(&block) ⇒ Object
44 45 46 |
# File 'lib/ceph_storage/pool.rb', line 44 def storage_object_enumerator(&block) CephStorage::StorageObject::RadosStorageObjectEnumerator.new(self, &block) end |