Class: Vivarium::MapStore
- Inherits:
-
Object
- Object
- Vivarium::MapStore
- Defined in:
- lib/vivarium.rb
Instance Method Summary collapse
-
#initialize(pin_dir: Vivarium.bpf_pin_dir) ⇒ MapStore
constructor
A new instance of MapStore.
- #register_pid(pid) ⇒ Object
- #unregister_pid(pid) ⇒ Object
Constructor Details
#initialize(pin_dir: Vivarium.bpf_pin_dir) ⇒ MapStore
Returns a new instance of MapStore.
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/vivarium.rb', line 442 def initialize(pin_dir: Vivarium.bpf_pin_dir) @pin_dir = pin_dir @config_root_targets = RbBCC::HashTable.from_pin( File.join(@pin_dir, "config_root_targets"), "unsigned int", "unsigned char", keysize: 4, leafsize: 1 ) @config_spawned_targets = RbBCC::HashTable.from_pin( File.join(@pin_dir, "config_spawned_targets"), "unsigned int", "unsigned char", keysize: 4, leafsize: 1 ) rescue StandardError => e raise Error, "failed to open pinned maps under #{@pin_dir}: #{e.class}: #{e.}" end |
Instance Method Details
#register_pid(pid) ⇒ Object
462 463 464 |
# File 'lib/vivarium.rb', line 462 def register_pid(pid) @config_root_targets[pid] = 1 end |
#unregister_pid(pid) ⇒ Object
466 467 468 469 470 471 |
# File 'lib/vivarium.rb', line 466 def unregister_pid(pid) @config_root_targets.delete(pid) @config_spawned_targets.clear rescue KeyError nil end |