Class: OsCtld::SendReceive::Log
Overview
This class serves as a scratchpad for container send/receive
Both the source and the destination nodes have an instance of this class per container. This class determines whether the next step of the send can proceed, stores names of snapshots created during the send and other settings.
Defined Under Namespace
Classes: Options
Constant Summary
Transfer::Log::STATES
Instance Attribute Summary collapse
#opts, #role, #snapshots, #state, #state_running, #state_snapshot
Class Method Summary
collapse
Instance Method Summary
collapse
#can_cancel?, #can_continue?
Constructor Details
#initialize(opts) ⇒ Log
Returns a new instance of Log.
111
112
113
114
|
# File 'lib/osctld/send_receive/log.rb', line 111
def initialize(opts)
@token = opts[:token]
super(opts.merge(opts: opts[:opts].is_a?(Options) ? opts[:opts] : Options.new(opts[:opts] || {})))
end
|
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
89
90
91
|
# File 'lib/osctld/send_receive/log.rb', line 89
def token
@token
end
|
Class Method Details
.load(cfg) ⇒ Object
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/osctld/send_receive/log.rb', line 91
def self.load(cfg)
new(
role: cfg['role'].to_sym,
token: cfg['token'],
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_receive_cancel? ⇒ Boolean
144
145
146
|
# File 'lib/osctld/send_receive/log.rb', line 144
def can_receive_cancel?
can_cancel?(false)
end
|
#can_receive_continue?(next_state) ⇒ Boolean
140
141
142
|
# File 'lib/osctld/send_receive/log.rb', line 140
def can_receive_continue?(next_state)
can_continue?(next_state, sync_states: %i[base incremental])
end
|
#can_send_cancel?(force) ⇒ Boolean
136
137
138
|
# File 'lib/osctld/send_receive/log.rb', line 136
def can_send_cancel?(force)
can_cancel?(force)
end
|
#can_send_continue?(next_state) ⇒ Boolean
132
133
134
|
# File 'lib/osctld/send_receive/log.rb', line 132
def can_send_continue?(next_state)
can_continue?(next_state, sync_states: %i[incremental])
end
|
#close ⇒ Object
148
149
150
|
# File 'lib/osctld/send_receive/log.rb', line 148
def close
SendReceive::Tokens.free(token)
end
|
#dump ⇒ Object
116
117
118
119
120
121
122
123
124
125
126
|
# File 'lib/osctld/send_receive/log.rb', line 116
def dump
{
'role' => role.to_s,
'token' => token,
'state' => state.to_s,
'snapshots' => snapshots,
'state_snapshot' => state_snapshot,
'state_running' => state_running,
'opts' => opts.dump
}
end
|
#protocol_version ⇒ Object
128
129
130
|
# File 'lib/osctld/send_receive/log.rb', line 128
def protocol_version
opts.protocol_version
end
|