Module: Wukong::Deploy::PrepareSyncerOverride
- Defined in:
- lib/wukong-deploy/extensions/prepare_syncer.rb
Overview
Attaches to the hooks provided by the Wukong::Load::Syncer class to write data to Vayacondios.
Defined Under Namespace
Modules: HandlerOverride
Instance Method Summary collapse
-
#after_sync ⇒ Object
Announces a successful sync and updates the last sync state and time.
-
#before_sync ⇒ Object
Saves the syncer as a stash in Vayacondios.
-
#on_error(error) ⇒ Object
Announces an error during a sync and updates the last sync state and time.
-
#to_vayacondios ⇒ Hash
Returns a representation of this PrepareSyncer suitable for a Vayacondios stash.
-
#vayacondios_topic ⇒ String
Returns the Vayacondios topic for this PrepareSyncer.
Instance Method Details
#after_sync ⇒ Object
Announces a successful sync and updates the last sync state and time.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wukong-deploy/extensions/prepare_syncer.rb', line 16 def after_sync super() Wukong::Deploy.vayacondios_client.announce(vayacondios_topic, { success: success?, step: 'prepare', counts: counts, files: files, }.tap { |e| e[:duration] = duration if duration }) Wukong::Deploy.vayacondios_client.set(vayacondios_topic, "prepare.last", { state: (success? ? 1 : 0), time: Time.now.utc.to_i }) end |
#before_sync ⇒ Object
Saves the syncer as a stash in Vayacondios.
9 10 11 12 |
# File 'lib/wukong-deploy/extensions/prepare_syncer.rb', line 9 def before_sync super() Wukong::Deploy.vayacondios_client.set(vayacondios_topic, 'prepare', self) end |
#on_error(error) ⇒ Object
Announces an error during a sync and updates the last sync state and time.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/wukong-deploy/extensions/prepare_syncer.rb', line 29 def on_error error super(error) Wukong::Deploy.vayacondios_client.announce(vayacondios_topic, { success: false, step: 'prepare', error: error.class, message: error., counts: counts, files: files, }) Wukong::Deploy.vayacondios_client.set(vayacondios_topic, "prepare.last", { state: 0, time: Time.now.utc.to_i }) end |
#to_vayacondios ⇒ Hash
Returns a representation of this PrepareSyncer suitable for a Vayacondios stash.
53 54 55 56 57 58 59 60 61 |
# File 'lib/wukong-deploy/extensions/prepare_syncer.rb', line 53 def to_vayacondios { split: settings[:split], lines: settings[:lines], bytes: settings[:bytes], ordered: settings[:ordered], metadata: settings[:metadata], } end |
#vayacondios_topic ⇒ String
Returns the Vayacondios topic for this PrepareSyncer.
45 46 47 |
# File 'lib/wukong-deploy/extensions/prepare_syncer.rb', line 45 def vayacondios_topic "listeners.#{name}" end |