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.
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
# File 'lib/vivarium.rb', line 479 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
499 500 501 |
# File 'lib/vivarium.rb', line 499 def register_pid(pid) @config_root_targets[pid] = 1 end |
#unregister_pid(pid) ⇒ Object
503 504 505 506 507 508 |
# File 'lib/vivarium.rb', line 503 def unregister_pid(pid) @config_root_targets.delete(pid) @config_spawned_targets.clear rescue KeyError nil end |