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.



95
96
97
# File 'lib/osctld/local_transfer/log.rb', line 95

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



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

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)


114
115
116
# File 'lib/osctld/local_transfer/log.rb', line 114

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

#can_local_continue?(next_state) ⇒ Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/osctld/local_transfer/log.rb', line 110

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

#closeObject



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

def close; end

#dumpObject



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

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