Class: Pvectl::Models::SnapshotDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/pvectl/models/snapshot_description.rb

Overview

Wraps snapshot describe data: target snapshot + siblings for tree building.

Used by the describe command to return rich snapshot data without changing the existing single-model return convention in ResourceService.

Examples:

Single VM

desc = SnapshotDescription.new(entries: [
  SnapshotDescription::Entry.new(snapshot: snap, siblings: all_snaps)
])

Multiple VMs

desc = SnapshotDescription.new(entries: [entry1, entry2])
desc.single? # => false

Defined Under Namespace

Classes: Entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries:) ⇒ SnapshotDescription

Returns a new instance of SnapshotDescription.

Parameters:

  • entries (Array<Entry>)

    snapshot entries



27
28
29
# File 'lib/pvectl/models/snapshot_description.rb', line 27

def initialize(entries:)
  @entries = entries
end

Instance Attribute Details

#entriesArray<Entry> (readonly)

Returns entries per VM/container.

Returns:

  • (Array<Entry>)

    entries per VM/container



24
25
26
# File 'lib/pvectl/models/snapshot_description.rb', line 24

def entries
  @entries
end

Instance Method Details

#single?Boolean

Returns true when describing a snapshot from a single VM.

Returns:

  • (Boolean)


34
35
36
# File 'lib/pvectl/models/snapshot_description.rb', line 34

def single?
  entries.length == 1
end