Class: Cuboid::System::Platforms::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cuboid/system/platforms.rb

Direct Known Subclasses

Linux, OSX, Windows

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.current?Bool

This method is abstract.

Returns ‘true` if it’s the current platform, ‘false` otherwise.

Returns:

  • (Bool)

    ‘true` if it’s the current platform, ‘false` otherwise.



18
19
20
# File 'lib/cuboid/system/platforms.rb', line 18

def current?
    raise 'Missing implementation'
end

.inherited(platform) ⇒ Object



10
11
12
# File 'lib/cuboid/system/platforms.rb', line 10

def inherited( platform )
    System.register_platform platform
end

Instance Method Details

#_exec(cmd) ⇒ Object



72
73
74
# File 'lib/cuboid/system/platforms.rb', line 72

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

#cpu_countInteger

Returns Amount of CPU cores.

Returns:

  • (Integer)

    Amount of CPU cores.



67
68
69
# File 'lib/cuboid/system/platforms.rb', line 67

def cpu_count
    Concurrent.processor_count
end

#disk_directoryString Location for temporary file storage.

Returns String Location for temporary file storage.

Returns:

  • (String Location for temporary file storage.)

    String Location for temporary file storage.



52
53
54
# File 'lib/cuboid/system/platforms.rb', line 52

def disk_directory
    Options.paths.os_tmpdir
end

#disk_space_for_process(pid) ⇒ Integer

Returns Amount of disk in bytes used by the given PID.

Parameters:

  • pid (Integer)

    Process ID.

Returns:

  • (Integer)

    Amount of disk in bytes used by the given PID.



61
62
63
# File 'lib/cuboid/system/platforms.rb', line 61

def disk_space_for_process( pid )
    Support::Database::Base.disk_space_for( pid )
end

#disk_space_freeInteger

This method is abstract.

Returns Amount of free disk in bytes.

Returns:

  • (Integer)

    Amount of free disk in bytes.



46
47
48
# File 'lib/cuboid/system/platforms.rb', line 46

def disk_space_free
    raise 'Missing implementation'
end

#memory_for_process_group(pgid) ⇒ Integer

This method is abstract.

Returns Amount of RAM in bytes used by the given GPID.

Parameters:

  • pgid (Integer)

    Process group ID.

Returns:

  • (Integer)

    Amount of RAM in bytes used by the given GPID.



38
39
40
# File 'lib/cuboid/system/platforms.rb', line 38

def memory_for_process_group( pgid )
    raise 'Missing implementation'
end

#memory_freeInteger

This method is abstract.

Returns Amount of free RAM in bytes.

Returns:

  • (Integer)

    Amount of free RAM in bytes.



27
28
29
# File 'lib/cuboid/system/platforms.rb', line 27

def memory_free
    raise 'Missing implementation'
end