Class: Appydave::Tools::Dam::S3Operations

Inherits:
S3Base
  • Object
show all
Defined in:
lib/appydave/tools/dam/s3_operations.rb

Overview

Thin delegation facade for S3 operations. Each method delegates to a focused class that handles one concern. Inherits shared infrastructure and helpers from S3Base.

Constant Summary

Constants inherited from S3Base

Appydave::Tools::Dam::S3Base::EXCLUDE_PATTERNS

Instance Attribute Summary

Attributes inherited from S3Base

#brand, #brand_info, #brand_path, #project_id

Instance Method Summary collapse

Methods inherited from S3Base

#build_s3_key, #extract_relative_path, #initialize, #s3_client

Constructor Details

This class inherits a constructor from Appydave::Tools::Dam::S3Base

Instance Method Details

#archive(force: false, dry_run: false) ⇒ Object

Archive project to SSD



36
37
38
# File 'lib/appydave/tools/dam/s3_operations.rb', line 36

def archive(force: false, dry_run: false)
  S3Archiver.new(brand, project_id, **delegated_opts).archive(force: force, dry_run: dry_run)
end

#calculate_sync_statusString

Calculate 3-state S3 sync status

Returns:

  • (String)

    One of: ‘↑ upload’, ‘↓ download’, ‘✓ synced’, ‘none’



42
43
44
# File 'lib/appydave/tools/dam/s3_operations.rb', line 42

def calculate_sync_status
  S3StatusChecker.new(brand, project_id, **delegated_opts).calculate_sync_status
end

#cleanup(force: false, dry_run: false) ⇒ Object

Cleanup S3 files



26
27
28
# File 'lib/appydave/tools/dam/s3_operations.rb', line 26

def cleanup(force: false, dry_run: false)
  S3Archiver.new(brand, project_id, **delegated_opts).cleanup(force: force, dry_run: dry_run)
end

#cleanup_local(force: false, dry_run: false) ⇒ Object

Cleanup local s3-staging files



31
32
33
# File 'lib/appydave/tools/dam/s3_operations.rb', line 31

def cleanup_local(force: false, dry_run: false)
  S3Archiver.new(brand, project_id, **delegated_opts).cleanup_local(force: force, dry_run: dry_run)
end

#download(dry_run: false) ⇒ Object

Download files from S3 to s3-staging/



16
17
18
# File 'lib/appydave/tools/dam/s3_operations.rb', line 16

def download(dry_run: false)
  S3Downloader.new(brand, project_id, **delegated_opts).download(dry_run: dry_run)
end

#statusObject

Show sync status



21
22
23
# File 'lib/appydave/tools/dam/s3_operations.rb', line 21

def status
  S3StatusChecker.new(brand, project_id, **delegated_opts).status
end

#sync_timestampsHash

Calculate S3 sync timestamps (last upload/download times)

Returns:

  • (Hash)

    { last_upload: Time|nil, last_download: Time|nil }



48
49
50
# File 'lib/appydave/tools/dam/s3_operations.rb', line 48

def sync_timestamps
  S3StatusChecker.new(brand, project_id, **delegated_opts).sync_timestamps
end

#upload(dry_run: false) ⇒ Object

Upload files from s3-staging/ to S3



11
12
13
# File 'lib/appydave/tools/dam/s3_operations.rb', line 11

def upload(dry_run: false)
  S3Uploader.new(brand, project_id, **delegated_opts).upload(dry_run: dry_run)
end