Module: CephRuby::ClusterHelper

Included in:
Cluster, Cluster
Defined in:
lib/ceph-ruby/cluster_helper.rb

Overview

Helper Methods for CephRuby::Cluster

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



30
31
32
# File 'lib/ceph-ruby/cluster_helper.rb', line 30

def <=>(other)
  other.options <=> options
end

#default_optionsObject



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

def default_options
  {
    config_path: '/etc/ceph',
    user: 'client.admin',
    cluster: 'ceph'
  }
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/ceph-ruby/cluster_helper.rb', line 34

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

#log(message) ⇒ Object



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

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

#setup_handle(options) ⇒ Object

Raises:

  • (SystemCallError)


4
5
6
7
8
9
10
11
12
# File 'lib/ceph-ruby/cluster_helper.rb', line 4

def setup_handle(options)
  handle_p = FFI::MemoryPointer.new(:pointer)
  ret = Lib::Rados.rados_create2(handle_p,
                                 options[:cluster],
                                 options[:user],
                                 options[:flags])
  raise SystemCallError.new('open of cluster failed', -ret) if ret < 0
  handle_p.get_pointer(0)
end

#uint?(value) ⇒ Boolean

Returns:

  • (Boolean)


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

def uint?(value)
  value.is_a?(Integer) && value >= 0
end