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.
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 |
# File 'lib/vivarium.rb', line 493 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
513 514 515 |
# File 'lib/vivarium.rb', line 513 def register_pid(pid) @config_root_targets[pid] = 1 end |
#unregister_pid(pid) ⇒ Object
517 518 519 520 521 522 |
# File 'lib/vivarium.rb', line 517 def unregister_pid(pid) @config_root_targets.delete(pid) @config_spawned_targets.clear rescue KeyError nil end |