Sha256: 777ac6c6ac9adbe94b10bd4d8d9cb8b08e4217102635f1e3c43abc752cb41c11

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

module CephRuby
  # Helper Methods for CephRuby::Cluster
  module ClusterHelper
    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

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

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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ceph-ruby-livelink-1.5.1 lib/ceph-ruby/cluster_helper.rb