Sha256: 7fad099319974e9bdd6fe81a9b21cf50bb116fad8ab518cff96d9e2069887cf4

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'ffi'
require 'libvirt/version'
require 'libvirt/loggable'
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/network'
require 'libvirt/interface'

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

  module_function

  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
libvirt_ffi-0.8.1 lib/libvirt.rb