Class: Backup::Syncer::Cloud::Base
- Defined in:
- lib/backup/syncer/cloud/base.rb
Direct Known Subclasses
Defined Under Namespace
Classes: LocalFile, SyncContext
Constant Summary collapse
- MUTEX =
Create a Mutex to synchronize certain parts of the code in order to prevent race conditions or broken STDOUT.
Mutex.new
Constants included from CLI::Helpers
Instance Attribute Summary collapse
-
#concurrency_level ⇒ Object
Concurrency level - the number of threads or processors to use.
-
#concurrency_type ⇒ Object
Concurrency setting - defaults to false, but can be set to: - :threads - :processes.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
Instantiates a new Cloud Syncer object for either the Cloud::S3 or Cloud::CloudFiles Syncer.
-
#perform! ⇒ Object
Performs the Sync operation.
Methods inherited from Base
Methods included from Configuration::Helpers
Constructor Details
#initialize ⇒ Base
Instantiates a new Cloud Syncer object for either the Cloud::S3 or Cloud::CloudFiles Syncer.
Pre-configured defaults specified in either Configuration::Syncer::Cloud::S3 or Configuration::Syncer::Cloud::CloudFiles are set via a super() call to Syncer::Base.
If not specified in the pre-configured defaults, the Cloud specific defaults are set here before evaluating any block provided in the user’s configuration file.
42 43 44 45 46 47 |
# File 'lib/backup/syncer/cloud/base.rb', line 42 def initialize super @concurrency_type ||= false @concurrency_level ||= 2 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Backup::Configuration::Helpers
Instance Attribute Details
#concurrency_level ⇒ Object
Concurrency level - the number of threads or processors to use. Defaults to 2.
28 29 30 |
# File 'lib/backup/syncer/cloud/base.rb', line 28 def concurrency_level @concurrency_level end |
#concurrency_type ⇒ Object
Concurrency setting - defaults to false, but can be set to:
-
:threads
-
:processes
23 24 25 |
# File 'lib/backup/syncer/cloud/base.rb', line 23 def concurrency_type @concurrency_type end |
Instance Method Details
#perform! ⇒ Object
Performs the Sync operation
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/backup/syncer/cloud/base.rb', line 51 def perform! Logger.( "#{ syncer_name } started the syncing process:\n" + "\s\sConcurrency: #{ @concurrency_type } Level: #{ @concurrency_level }" ) @directories.each do |directory| SyncContext.new( File.(directory), repository_object, @path ).sync! @mirror, @concurrency_type, @concurrency_level end Logger.("#{ syncer_name } Syncing Complete!") end |