Class: Google::Cloud::Gemserver::Backend::StorageSync
- Inherits:
-
Object
- Object
- Google::Cloud::Gemserver::Backend::StorageSync
- Extended by:
- Forwardable
- Includes:
- Concurrent::Async, Singleton
- Defined in:
- lib/google/cloud/gemserver/backend/storage_sync.rb
Overview
Storage Sync
A set of methods that manage syncing files between the local file system that the gemserver runs on (a container on Google App Engine) and Google Cloud Storage. By doing so, when the gemserver is restarted , for whatever reason, the gems pushed to the gemserver will persist. Without such a system in place all gems / files on the gemserver will be lost as it runs on a container.
Constant Summary collapse
- DIR_LOCK =
A lock to ensure the .gemstash directory, used to store gem files, is created atomically.
File.("~/gemstash_dir").freeze
Class Method Summary collapse
-
.instance ⇒ Object
Delegate the run and download_service methods to the Singleton via .instance.
Instance Method Summary collapse
-
#initialize ⇒ StorageSync
constructor
Creates an instance of the Singleton StorageSync class with a background thread and asynchronous components to run methods asynchronously.
-
#run ⇒ Object
Runs a background gem files syncing service to ensure they are up to date with respect to the files on Google Cloud Storage.
Constructor Details
#initialize ⇒ StorageSync
Creates an instance of the Singleton StorageSync class with a background thread and asynchronous components to run methods asynchronously.
64 65 66 |
# File 'lib/google/cloud/gemserver/backend/storage_sync.rb', line 64 def initialize super end |
Class Method Details
.instance ⇒ Object
Delegate the run and download_service methods to the Singleton via .instance.
56 57 |
# File 'lib/google/cloud/gemserver/backend/storage_sync.rb', line 56 def_delegators :instance, :run, :upload_service, :download_service, :try_upload, :try_download, :file_changed? |
Instance Method Details
#run ⇒ Object
Runs a background gem files syncing service to ensure they are up to date with respect to the files on Google Cloud Storage. This allows allow the gem metadata on the gemserver (in the container) to persist in case of situations where the gemserver goes down.
73 74 75 |
# File 'lib/google/cloud/gemserver/backend/storage_sync.rb', line 73 def run async.sync end |