Module: CephRuby::PoolHelper

Included in:
Pool, Pool
Defined in:
lib/ceph-ruby/pool_helper.rb

Overview

Pool Helper MEthods

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



35
36
37
38
39
# File 'lib/ceph-ruby/pool_helper.rb', line 35

def <=>(other)
  cluster_check = other.cluster <=> cluster
  return cluster_check unless cluster_check == 0
  other.name <=> name
end

#by_id(cluster, id, &block) ⇒ Object



4
5
6
# File 'lib/ceph-ruby/pool_helper.rb', line 4

def by_id(cluster, id, &block)
  Pool.new(cluster, cluster.pool_name_by_id(id), &block)
end

#create_with_all(auid, rule_id) ⇒ Object

Raises:

  • (SystemCallError)


8
9
10
11
12
13
# File 'lib/ceph-ruby/pool_helper.rb', line 8

def create_with_all(auid, rule_id)
  ret = Lib::Rados.rados_pool_create_with_all(cluster.handle, name,
                                              auid, rule_id)
  raise SystemCallError.new("create pool with auid: #{auid}, "\
                            "rule_id: #{rule_id} failed", -ret) if ret < 0
end

#create_with_rule(rule_id) ⇒ Object

Raises:

  • (SystemCallError)


15
16
17
18
19
20
# File 'lib/ceph-ruby/pool_helper.rb', line 15

def create_with_rule(rule_id)
  ret = Lib::Rados.rados_pool_create_with_crush_rule(cluster.handle, name,
                                                     rule_id)
  raise SystemCallError.new("create pool with rule_id: #{rule_id}"\
                            ' failed', -ret) if ret < 0
end

#ensure_openObject



26
27
28
29
# File 'lib/ceph-ruby/pool_helper.rb', line 26

def ensure_open
  return if open?
  open
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
44
# File 'lib/ceph-ruby/pool_helper.rb', line 41

def eql?(other)
  return false unless other.class == self.class
  self == other
end

#log(message) ⇒ Object



31
32
33
# File 'lib/ceph-ruby/pool_helper.rb', line 31

def log(message)
  CephRuby.log("pool #{name} #{message}")
end

#open?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/ceph-ruby/pool_helper.rb', line 22

def open?
  !handle.nil?
end