Class: OsCtld::GarbageCollector::ContainerRunDataset

Inherits:
Object
  • Object
show all
Defined in:
lib/osctld/garbage_collector.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(run_id, dataset) ⇒ ContainerRunDataset

Returns a new instance of ContainerRunDataset.

Parameters:



27
28
29
30
# File 'lib/osctld/garbage_collector.rb', line 27

def initialize(run_id, dataset)
  @run_id = run_id
  @dataset = dataset
end

Instance Attribute Details

#datasetOsCtl::Lib::Zfs::Dataset (readonly)

Returns:

  • (OsCtl::Lib::Zfs::Dataset)


23
24
25
# File 'lib/osctld/garbage_collector.rb', line 23

def dataset
  @dataset
end

#run_idContainer::RunId (readonly)

Returns:



20
21
22
# File 'lib/osctld/garbage_collector.rb', line 20

def run_id
  @run_id
end

Class Method Details

.load(cfg) ⇒ Object



12
13
14
15
16
17
# File 'lib/osctld/garbage_collector.rb', line 12

def self.load(cfg)
  new(
    Container::RunId.load(cfg['run_id']),
    OsCtl::Lib::Zfs::Dataset.new(cfg['dataset'])
  )
end

Instance Method Details

#==(other) ⇒ Object



47
48
49
# File 'lib/osctld/garbage_collector.rb', line 47

def ==(other)
  other.run_id == run_id && other.dataset.name == dataset.name
end

#container_idObject



36
37
38
# File 'lib/osctld/garbage_collector.rb', line 36

def container_id
  run_id.container_id
end

#dumpObject



40
41
42
43
44
45
# File 'lib/osctld/garbage_collector.rb', line 40

def dump
  {
    'run_id' => run_id.dump,
    'dataset' => dataset.name
  }
end

#pool_nameObject



32
33
34
# File 'lib/osctld/garbage_collector.rb', line 32

def pool_name
  run_id.pool_name
end