Sha256: 6f47760d9ca8d60b9f87952f5c458bacc0af6c4b4a367b351ad6ad2278188c3a

Contents?: true

Size: 1.59 KB

Versions: 34

Compression:

Stored size: 1.59 KB

Contents

module Cuboid

class System
module Platforms

class Base
    class <<self

        # @private
        def inherited( platform )
            System.register_platform platform
        end

        # @return   [Bool]
        #   `true` if it's the current platform, `false` otherwise.
        #
        # @abstract
        def current?
            raise 'Missing implementation'
        end
    end

    # @return   [Integer]
    #   Amount of free RAM in bytes.
    #
    # @abstract
    def memory_free
        raise 'Missing implementation'
    end

    # @param    [Integer]   pgid
    #   Process group ID.
    #
    # @return   [Integer]
    #   Amount of RAM in bytes used by the given GPID.
    #
    # @abstract
    def memory_for_process_group( pgid )
        raise 'Missing implementation'
    end

    # @return   [Integer]
    #   Amount of free disk in bytes.
    #
    # @abstract
    def disk_space_free
        raise 'Missing implementation'
    end

    # @return   [String
    #   Location for temporary file storage.
    def disk_directory
        Options.paths.os_tmpdir
    end

    # @param    [Integer]   pid
    #   Process ID.
    #
    # @return   [Integer]
    #   Amount of disk in bytes used by the given PID.
    def disk_space_for_process( pid )
        Support::Database::Base.disk_space_for( pid )
    end

    # @return   [Integer]
    #   Amount of CPU cores.
    def cpu_count
        Concurrent.processor_count
    end

    # @private
    def _exec( cmd )
        %x(#{cmd})
    end

end

end
end
end

Dir.glob( "#{File.dirname(__FILE__)}/**/*.rb" ).each do |platform|
    require platform
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
cuboid-0.2.13 lib/cuboid/system/platforms.rb
cuboid-0.2.12 lib/cuboid/system/platforms.rb
cuboid-0.2.11 lib/cuboid/system/platforms.rb
cuboid-0.2.10 lib/cuboid/system/platforms.rb
cuboid-0.2.9 lib/cuboid/system/platforms.rb
cuboid-0.2.8 lib/cuboid/system/platforms.rb
cuboid-0.2.7 lib/cuboid/system/platforms.rb
cuboid-0.2.6 lib/cuboid/system/platforms.rb
cuboid-0.2.5 lib/cuboid/system/platforms.rb
cuboid-0.2.4.2 lib/cuboid/system/platforms.rb
cuboid-0.2.4.1 lib/cuboid/system/platforms.rb
cuboid-0.2.4 lib/cuboid/system/platforms.rb
cuboid-0.2.3 lib/cuboid/system/platforms.rb
cuboid-0.2.2 lib/cuboid/system/platforms.rb
cuboid-0.2.1 lib/cuboid/system/platforms.rb
cuboid-0.2 lib/cuboid/system/platforms.rb
cuboid-0.1.9.1 lib/cuboid/system/platforms.rb
cuboid-0.1.9 lib/cuboid/system/platforms.rb
cuboid-0.1.8 lib/cuboid/system/platforms.rb
cuboid-0.1.7 lib/cuboid/system/platforms.rb