Sha256: 28abd81a1ef2bccbadb5f4d8b9c574800a4cc0d9d6cdbdbb58eb13ccfad57ce6

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require 'ffi'
require 'objspace'
require 'libvirt/host_callback_storage'
require 'libvirt/util'
require 'libvirt/errors'
require 'libvirt/ffi'
require 'libvirt/base_info'
require 'libvirt/node_info'
require 'libvirt/storage_pool_info'
require 'libvirt/storage_volume_info'
require 'libvirt/event'
require 'libvirt/connection'
require 'libvirt/domain'
require 'libvirt/stream'
require 'libvirt/storage_pool'
require 'libvirt/storage_volume'
require 'libvirt/version'

module Libvirt
  EVENT_HANDLE_READABLE = 1
  EVENT_HANDLE_WRITABLE = 2
  EVENT_HANDLE_ERROR = 4
  EVENT_HANDLE_HANGUP = 8

  class << self
    def lib_version
      version_ptr = ::FFI::MemoryPointer.new(:ulong)
      code = FFI::Host.virGetVersion(version_ptr, nil, nil)
      raise Errors::LibError, 'failed to get version' if code.negative?

      version_number = version_ptr.get_ulong(0)
      Util.parse_version(version_number)
    end

    def logger
      Util.logger
    end

    def logger=(logger)
      Util.logger = logger
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
libvirt_ffi-0.7.0 lib/libvirt.rb
libvirt_ffi-0.6.2 lib/libvirt.rb
libvirt_ffi-0.6.1 lib/libvirt.rb
libvirt_ffi-0.6.0 lib/libvirt.rb