Class: OsCtld::LocalTransfer::Log

Inherits:
Transfer::Log show all
Defined in:
lib/osctld/local_transfer/log.rb

Defined Under Namespace

Classes: Dataset, Options

Constant Summary

Constants inherited from Transfer::Log

Transfer::Log::STATES

Instance Attribute Summary

Attributes inherited from Transfer::Log

#opts, #role, #snapshots, #state, #state_running, #state_snapshot

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Transfer::Log

#can_cancel?, #can_continue?

Constructor Details

#initialize(opts) ⇒ Log

Returns a new instance of Log.



97
98
99
# File 'lib/osctld/local_transfer/log.rb', line 97

def initialize(opts)
  super(opts.merge(opts: opts[:opts].is_a?(Options) ? opts[:opts] : Options.new(opts[:opts] || {})))
end

Class Method Details

.load(cfg) ⇒ Object



86
87
88
89
90
91
92
93
94
95
# File 'lib/osctld/local_transfer/log.rb', line 86

def self.load(cfg)
  new(
    role: cfg['role'].to_sym,
    state: cfg['state'].to_sym,
    snapshots: cfg['snapshots'] || [],
    state_snapshot: cfg['state_snapshot'],
    state_running: cfg['state_running'],
    opts: Options.load(cfg['opts'])
  )
end

Instance Method Details

#can_local_cancel?(force = false) ⇒ Boolean

Returns:

  • (Boolean)


116
117
118
# File 'lib/osctld/local_transfer/log.rb', line 116

def can_local_cancel?(force = false)
  can_cancel?(force)
end

#can_local_continue?(next_state) ⇒ Boolean

Returns:

  • (Boolean)


112
113
114
# File 'lib/osctld/local_transfer/log.rb', line 112

def can_local_continue?(next_state)
  can_continue?(next_state, sync_states: %i[incremental])
end

#closeObject



120
# File 'lib/osctld/local_transfer/log.rb', line 120

def close; end

#dumpObject



101
102
103
104
105
106
107
108
109
110
# File 'lib/osctld/local_transfer/log.rb', line 101

def dump
  {
    'role' => role.to_s,
    'state' => state.to_s,
    'snapshots' => snapshots,
    'state_snapshot' => state_snapshot,
    'state_running' => state_running,
    'opts' => opts.dump
  }
end