Class: SwarmSDK::RestoreResult

Inherits:
Object
  • Object
show all
Defined in:
lib/swarm_sdk/restore_result.rb

Overview

Result object returned from snapshot restore operations

Provides information about the restore process, including any warnings about agents or delegations that couldn't be restored due to configuration mismatches.

Examples:

Successful restore

result = swarm.restore(snapshot_data)
if result.success?
  puts "All agents restored successfully"
end

Partial restore with warnings

result = swarm.restore(snapshot_data)
if result.partial_restore?
  puts result.summary
  result.warnings.each do |warning|
    puts "  - #{warning[:message]}"
  end
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(warnings:, skipped_agents:, skipped_delegations:) ⇒ RestoreResult

Initialize restore result

Parameters:

  • warnings (Array<Hash>)

    Warning messages with details

  • skipped_agents (Array<Symbol>)

    Names of agents that couldn't be restored

  • skipped_delegations (Array<String>)

    Names of delegation instances that couldn't be restored



32
33
34
35
36
# File 'lib/swarm_sdk/restore_result.rb', line 32

def initialize(warnings:, skipped_agents:, skipped_delegations:)
  @warnings = warnings
  @skipped_agents = skipped_agents
  @skipped_delegations = skipped_delegations
end

Instance Attribute Details

#skipped_agentsObject (readonly)

Returns the value of attribute skipped_agents.



25
26
27
# File 'lib/swarm_sdk/restore_result.rb', line 25

def skipped_agents
  @skipped_agents
end

#skipped_delegationsObject (readonly)

Returns the value of attribute skipped_delegations.



25
26
27
# File 'lib/swarm_sdk/restore_result.rb', line 25

def skipped_delegations
  @skipped_delegations
end

#warningsObject (readonly)

Returns the value of attribute warnings.



25
26
27
# File 'lib/swarm_sdk/restore_result.rb', line 25

def warnings
  @warnings
end

Instance Method Details

#partial_restore?Boolean

Check if restore was partial (some agents skipped)

Returns:

  • (Boolean)

    true if some agents were skipped



48
49
50
# File 'lib/swarm_sdk/restore_result.rb', line 48

def partial_restore?
  !warnings.empty?
end

#success?Boolean

Check if restore was completely successful

Returns:

  • (Boolean)

    true if all agents restored without warnings



41
42
43
# File 'lib/swarm_sdk/restore_result.rb', line 41

def success?
  warnings.empty?
end

#summaryString

Get human-readable summary of restore result

Returns:

  • (String)

    Summary message



55
56
57
58
59
60
61
62
63
# File 'lib/swarm_sdk/restore_result.rb', line 55

def summary
  if success?
    "Snapshot restored successfully. All agents restored."
  else
    "Snapshot restored with warnings. " \
      "#{skipped_agents.size} agents skipped, " \
      "#{skipped_delegations.size} delegation instances skipped."
  end
end