Sha256: 5f413dac3b89763422bf51d7a0107ccf5631ce0060d76045e6b1f4f759b115b4

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'ffi'
require 'objspace'
require 'libvirt/util'
require 'libvirt/error'
require 'libvirt/ffi/common'
require 'libvirt/ffi/libvirt'
require 'libvirt/ffi/connection'
require 'libvirt/ffi/domain'
require 'libvirt/ffi/event'
require 'libvirt/ffi/node_info'
require 'libvirt/ffi/stream'
require 'libvirt/event'
require 'libvirt/connection'
require 'libvirt/domain'
require 'libvirt/node_info'
require 'libvirt/stream'
require 'libvirt/version'

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

  DOMAIN_EVENT_ID_LIFECYCLE = 0

  class << self
    def lib_version
      version_ptr = ::FFI::MemoryPointer.new(:ulong)
      code = FFI::Libvirt.virGetVersion(version_ptr, nil, nil)
      raise Error, 'failed to get version' if code < 0
      version_number = version_ptr.get_ulong(0)
      Libvirt::Util.parse_version(version_number)
    end

    def logger
      Util.logger
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
libvirt_ffi-0.3.0 lib/libvirt.rb