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.
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
# File 'lib/vivarium.rb', line 512 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
532 533 534 |
# File 'lib/vivarium.rb', line 532 def register_pid(pid) @config_root_targets[pid] = 1 end |
#unregister_pid(pid) ⇒ Object
536 537 538 539 540 541 |
# File 'lib/vivarium.rb', line 536 def unregister_pid(pid) @config_root_targets.delete(pid) @config_spawned_targets.clear rescue KeyError nil end |