Class: OsCtld::Container::RunId
- Inherits:
-
Object
- Object
- OsCtld::Container::RunId
- Defined in:
- lib/osctld/container/run_id.rb
Overview
Identifies individual container runs
Instance Attribute Summary collapse
- #container_id ⇒ String readonly
- #pool_name ⇒ String readonly
- #timestamp ⇒ Float readonly
- #to_s ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #dump ⇒ Object
-
#initialize(pool_name:, container_id:, timestamp: nil) ⇒ RunId
constructor
A new instance of RunId.
- #inspect ⇒ Object
Constructor Details
#initialize(pool_name:, container_id:, timestamp: nil) ⇒ RunId
Returns a new instance of RunId.
28 29 30 31 32 33 |
# File 'lib/osctld/container/run_id.rb', line 28 def initialize(pool_name:, container_id:, timestamp: nil) @pool_name = pool_name @container_id = container_id @timestamp = || Time.now.to_f @to_s = [@pool_name, @container_id, @timestamp].join(':') end |
Instance Attribute Details
#container_id ⇒ String (readonly)
8 9 10 |
# File 'lib/osctld/container/run_id.rb', line 8 def container_id @container_id end |
#pool_name ⇒ String (readonly)
5 6 7 |
# File 'lib/osctld/container/run_id.rb', line 5 def pool_name @pool_name end |
#timestamp ⇒ Float (readonly)
11 12 13 |
# File 'lib/osctld/container/run_id.rb', line 11 def @timestamp end |
#to_s ⇒ String (readonly)
14 15 16 |
# File 'lib/osctld/container/run_id.rb', line 14 def to_s @to_s end |
Class Method Details
.load(cfg) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/osctld/container/run_id.rb', line 17 def self.load(cfg) new( pool_name: cfg.fetch('pool_name'), container_id: cfg.fetch('container_id'), timestamp: cfg.fetch('timestamp') ) end |
Instance Method Details
#==(other) ⇒ Object
39 40 41 |
# File 'lib/osctld/container/run_id.rb', line 39 def ==(other) to_s == other.to_s end |
#dump ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/osctld/container/run_id.rb', line 43 def dump { 'pool_name' => pool_name, 'container_id' => container_id, 'timestamp' => } end |
#inspect ⇒ Object
35 36 37 |
# File 'lib/osctld/container/run_id.rb', line 35 def inspect "#<#{self.class.name}:#{object_id} run=#{self}>" end |