Class: OsCtl::Lib::Zfs::ObjsetStats::Tree

Inherits:
Object
  • Object
show all
Defined in:
lib/libosctl/zfs/objset_stats/tree.rb

Instance Method Summary collapse

Constructor Details

#initializeTree

Returns a new instance of Tree.



3
4
5
# File 'lib/libosctl/zfs/objset_stats/tree.rb', line 3

def initialize
  @pool_trees = {}
end

Instance Method Details

#<<(pool_tree) ⇒ Object

Parameters:



8
9
10
# File 'lib/libosctl/zfs/objset_stats/tree.rb', line 8

def <<(pool_tree)
  @pool_trees[pool_tree.pool] = pool_tree
end

#[](dataset) ⇒ Object

Parameters:

  • dataset (String)


13
14
15
16
# File 'lib/libosctl/zfs/objset_stats/tree.rb', line 13

def [](dataset)
  pool = dataset.split('/').first
  @pool_trees[pool][dataset]
end

#aggregate_stats(into: nil) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/libosctl/zfs/objset_stats/tree.rb', line 18

def aggregate_stats(into: nil)
  st = Zfs::ObjsetStats::Objset::AggregatedStats.new(0, 0, 0, 0)

  @pool_trees.each_value do |pool_tree|
    pool_tree.aggregate_stats(into: st)
  end

  st
end