Module: Wukong::Deploy::S3SyncerOverride
- Defined in:
- lib/wukong-deploy/extensions/s3_syncer.rb
Overview
Attaches to the hooks provided by the Wukong::Load::Syncer class to write data to Vayacondios.
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 S3Syncer suitable for a Vayacondios stash.
-
#vayacondios_topic ⇒ String
Returns the Vayacondios topic for this S3Syncer.
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 |
# File 'lib/wukong-deploy/extensions/s3_syncer.rb', line 16 def after_sync super() Wukong::Deploy.vayacondios_client.announce(vayacondios_topic, { success: true, step: 's3', bytes: (bytes || 0), }.tap { |e| e[:duration] = duration if duration }) Wukong::Deploy.vayacondios_client.set(vayacondios_topic, "s3.last", { state: 1, 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/s3_syncer.rb', line 9 def before_sync super() Wukong::Deploy.vayacondios_client.set(vayacondios_topic, 's3', self) end |
#on_error(error) ⇒ Object
Announces an error during a sync and updates the last sync state and time.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/wukong-deploy/extensions/s3_syncer.rb', line 28 def on_error error super(error) Wukong::Deploy.vayacondios_client.announce(vayacondios_topic, { success: false, step: 's3', error: error.class, message: error., bytes: bytes, }) Wukong::Deploy.vayacondios_client.set(vayacondios_topic, "s3.last", { state: 0, time: Time.now.utc.to_i }) end |
#to_vayacondios ⇒ Hash
Returns a representation of this S3Syncer suitable for a Vayacondios stash.
51 52 53 54 55 56 |
# File 'lib/wukong-deploy/extensions/s3_syncer.rb', line 51 def to_vayacondios { bucket: s3_uri, region: settings[:region], } end |
#vayacondios_topic ⇒ String
Returns the Vayacondios topic for this S3Syncer.
43 44 45 |
# File 'lib/wukong-deploy/extensions/s3_syncer.rb', line 43 def vayacondios_topic "listeners.#{name}" end |