Class: OsCtld::Commands::Container::LocalTransfer::Sync
- Defined in:
- lib/osctld/commands/container/local_transfer/sync.rb
Instance Attribute Summary
Attributes inherited from Base
#client, #client_handler, #id, #opts
Instance Method Summary collapse
Methods inherited from Base
#build_dataset_map, #cleanup_target_container!, #clear_failed_state_snapshot, #complete_target!, #destroy_local_transfer_snapshots, #ensure_target_staged_or_complete!, #find, #force_writeout, #operation, #require_local_transfer_log!, #snapshot_datasets, #snapshot_name, #start_target!, #target_ct, #target_pool, #transfer_dataset, #validate_dataset_layout!
Methods inherited from Logged
Methods inherited from Base
#base_execute, #call_cmd, #call_cmd!, #error, #error!, handle, #handled, #indirect?, #initialize, #manipulate, #manipulation_holder, #ok, #progress, #request_stop, run, run!
Constructor Details
This class inherits a constructor from OsCtld::Commands::Base
Instance Method Details
#execute(ct) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/osctld/commands/container/local_transfer/sync.rb', line 5 def execute(ct) manipulate(ct) do log = ct.exclusively do ret = require_local_transfer_log!(ct) unless %i[base incremental].include?(ret.state) && ret.can_local_continue?(:incremental) error!('invalid local transfer sequence') end ret end target_ct(log) validate_dataset_layout!(ct) prev_snap = log.snapshots.last snap = snapshot_name(:incr) snapshot_datasets(log, snap) ct.exclusively do ct.local_transfer_log.snapshots << snap ct.save_config end log.opts.datasets.each do |pair| transfer_dataset(pair, snap, from_snapshot: prev_snap) end ct.exclusively do ct.local_transfer_log.state = :incremental ct.save_config end end ok end |