Class: Cuboid::System::Platforms::Base
- Defined in:
- lib/cuboid/system/platforms.rb
Class Method Summary collapse
-
.current? ⇒ Bool
abstract
‘true` if it’s the current platform, ‘false` otherwise.
- .inherited(platform) ⇒ Object
Instance Method Summary collapse
- #_exec(cmd) ⇒ Object
-
#cpu_count ⇒ Integer
Amount of CPU cores.
-
#disk_directory ⇒ String Location for temporary file storage.
String Location for temporary file storage.
-
#disk_space_for_process(pid) ⇒ Integer
Amount of disk in bytes used by the given PID.
-
#disk_space_free ⇒ Integer
abstract
Amount of free disk in bytes.
-
#memory_for_process_group(pgid) ⇒ Integer
abstract
Amount of RAM in bytes used by the given GPID.
-
#memory_free ⇒ Integer
abstract
Amount of free RAM in bytes.
Class Method Details
.current? ⇒ Bool
This method is abstract.
Returns ‘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_count ⇒ Integer
Returns Amount of CPU cores.
67 68 69 |
# File 'lib/cuboid/system/platforms.rb', line 67 def cpu_count Concurrent.processor_count end |
#disk_directory ⇒ String Location for temporary file storage.
Returns 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.
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_free ⇒ Integer
This method is abstract.
Returns 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.
38 39 40 |
# File 'lib/cuboid/system/platforms.rb', line 38 def memory_for_process_group( pgid ) raise 'Missing implementation' end |
#memory_free ⇒ Integer
This method is abstract.
Returns Amount of free RAM in bytes.
27 28 29 |
# File 'lib/cuboid/system/platforms.rb', line 27 def memory_free raise 'Missing implementation' end |