Class: CephStorage::PoolEnumerator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ceph_storage/pool_enumerator.rb

Overview

Enumerator of Ceph pools

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster_factory) {|_self| ... } ⇒ PoolEnumerator

Returns a new instance of PoolEnumerator.

Yields:

  • (_self)

Yield Parameters:



6
7
8
9
10
# File 'lib/ceph_storage/pool_enumerator.rb', line 6

def initialize(cluster_factory)
  self.cluster_factory = cluster_factory
  @rados_pool_enumerator = cluster_factory.rados_cluster.pools
  yield self if block_given?
end

Instance Attribute Details

#cluster_factoryObject

Returns the value of attribute cluster_factory.



5
6
7
# File 'lib/ceph_storage/pool_enumerator.rb', line 5

def cluster_factory
  @cluster_factory
end

Instance Method Details

#eachObject



12
13
14
15
16
17
18
# File 'lib/ceph_storage/pool_enumerator.rb', line 12

def each
  return enum_for(:each) unless block_given?

  @rados_pool_enumerator.each do |pool|
    yield PoolFactory.build(cluster_factory, pool.name)
  end
end

#sizeObject



20
21
22
# File 'lib/ceph_storage/pool_enumerator.rb', line 20

def size
  cluster.rados_cluster.pools.size
end