longleaf 0.2.0.pre.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +84 -0
- data/.gitignore +4 -2
- data/.rubocop.yml +42 -2
- data/.rubocop_todo.yml +390 -311
- data/.yardopts +1 -0
- data/Gemfile +16 -1
- data/README.md +67 -13
- data/Rakefile +6 -0
- data/bin/setup +16 -1
- data/docs/aboutlongleaf.md +28 -0
- data/docs/extra.css +32 -0
- data/docs/img/change-file.png +0 -0
- data/docs/img/ll-example-preserved.png +0 -0
- data/docs/index.md +19 -0
- data/docs/install.md +66 -0
- data/docs/ll-example/config-example-relative.yml +33 -0
- data/docs/ll-example/files-dir/LLexample-PDF.pdf +0 -0
- data/docs/ll-example/files-dir/LLexample-TOCHANGE.txt +15 -0
- data/docs/ll-example/files-dir/LLexample-tokeep.txt +10 -0
- data/docs/ll-example/metadata-dir/.gitkeep +0 -0
- data/docs/ll-example/replica-files/.gitkeep +0 -0
- data/docs/ll-example/replica-metadata/.gitkeep +0 -0
- data/docs/quickstart.md +270 -0
- data/docs/rdocs/Longleaf.html +135 -0
- data/docs/rdocs/Longleaf/AppFields.html +178 -0
- data/docs/rdocs/Longleaf/ApplicationConfigDeserializer.html +631 -0
- data/docs/rdocs/Longleaf/ApplicationConfigManager.html +610 -0
- data/docs/rdocs/Longleaf/ApplicationConfigValidator.html +238 -0
- data/docs/rdocs/Longleaf/CLI.html +909 -0
- data/docs/rdocs/Longleaf/ChecksumMismatchError.html +151 -0
- data/docs/rdocs/Longleaf/ConfigBuilder.html +1339 -0
- data/docs/rdocs/Longleaf/ConfigurationError.html +143 -0
- data/docs/rdocs/Longleaf/ConfigurationValidator.html +227 -0
- data/docs/rdocs/Longleaf/DeregisterCommand.html +420 -0
- data/docs/rdocs/Longleaf/DeregisterEvent.html +453 -0
- data/docs/rdocs/Longleaf/DeregistrationError.html +151 -0
- data/docs/rdocs/Longleaf/DigestHelper.html +419 -0
- data/docs/rdocs/Longleaf/EventError.html +147 -0
- data/docs/rdocs/Longleaf/EventNames.html +163 -0
- data/docs/rdocs/Longleaf/EventStatusTracking.html +656 -0
- data/docs/rdocs/Longleaf/FileCheckService.html +540 -0
- data/docs/rdocs/Longleaf/FileHelpers.html +520 -0
- data/docs/rdocs/Longleaf/FileRecord.html +716 -0
- data/docs/rdocs/Longleaf/FileSelector.html +901 -0
- data/docs/rdocs/Longleaf/FixityCheckService.html +691 -0
- data/docs/rdocs/Longleaf/IndexManager.html +1155 -0
- data/docs/rdocs/Longleaf/InvalidDigestAlgorithmError.html +143 -0
- data/docs/rdocs/Longleaf/InvalidStoragePathError.html +143 -0
- data/docs/rdocs/Longleaf/Logging.html +405 -0
- data/docs/rdocs/Longleaf/Logging/RedirectingLogger.html +1213 -0
- data/docs/rdocs/Longleaf/LongleafError.html +139 -0
- data/docs/rdocs/Longleaf/MDFields.html +193 -0
- data/docs/rdocs/Longleaf/MetadataBuilder.html +787 -0
- data/docs/rdocs/Longleaf/MetadataDeserializer.html +537 -0
- data/docs/rdocs/Longleaf/MetadataError.html +143 -0
- data/docs/rdocs/Longleaf/MetadataPersistenceManager.html +539 -0
- data/docs/rdocs/Longleaf/MetadataRecord.html +1411 -0
- data/docs/rdocs/Longleaf/MetadataSerializer.html +786 -0
- data/docs/rdocs/Longleaf/PreservationServiceError.html +147 -0
- data/docs/rdocs/Longleaf/PreserveCommand.html +410 -0
- data/docs/rdocs/Longleaf/PreserveEvent.html +491 -0
- data/docs/rdocs/Longleaf/RegisterCommand.html +428 -0
- data/docs/rdocs/Longleaf/RegisterEvent.html +628 -0
- data/docs/rdocs/Longleaf/RegisteredFileSelector.html +446 -0
- data/docs/rdocs/Longleaf/RegistrationError.html +151 -0
- data/docs/rdocs/Longleaf/ReindexCommand.html +576 -0
- data/docs/rdocs/Longleaf/RsyncReplicationService.html +1180 -0
- data/docs/rdocs/Longleaf/SequelIndexDriver.html +1978 -0
- data/docs/rdocs/Longleaf/ServiceCandidateFilesystemIterator.html +572 -0
- data/docs/rdocs/Longleaf/ServiceCandidateIndexIterator.html +532 -0
- data/docs/rdocs/Longleaf/ServiceCandidateLocator.html +333 -0
- data/docs/rdocs/Longleaf/ServiceClassCache.html +725 -0
- data/docs/rdocs/Longleaf/ServiceDateHelper.html +425 -0
- data/docs/rdocs/Longleaf/ServiceDefinition.html +683 -0
- data/docs/rdocs/Longleaf/ServiceDefinitionManager.html +371 -0
- data/docs/rdocs/Longleaf/ServiceDefinitionValidator.html +269 -0
- data/docs/rdocs/Longleaf/ServiceFields.html +173 -0
- data/docs/rdocs/Longleaf/ServiceManager.html +1229 -0
- data/docs/rdocs/Longleaf/ServiceMappingManager.html +410 -0
- data/docs/rdocs/Longleaf/ServiceMappingValidator.html +347 -0
- data/docs/rdocs/Longleaf/ServiceRecord.html +821 -0
- data/docs/rdocs/Longleaf/StorageLocation.html +985 -0
- data/docs/rdocs/Longleaf/StorageLocationManager.html +729 -0
- data/docs/rdocs/Longleaf/StorageLocationUnavailableError.html +143 -0
- data/docs/rdocs/Longleaf/StorageLocationValidator.html +373 -0
- data/docs/rdocs/Longleaf/StoragePathValidator.html +253 -0
- data/docs/rdocs/Longleaf/SystemConfigBuilder.html +441 -0
- data/docs/rdocs/Longleaf/SystemConfigFields.html +163 -0
- data/docs/rdocs/Longleaf/ValidateConfigCommand.html +451 -0
- data/docs/rdocs/Longleaf/ValidateMetadataCommand.html +408 -0
- data/docs/rdocs/_index.html +660 -0
- data/docs/rdocs/class_list.html +51 -0
- data/docs/rdocs/css/common.css +1 -0
- data/docs/rdocs/css/full_list.css +58 -0
- data/docs/rdocs/css/style.css +496 -0
- data/docs/rdocs/file.README.html +165 -0
- data/docs/rdocs/file_list.html +56 -0
- data/docs/rdocs/frames.html +17 -0
- data/docs/rdocs/index.html +165 -0
- data/docs/rdocs/js/app.js +303 -0
- data/docs/rdocs/js/full_list.js +216 -0
- data/docs/rdocs/js/jquery.js +4 -0
- data/docs/rdocs/method_list.html +2051 -0
- data/docs/rdocs/top-level-namespace.html +110 -0
- data/lib/longleaf/candidates/file_selector.rb +47 -15
- data/lib/longleaf/candidates/registered_file_selector.rb +67 -0
- data/lib/longleaf/candidates/service_candidate_filesystem_iterator.rb +29 -35
- data/lib/longleaf/candidates/service_candidate_index_iterator.rb +84 -0
- data/lib/longleaf/candidates/service_candidate_locator.rb +9 -4
- data/lib/longleaf/cli.rb +162 -80
- data/lib/longleaf/commands/deregister_command.rb +12 -11
- data/lib/longleaf/commands/preserve_command.rb +13 -8
- data/lib/longleaf/commands/register_command.rb +9 -6
- data/lib/longleaf/commands/reindex_command.rb +92 -0
- data/lib/longleaf/commands/validate_config_command.rb +27 -6
- data/lib/longleaf/commands/validate_metadata_command.rb +11 -9
- data/lib/longleaf/errors.rb +12 -12
- data/lib/longleaf/events/deregister_event.rb +13 -15
- data/lib/longleaf/events/event_status_tracking.rb +7 -7
- data/lib/longleaf/events/preserve_event.rb +24 -14
- data/lib/longleaf/events/register_event.rb +21 -35
- data/lib/longleaf/helpers/digest_helper.rb +4 -4
- data/lib/longleaf/helpers/service_date_helper.rb +5 -6
- data/lib/longleaf/indexing/index_manager.rb +101 -0
- data/lib/longleaf/indexing/sequel_index_driver.rb +324 -0
- data/lib/longleaf/logging.rb +4 -4
- data/lib/longleaf/logging/redirecting_logger.rb +20 -20
- data/lib/longleaf/models/app_fields.rb +2 -1
- data/lib/longleaf/models/file_record.rb +10 -6
- data/lib/longleaf/models/md_fields.rb +1 -1
- data/lib/longleaf/models/metadata_record.rb +22 -12
- data/lib/longleaf/models/service_definition.rb +3 -3
- data/lib/longleaf/models/service_fields.rb +1 -1
- data/lib/longleaf/models/service_record.rb +6 -5
- data/lib/longleaf/models/storage_location.rb +26 -7
- data/lib/longleaf/models/system_config_fields.rb +9 -0
- data/lib/longleaf/preservation_services/file_check_service.rb +58 -0
- data/lib/longleaf/preservation_services/fixity_check_service.rb +16 -14
- data/lib/longleaf/preservation_services/rsync_replication_service.rb +32 -31
- data/lib/longleaf/services/application_config_deserializer.rb +55 -18
- data/lib/longleaf/services/application_config_manager.rb +16 -4
- data/lib/longleaf/services/application_config_validator.rb +1 -2
- data/lib/longleaf/services/configuration_validator.rb +6 -4
- data/lib/longleaf/services/metadata_deserializer.rb +40 -38
- data/lib/longleaf/services/metadata_persistence_manager.rb +46 -0
- data/lib/longleaf/services/metadata_serializer.rb +23 -22
- data/lib/longleaf/services/service_class_cache.rb +15 -15
- data/lib/longleaf/services/service_definition_manager.rb +5 -6
- data/lib/longleaf/services/service_definition_validator.rb +5 -6
- data/lib/longleaf/services/service_manager.rb +37 -17
- data/lib/longleaf/services/service_mapping_manager.rb +9 -9
- data/lib/longleaf/services/service_mapping_validator.rb +9 -10
- data/lib/longleaf/services/storage_location_manager.rb +22 -8
- data/lib/longleaf/services/storage_location_validator.rb +11 -8
- data/lib/longleaf/services/storage_path_validator.rb +1 -1
- data/lib/longleaf/specs/config_builder.rb +30 -17
- data/lib/longleaf/specs/custom_matchers.rb +1 -1
- data/lib/longleaf/specs/file_helpers.rb +15 -14
- data/lib/longleaf/specs/metadata_builder.rb +91 -0
- data/lib/longleaf/specs/system_config_builder.rb +27 -0
- data/lib/longleaf/version.rb +1 -1
- data/longleaf.gemspec +17 -7
- data/mkdocs.yml +20 -0
- metadata +233 -22
|
@@ -0,0 +1,1180 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>
|
|
7
|
+
Class: Longleaf::RsyncReplicationService
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.19
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
pathId = "Longleaf::RsyncReplicationService";
|
|
19
|
+
relpath = '../';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="nav_wrap">
|
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
|
32
|
+
<div id="resizer"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main" tabindex="-1">
|
|
36
|
+
<div id="header">
|
|
37
|
+
<div id="menu">
|
|
38
|
+
|
|
39
|
+
<a href="../_index.html">Index (R)</a> »
|
|
40
|
+
<span class='title'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span>
|
|
41
|
+
»
|
|
42
|
+
<span class="title">RsyncReplicationService</span>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div id="search">
|
|
47
|
+
|
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
|
49
|
+
href="../class_list.html">
|
|
50
|
+
|
|
51
|
+
<svg width="24" height="24">
|
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
+
</svg>
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
<div class="clear"></div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div id="content"><h1>Class: Longleaf::RsyncReplicationService
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
<dl>
|
|
70
|
+
<dt>Inherits:</dt>
|
|
71
|
+
<dd>
|
|
72
|
+
<span class="inheritName">Object</span>
|
|
73
|
+
|
|
74
|
+
<ul class="fullTree">
|
|
75
|
+
<li>Object</li>
|
|
76
|
+
|
|
77
|
+
<li class="next">Longleaf::RsyncReplicationService</li>
|
|
78
|
+
|
|
79
|
+
</ul>
|
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
81
|
+
|
|
82
|
+
</dd>
|
|
83
|
+
</dl>
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
<dl>
|
|
91
|
+
<dt>Includes:</dt>
|
|
92
|
+
<dd><span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></dd>
|
|
93
|
+
</dl>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
<dl>
|
|
101
|
+
<dt>Defined in:</dt>
|
|
102
|
+
<dd>lib/longleaf/preservation_services/rsync_replication_service.rb</dd>
|
|
103
|
+
</dl>
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<h2>Overview</h2><div class="docstring">
|
|
108
|
+
<div class="discussion">
|
|
109
|
+
|
|
110
|
+
<p>Preservation service which performs replication of a file to one or more destinations using rsync.</p>
|
|
111
|
+
|
|
112
|
+
<p>The service definition must contain one or more destinations, specified with the “to” property. These destinations must be either a known storage location name, a remote path, or absolute path.</p>
|
|
113
|
+
|
|
114
|
+
<p>Optional service configuration properties:</p>
|
|
115
|
+
<ul><li>
|
|
116
|
+
<p>replica_collision_policy = specifies the desired outcome if the service attempts to replicate</p>
|
|
117
|
+
|
|
118
|
+
<pre class="code ruby"><code class="ruby">a file which already exists at a destination. Default: "replace".
|
|
119
|
+
</code></pre>
|
|
120
|
+
</li><li>
|
|
121
|
+
<p>rsync_command = the command to invoke in order to execute rsync. Default: “rsync”</p>
|
|
122
|
+
</li><li>
|
|
123
|
+
<p>rsync_options = additional parameters that will be passed along to rsync. Cannot include options</p>
|
|
124
|
+
|
|
125
|
+
<pre class="code ruby"><code class="ruby">which change the target of the command or prevent its execution, such as "files-from", "dry-run",
|
|
126
|
+
"help", etc. Command will always include "-R". Default "-a".
|
|
127
|
+
</code></pre>
|
|
128
|
+
</li></ul>
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
<div class="tags">
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<h2>
|
|
139
|
+
Constant Summary
|
|
140
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
|
141
|
+
</h2>
|
|
142
|
+
|
|
143
|
+
<dl class="constants">
|
|
144
|
+
|
|
145
|
+
<dt id="COLLISION_PROPERTY-constant" class="">COLLISION_PROPERTY =
|
|
146
|
+
|
|
147
|
+
</dt>
|
|
148
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>replica_collision_policy</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
149
|
+
|
|
150
|
+
<dt id="DEFAULT_COLLISION_POLICY-constant" class="">DEFAULT_COLLISION_POLICY =
|
|
151
|
+
|
|
152
|
+
</dt>
|
|
153
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>replace</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
154
|
+
|
|
155
|
+
<dt id="VALID_COLLISION_POLICIES-constant" class="">VALID_COLLISION_POLICIES =
|
|
156
|
+
|
|
157
|
+
</dt>
|
|
158
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>replace</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span></pre></dd>
|
|
159
|
+
|
|
160
|
+
<dt id="RSYNC_COMMAND_PROPERTY-constant" class="">RSYNC_COMMAND_PROPERTY =
|
|
161
|
+
|
|
162
|
+
</dt>
|
|
163
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rsync_command</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
164
|
+
|
|
165
|
+
<dt id="DEFAULT_COMMAND-constant" class="">DEFAULT_COMMAND =
|
|
166
|
+
|
|
167
|
+
</dt>
|
|
168
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rsync</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
169
|
+
|
|
170
|
+
<dt id="RSYNC_OPTIONS_PROPERTY-constant" class="">RSYNC_OPTIONS_PROPERTY =
|
|
171
|
+
|
|
172
|
+
</dt>
|
|
173
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rsync_options</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
174
|
+
|
|
175
|
+
<dt id="DEFAULT_OPTIONS-constant" class="">DEFAULT_OPTIONS =
|
|
176
|
+
|
|
177
|
+
</dt>
|
|
178
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>-a</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
179
|
+
|
|
180
|
+
<dt id="DISALLOWED_OPTIONS-constant" class="">DISALLOWED_OPTIONS =
|
|
181
|
+
|
|
182
|
+
</dt>
|
|
183
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>files-from</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>n</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>dry-run</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>exclude</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>exclude-from</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>cvs-exclude</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
|
184
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>h</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>help</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>f</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>F</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>filter</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span></pre></dd>
|
|
185
|
+
|
|
186
|
+
</dl>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
193
|
+
<ul class="summary">
|
|
194
|
+
|
|
195
|
+
<li class="public ">
|
|
196
|
+
<span class="summary_signature">
|
|
197
|
+
|
|
198
|
+
<a href="#collision_policy-instance_method" title="#collision_policy (instance method)">#<strong>collision_policy</strong> ⇒ Object </a>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
</span>
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
<span class="note title readonly">readonly</span>
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
<span class="summary_desc"><div class='inline'>
|
|
218
|
+
<p>Returns the value of attribute collision_policy.</p>
|
|
219
|
+
</div></span>
|
|
220
|
+
|
|
221
|
+
</li>
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
<li class="public ">
|
|
225
|
+
<span class="summary_signature">
|
|
226
|
+
|
|
227
|
+
<a href="#command-instance_method" title="#command (instance method)">#<strong>command</strong> ⇒ Object </a>
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
</span>
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
<span class="note title readonly">readonly</span>
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
<span class="summary_desc"><div class='inline'>
|
|
247
|
+
<p>Returns the value of attribute command.</p>
|
|
248
|
+
</div></span>
|
|
249
|
+
|
|
250
|
+
</li>
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
<li class="public ">
|
|
254
|
+
<span class="summary_signature">
|
|
255
|
+
|
|
256
|
+
<a href="#options-instance_method" title="#options (instance method)">#<strong>options</strong> ⇒ Object </a>
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
</span>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
<span class="note title readonly">readonly</span>
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
<span class="summary_desc"><div class='inline'>
|
|
276
|
+
<p>Returns the value of attribute options.</p>
|
|
277
|
+
</div></span>
|
|
278
|
+
|
|
279
|
+
</li>
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
</ul>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
<h2>
|
|
289
|
+
Instance Method Summary
|
|
290
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
291
|
+
</h2>
|
|
292
|
+
|
|
293
|
+
<ul class="summary">
|
|
294
|
+
|
|
295
|
+
<li class="private ">
|
|
296
|
+
<span class="summary_signature">
|
|
297
|
+
|
|
298
|
+
<a href="#contains_disallowed_option%3F-instance_method" title="#contains_disallowed_option? (instance method)">#<strong>contains_disallowed_option?</strong>(options) ⇒ Boolean </a>
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
</span>
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
<span class="note title private">private</span>
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
313
|
+
|
|
314
|
+
</li>
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
<li class="public ">
|
|
318
|
+
<span class="summary_signature">
|
|
319
|
+
|
|
320
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(service_def, app_manager) ⇒ RsyncReplicationService </a>
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
</span>
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
<span class="note title constructor">constructor</span>
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
<span class="summary_desc"><div class='inline'>
|
|
337
|
+
<p>Initialize a RsyncReplicationService from the given service definition.</p>
|
|
338
|
+
</div></span>
|
|
339
|
+
|
|
340
|
+
</li>
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
<li class="public ">
|
|
344
|
+
<span class="summary_signature">
|
|
345
|
+
|
|
346
|
+
<a href="#is_applicable%3F-instance_method" title="#is_applicable? (instance method)">#<strong>is_applicable?</strong>(event) ⇒ Boolean </a>
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
</span>
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
<span class="summary_desc"><div class='inline'>
|
|
361
|
+
<p>Determine if this service is applicable for the provided event, given the configured service definition.</p>
|
|
362
|
+
</div></span>
|
|
363
|
+
|
|
364
|
+
</li>
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
<li class="public ">
|
|
368
|
+
<span class="summary_signature">
|
|
369
|
+
|
|
370
|
+
<a href="#perform-instance_method" title="#perform (instance method)">#<strong>perform</strong>(file_rec, event) ⇒ Object </a>
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
</span>
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
<span class="summary_desc"><div class='inline'>
|
|
385
|
+
<p>During a replication event, perform replication of the specified file to all configured destinations as necessary.</p>
|
|
386
|
+
</div></span>
|
|
387
|
+
|
|
388
|
+
</li>
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
<li class="private ">
|
|
392
|
+
<span class="summary_signature">
|
|
393
|
+
|
|
394
|
+
<a href="#register_replica-instance_method" title="#register_replica (instance method)">#<strong>register_replica</strong>(destination, rel_path, file_rec) ⇒ Object </a>
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
</span>
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
<span class="note title private">private</span>
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
409
|
+
|
|
410
|
+
</li>
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
<li class="private ">
|
|
414
|
+
<span class="summary_signature">
|
|
415
|
+
|
|
416
|
+
<a href="#verify_destination_available-instance_method" title="#verify_destination_available (instance method)">#<strong>verify_destination_available</strong>(destination, file_rec) ⇒ Object </a>
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
</span>
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
<span class="note title private">private</span>
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
431
|
+
|
|
432
|
+
</li>
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
</ul>
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></h3>
|
|
448
|
+
<p class="inherited"><span class='object_link'><a href="Logging.html#initialize_logger-instance_method" title="Longleaf::Logging#initialize_logger (method)">#initialize_logger</a></span>, <span class='object_link'><a href="Logging.html#initialize_logger-class_method" title="Longleaf::Logging.initialize_logger (method)">initialize_logger</a></span>, <span class='object_link'><a href="Logging.html#logger-instance_method" title="Longleaf::Logging#logger (method)">#logger</a></span>, <span class='object_link'><a href="Logging.html#logger-class_method" title="Longleaf::Logging.logger (method)">logger</a></span></p>
|
|
449
|
+
<div id="constructor_details" class="method_details_list">
|
|
450
|
+
<h2>Constructor Details</h2>
|
|
451
|
+
|
|
452
|
+
<div class="method_details first">
|
|
453
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
454
|
+
|
|
455
|
+
#<strong>initialize</strong>(service_def, app_manager) ⇒ <tt><span class='object_link'><a href="" title="Longleaf::RsyncReplicationService (class)">RsyncReplicationService</a></span></tt>
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
</h3><div class="docstring">
|
|
462
|
+
<div class="discussion">
|
|
463
|
+
|
|
464
|
+
<p>Initialize a RsyncReplicationService from the given service definition</p>
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
<div class="tags">
|
|
470
|
+
<p class="tag_title">Parameters:</p>
|
|
471
|
+
<ul class="param">
|
|
472
|
+
|
|
473
|
+
<li>
|
|
474
|
+
|
|
475
|
+
<span class='name'>service_def</span>
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
<span class='type'>(<tt><span class='object_link'><a href="ServiceDefinition.html" title="Longleaf::ServiceDefinition (class)">ServiceDefinition</a></span></tt>)</span>
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
—
|
|
483
|
+
<div class='inline'>
|
|
484
|
+
<p>the configuration for this service</p>
|
|
485
|
+
</div>
|
|
486
|
+
|
|
487
|
+
</li>
|
|
488
|
+
|
|
489
|
+
<li>
|
|
490
|
+
|
|
491
|
+
<span class='name'>app_manager</span>
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
<span class='type'>(<tt><span class='object_link'><a href="ApplicationConfigManager.html" title="Longleaf::ApplicationConfigManager (class)">ApplicationConfigManager</a></span></tt>)</span>
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
—
|
|
499
|
+
<div class='inline'>
|
|
500
|
+
<p>the application configuration</p>
|
|
501
|
+
</div>
|
|
502
|
+
|
|
503
|
+
</li>
|
|
504
|
+
|
|
505
|
+
</ul>
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
</div><table class="source_code">
|
|
509
|
+
<tr>
|
|
510
|
+
<td>
|
|
511
|
+
<pre class="lines">
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
43
|
|
515
|
+
44
|
|
516
|
+
45
|
|
517
|
+
46
|
|
518
|
+
47
|
|
519
|
+
48
|
|
520
|
+
49
|
|
521
|
+
50
|
|
522
|
+
51
|
|
523
|
+
52
|
|
524
|
+
53
|
|
525
|
+
54
|
|
526
|
+
55
|
|
527
|
+
56
|
|
528
|
+
57
|
|
529
|
+
58
|
|
530
|
+
59
|
|
531
|
+
60
|
|
532
|
+
61
|
|
533
|
+
62
|
|
534
|
+
63
|
|
535
|
+
64
|
|
536
|
+
65
|
|
537
|
+
66
|
|
538
|
+
67
|
|
539
|
+
68
|
|
540
|
+
69
|
|
541
|
+
70
|
|
542
|
+
71
|
|
543
|
+
72
|
|
544
|
+
73
|
|
545
|
+
74
|
|
546
|
+
75
|
|
547
|
+
76
|
|
548
|
+
77
|
|
549
|
+
78
|
|
550
|
+
79
|
|
551
|
+
80
|
|
552
|
+
81
|
|
553
|
+
82
|
|
554
|
+
83
|
|
555
|
+
84
|
|
556
|
+
85
|
|
557
|
+
86
|
|
558
|
+
87
|
|
559
|
+
88
|
|
560
|
+
89</pre>
|
|
561
|
+
</td>
|
|
562
|
+
<td>
|
|
563
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/rsync_replication_service.rb', line 43</span>
|
|
564
|
+
|
|
565
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_service_def'>service_def</span><span class='comma'>,</span> <span class='id identifier rubyid_app_manager'>app_manager</span><span class='rparen'>)</span>
|
|
566
|
+
<span class='ivar'>@service_def</span> <span class='op'>=</span> <span class='id identifier rubyid_service_def'>service_def</span>
|
|
567
|
+
<span class='ivar'>@app_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_app_manager'>app_manager</span>
|
|
568
|
+
|
|
569
|
+
<span class='ivar'>@command</span> <span class='op'>=</span> <span class='ivar'>@service_def</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="#RSYNC_COMMAND_PROPERTY-constant" title="Longleaf::RsyncReplicationService::RSYNC_COMMAND_PROPERTY (constant)">RSYNC_COMMAND_PROPERTY</a></span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="#DEFAULT_COMMAND-constant" title="Longleaf::RsyncReplicationService::DEFAULT_COMMAND (constant)">DEFAULT_COMMAND</a></span></span>
|
|
570
|
+
|
|
571
|
+
<span class='comment'># Validate rsync parameters
|
|
572
|
+
</span> <span class='ivar'>@options</span> <span class='op'>=</span> <span class='ivar'>@service_def</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="#RSYNC_OPTIONS_PROPERTY-constant" title="Longleaf::RsyncReplicationService::RSYNC_OPTIONS_PROPERTY (constant)">RSYNC_OPTIONS_PROPERTY</a></span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="#DEFAULT_OPTIONS-constant" title="Longleaf::RsyncReplicationService::DEFAULT_OPTIONS (constant)">DEFAULT_OPTIONS</a></span></span>
|
|
573
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_contains_disallowed_option?'>contains_disallowed_option?</span><span class='lparen'>(</span><span class='ivar'>@options</span><span class='rparen'>)</span>
|
|
574
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Service </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service_def'>service_def</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> specifies a disallowed rsync paramter,</span><span class='tstring_end'>"</span></span> \
|
|
575
|
+
<span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> rsync_options may not include the following: </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="#DISALLOWED_OPTIONS-constant" title="Longleaf::RsyncReplicationService::DISALLOWED_OPTIONS (constant)">DISALLOWED_OPTIONS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
576
|
+
<span class='kw'>end</span>
|
|
577
|
+
|
|
578
|
+
<span class='comment'># Add -R (--relative) in to command options to ensure full path gets replicated
|
|
579
|
+
</span> <span class='ivar'>@options</span> <span class='op'>=</span> <span class='ivar'>@options</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> -R</span><span class='tstring_end'>"</span></span>
|
|
580
|
+
|
|
581
|
+
<span class='comment'># Set and validate the replica collision policy
|
|
582
|
+
</span> <span class='ivar'>@collision_policy</span> <span class='op'>=</span> <span class='ivar'>@service_def</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="#COLLISION_PROPERTY-constant" title="Longleaf::RsyncReplicationService::COLLISION_PROPERTY (constant)">COLLISION_PROPERTY</a></span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="#DEFAULT_COLLISION_POLICY-constant" title="Longleaf::RsyncReplicationService::DEFAULT_COLLISION_POLICY (constant)">DEFAULT_COLLISION_POLICY</a></span></span>
|
|
583
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='const'><span class='object_link'><a href="#VALID_COLLISION_POLICIES-constant" title="Longleaf::RsyncReplicationService::VALID_COLLISION_POLICIES (constant)">VALID_COLLISION_POLICIES</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='ivar'>@collision_policy</span><span class='rparen'>)</span>
|
|
584
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Service </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service_def'>service_def</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> received invalid </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="#COLLISION_PROPERTY-constant" title="Longleaf::RsyncReplicationService::COLLISION_PROPERTY (constant)">COLLISION_PROPERTY</a></span></span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> \
|
|
585
|
+
<span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> value </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_collision_policy'>collision_policy</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
586
|
+
<span class='kw'>end</span>
|
|
587
|
+
|
|
588
|
+
<span class='comment'># Store and validate destinations
|
|
589
|
+
</span> <span class='id identifier rubyid_replicate_to'>replicate_to</span> <span class='op'>=</span> <span class='ivar'>@service_def</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="ServiceFields.html" title="Longleaf::ServiceFields (class)">ServiceFields</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="ServiceFields.html#REPLICATE_TO-constant" title="Longleaf::ServiceFields::REPLICATE_TO (constant)">REPLICATE_TO</a></span></span><span class='rbracket'>]</span>
|
|
590
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_replicate_to'>replicate_to</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_replicate_to'>replicate_to</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
|
591
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Service </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service_def'>service_def</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> must provide one or more replication destinations.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
592
|
+
<span class='kw'>end</span>
|
|
593
|
+
<span class='id identifier rubyid_replicate_to'>replicate_to</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_replicate_to'>replicate_to</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_replicate_to'>replicate_to</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
594
|
+
|
|
595
|
+
<span class='id identifier rubyid_loc_manager'>loc_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_app_manager'>app_manager</span><span class='period'>.</span><span class='id identifier rubyid_location_manager'>location_manager</span>
|
|
596
|
+
<span class='comment'># Build list of destinations, translating to storage locations when relevant
|
|
597
|
+
</span> <span class='ivar'>@destinations</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
|
598
|
+
<span class='id identifier rubyid_replicate_to'>replicate_to</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_dest'>dest</span><span class='op'>|</span>
|
|
599
|
+
<span class='comment'># Assume that if destination contains a : or / it is a path rather than storage location
|
|
600
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_dest'>dest</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>[:\/]</span><span class='regexp_end'>/</span></span>
|
|
601
|
+
<span class='ivar'>@destinations</span> <span class='op'><<</span> <span class='id identifier rubyid_dest'>dest</span>
|
|
602
|
+
<span class='kw'>else</span>
|
|
603
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_loc_manager'>loc_manager</span><span class='period'>.</span><span class='id identifier rubyid_locations'>locations</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_dest'>dest</span><span class='rparen'>)</span>
|
|
604
|
+
<span class='ivar'>@destinations</span> <span class='op'><<</span> <span class='id identifier rubyid_loc_manager'>loc_manager</span><span class='period'>.</span><span class='id identifier rubyid_locations'>locations</span><span class='lbracket'>[</span><span class='id identifier rubyid_dest'>dest</span><span class='rbracket'>]</span>
|
|
605
|
+
<span class='kw'>else</span>
|
|
606
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Service </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service_def'>service_def</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'> specifies unknown storage location '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dest'>dest</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span> \
|
|
607
|
+
<span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> as a replication destination</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
608
|
+
<span class='kw'>end</span>
|
|
609
|
+
<span class='kw'>end</span>
|
|
610
|
+
<span class='kw'>end</span>
|
|
611
|
+
<span class='kw'>end</span></pre>
|
|
612
|
+
</td>
|
|
613
|
+
</tr>
|
|
614
|
+
</table>
|
|
615
|
+
</div>
|
|
616
|
+
|
|
617
|
+
</div>
|
|
618
|
+
|
|
619
|
+
<div id="instance_attr_details" class="attr_details">
|
|
620
|
+
<h2>Instance Attribute Details</h2>
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
<span id=""></span>
|
|
624
|
+
<div class="method_details first">
|
|
625
|
+
<h3 class="signature first" id="collision_policy-instance_method">
|
|
626
|
+
|
|
627
|
+
#<strong>collision_policy</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
</h3><div class="docstring">
|
|
634
|
+
<div class="discussion">
|
|
635
|
+
|
|
636
|
+
<p>Returns the value of attribute collision_policy</p>
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
</div>
|
|
640
|
+
</div>
|
|
641
|
+
<div class="tags">
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
</div><table class="source_code">
|
|
645
|
+
<tr>
|
|
646
|
+
<td>
|
|
647
|
+
<pre class="lines">
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
37
|
|
651
|
+
38
|
|
652
|
+
39</pre>
|
|
653
|
+
</td>
|
|
654
|
+
<td>
|
|
655
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/rsync_replication_service.rb', line 37</span>
|
|
656
|
+
|
|
657
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_collision_policy'>collision_policy</span>
|
|
658
|
+
<span class='ivar'>@collision_policy</span>
|
|
659
|
+
<span class='kw'>end</span></pre>
|
|
660
|
+
</td>
|
|
661
|
+
</tr>
|
|
662
|
+
</table>
|
|
663
|
+
</div>
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
<span id=""></span>
|
|
667
|
+
<div class="method_details ">
|
|
668
|
+
<h3 class="signature " id="command-instance_method">
|
|
669
|
+
|
|
670
|
+
#<strong>command</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
</h3><div class="docstring">
|
|
677
|
+
<div class="discussion">
|
|
678
|
+
|
|
679
|
+
<p>Returns the value of attribute command</p>
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
</div>
|
|
683
|
+
</div>
|
|
684
|
+
<div class="tags">
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
</div><table class="source_code">
|
|
688
|
+
<tr>
|
|
689
|
+
<td>
|
|
690
|
+
<pre class="lines">
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
37
|
|
694
|
+
38
|
|
695
|
+
39</pre>
|
|
696
|
+
</td>
|
|
697
|
+
<td>
|
|
698
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/rsync_replication_service.rb', line 37</span>
|
|
699
|
+
|
|
700
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_command'>command</span>
|
|
701
|
+
<span class='ivar'>@command</span>
|
|
702
|
+
<span class='kw'>end</span></pre>
|
|
703
|
+
</td>
|
|
704
|
+
</tr>
|
|
705
|
+
</table>
|
|
706
|
+
</div>
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
<span id=""></span>
|
|
710
|
+
<div class="method_details ">
|
|
711
|
+
<h3 class="signature " id="options-instance_method">
|
|
712
|
+
|
|
713
|
+
#<strong>options</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
</h3><div class="docstring">
|
|
720
|
+
<div class="discussion">
|
|
721
|
+
|
|
722
|
+
<p>Returns the value of attribute options</p>
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
</div>
|
|
726
|
+
</div>
|
|
727
|
+
<div class="tags">
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
</div><table class="source_code">
|
|
731
|
+
<tr>
|
|
732
|
+
<td>
|
|
733
|
+
<pre class="lines">
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
37
|
|
737
|
+
38
|
|
738
|
+
39</pre>
|
|
739
|
+
</td>
|
|
740
|
+
<td>
|
|
741
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/rsync_replication_service.rb', line 37</span>
|
|
742
|
+
|
|
743
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
|
|
744
|
+
<span class='ivar'>@options</span>
|
|
745
|
+
<span class='kw'>end</span></pre>
|
|
746
|
+
</td>
|
|
747
|
+
</tr>
|
|
748
|
+
</table>
|
|
749
|
+
</div>
|
|
750
|
+
|
|
751
|
+
</div>
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
<div id="instance_method_details" class="method_details_list">
|
|
755
|
+
<h2>Instance Method Details</h2>
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
<div class="method_details first">
|
|
759
|
+
<h3 class="signature first" id="contains_disallowed_option?-instance_method">
|
|
760
|
+
|
|
761
|
+
#<strong>contains_disallowed_option?</strong>(options) ⇒ <tt>Boolean</tt> <span class="extras">(private)</span>
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
</h3><div class="docstring">
|
|
768
|
+
<div class="discussion">
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
</div>
|
|
772
|
+
</div>
|
|
773
|
+
<div class="tags">
|
|
774
|
+
|
|
775
|
+
<p class="tag_title">Returns:</p>
|
|
776
|
+
<ul class="return">
|
|
777
|
+
|
|
778
|
+
<li>
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
</li>
|
|
786
|
+
|
|
787
|
+
</ul>
|
|
788
|
+
|
|
789
|
+
</div><table class="source_code">
|
|
790
|
+
<tr>
|
|
791
|
+
<td>
|
|
792
|
+
<pre class="lines">
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
143
|
|
796
|
+
144
|
|
797
|
+
145
|
|
798
|
+
146
|
|
799
|
+
147
|
|
800
|
+
148
|
|
801
|
+
149
|
|
802
|
+
150
|
|
803
|
+
151
|
|
804
|
+
152
|
|
805
|
+
153
|
|
806
|
+
154
|
|
807
|
+
155
|
|
808
|
+
156
|
|
809
|
+
157</pre>
|
|
810
|
+
</td>
|
|
811
|
+
<td>
|
|
812
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/rsync_replication_service.rb', line 143</span>
|
|
813
|
+
|
|
814
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_contains_disallowed_option?'>contains_disallowed_option?</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
815
|
+
<span class='const'><span class='object_link'><a href="#DISALLOWED_OPTIONS-constant" title="Longleaf::RsyncReplicationService::DISALLOWED_OPTIONS (constant)">DISALLOWED_OPTIONS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_disallowed'>disallowed</span><span class='op'>|</span>
|
|
816
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_disallowed'>disallowed</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span>
|
|
817
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(\A| )-[a-zA-Z0-9]*</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_disallowed'>disallowed</span><span class='embexpr_end'>}</span><span class='tstring_content'>[a-zA-Z0-9]*( |=|\z)</span><span class='regexp_end'>/</span></span>
|
|
818
|
+
<span class='kw'>return</span> <span class='kw'>true</span>
|
|
819
|
+
<span class='kw'>end</span>
|
|
820
|
+
<span class='kw'>else</span>
|
|
821
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(\A| )--</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_disallowed'>disallowed</span><span class='embexpr_end'>}</span><span class='tstring_content'>( |=|\z)</span><span class='regexp_end'>/</span></span>
|
|
822
|
+
<span class='kw'>return</span> <span class='kw'>true</span>
|
|
823
|
+
<span class='kw'>end</span>
|
|
824
|
+
<span class='kw'>end</span>
|
|
825
|
+
<span class='kw'>end</span>
|
|
826
|
+
|
|
827
|
+
<span class='kw'>false</span>
|
|
828
|
+
<span class='kw'>end</span></pre>
|
|
829
|
+
</td>
|
|
830
|
+
</tr>
|
|
831
|
+
</table>
|
|
832
|
+
</div>
|
|
833
|
+
|
|
834
|
+
<div class="method_details ">
|
|
835
|
+
<h3 class="signature " id="is_applicable?-instance_method">
|
|
836
|
+
|
|
837
|
+
#<strong>is_applicable?</strong>(event) ⇒ <tt>Boolean</tt>
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
</h3><div class="docstring">
|
|
844
|
+
<div class="discussion">
|
|
845
|
+
|
|
846
|
+
<p>Determine if this service is applicable for the provided event, given the configured service definition</p>
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
</div>
|
|
850
|
+
</div>
|
|
851
|
+
<div class="tags">
|
|
852
|
+
<p class="tag_title">Parameters:</p>
|
|
853
|
+
<ul class="param">
|
|
854
|
+
|
|
855
|
+
<li>
|
|
856
|
+
|
|
857
|
+
<span class='name'>event</span>
|
|
858
|
+
|
|
859
|
+
|
|
860
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
—
|
|
865
|
+
<div class='inline'>
|
|
866
|
+
<p>name of the event</p>
|
|
867
|
+
</div>
|
|
868
|
+
|
|
869
|
+
</li>
|
|
870
|
+
|
|
871
|
+
</ul>
|
|
872
|
+
|
|
873
|
+
<p class="tag_title">Returns:</p>
|
|
874
|
+
<ul class="return">
|
|
875
|
+
|
|
876
|
+
<li>
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
—
|
|
884
|
+
<div class='inline'>
|
|
885
|
+
<p>returns true if this service is applicable for the provided event</p>
|
|
886
|
+
</div>
|
|
887
|
+
|
|
888
|
+
</li>
|
|
889
|
+
|
|
890
|
+
</ul>
|
|
891
|
+
|
|
892
|
+
</div><table class="source_code">
|
|
893
|
+
<tr>
|
|
894
|
+
<td>
|
|
895
|
+
<pre class="lines">
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
133
|
|
899
|
+
134
|
|
900
|
+
135
|
|
901
|
+
136
|
|
902
|
+
137
|
|
903
|
+
138
|
|
904
|
+
139
|
|
905
|
+
140</pre>
|
|
906
|
+
</td>
|
|
907
|
+
<td>
|
|
908
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/rsync_replication_service.rb', line 133</span>
|
|
909
|
+
|
|
910
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_applicable?'>is_applicable?</span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
|
|
911
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_event'>event</span>
|
|
912
|
+
<span class='kw'>when</span> <span class='const'><span class='object_link'><a href="EventNames.html" title="Longleaf::EventNames (class)">EventNames</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="EventNames.html#PRESERVE-constant" title="Longleaf::EventNames::PRESERVE (constant)">PRESERVE</a></span></span>
|
|
913
|
+
<span class='kw'>true</span>
|
|
914
|
+
<span class='kw'>else</span>
|
|
915
|
+
<span class='kw'>false</span>
|
|
916
|
+
<span class='kw'>end</span>
|
|
917
|
+
<span class='kw'>end</span></pre>
|
|
918
|
+
</td>
|
|
919
|
+
</tr>
|
|
920
|
+
</table>
|
|
921
|
+
</div>
|
|
922
|
+
|
|
923
|
+
<div class="method_details ">
|
|
924
|
+
<h3 class="signature " id="perform-instance_method">
|
|
925
|
+
|
|
926
|
+
#<strong>perform</strong>(file_rec, event) ⇒ <tt>Object</tt>
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
</h3><div class="docstring">
|
|
933
|
+
<div class="discussion">
|
|
934
|
+
|
|
935
|
+
<p>During a replication event, perform replication of the specified file to all configured destinations as necessary.</p>
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
</div>
|
|
939
|
+
</div>
|
|
940
|
+
<div class="tags">
|
|
941
|
+
<p class="tag_title">Parameters:</p>
|
|
942
|
+
<ul class="param">
|
|
943
|
+
|
|
944
|
+
<li>
|
|
945
|
+
|
|
946
|
+
<span class='name'>file_rec</span>
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
<span class='type'>(<tt><span class='object_link'><a href="FileRecord.html" title="Longleaf::FileRecord (class)">FileRecord</a></span></tt>)</span>
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
—
|
|
954
|
+
<div class='inline'>
|
|
955
|
+
<p>record representing the file to perform the service on.</p>
|
|
956
|
+
</div>
|
|
957
|
+
|
|
958
|
+
</li>
|
|
959
|
+
|
|
960
|
+
<li>
|
|
961
|
+
|
|
962
|
+
<span class='name'>event</span>
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
—
|
|
970
|
+
<div class='inline'>
|
|
971
|
+
<p>name of the event this service is being invoked by.</p>
|
|
972
|
+
</div>
|
|
973
|
+
|
|
974
|
+
</li>
|
|
975
|
+
|
|
976
|
+
</ul>
|
|
977
|
+
|
|
978
|
+
<p class="tag_title">Raises:</p>
|
|
979
|
+
<ul class="raise">
|
|
980
|
+
|
|
981
|
+
<li>
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
<span class='type'>(<tt><span class='object_link'><a href="PreservationServiceError.html" title="Longleaf::PreservationServiceError (class)">PreservationServiceError</a></span></tt>)</span>
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
—
|
|
989
|
+
<div class='inline'>
|
|
990
|
+
<p>if the rsync replication fails</p>
|
|
991
|
+
</div>
|
|
992
|
+
|
|
993
|
+
</li>
|
|
994
|
+
|
|
995
|
+
</ul>
|
|
996
|
+
|
|
997
|
+
</div><table class="source_code">
|
|
998
|
+
<tr>
|
|
999
|
+
<td>
|
|
1000
|
+
<pre class="lines">
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
97
|
|
1004
|
+
98
|
|
1005
|
+
99
|
|
1006
|
+
100
|
|
1007
|
+
101
|
|
1008
|
+
102
|
|
1009
|
+
103
|
|
1010
|
+
104
|
|
1011
|
+
105
|
|
1012
|
+
106
|
|
1013
|
+
107
|
|
1014
|
+
108
|
|
1015
|
+
109
|
|
1016
|
+
110
|
|
1017
|
+
111
|
|
1018
|
+
112
|
|
1019
|
+
113
|
|
1020
|
+
114
|
|
1021
|
+
115
|
|
1022
|
+
116
|
|
1023
|
+
117
|
|
1024
|
+
118
|
|
1025
|
+
119
|
|
1026
|
+
120
|
|
1027
|
+
121
|
|
1028
|
+
122
|
|
1029
|
+
123
|
|
1030
|
+
124
|
|
1031
|
+
125
|
|
1032
|
+
126
|
|
1033
|
+
127</pre>
|
|
1034
|
+
</td>
|
|
1035
|
+
<td>
|
|
1036
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/rsync_replication_service.rb', line 97</span>
|
|
1037
|
+
|
|
1038
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='comma'>,</span> <span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
|
|
1039
|
+
<span class='ivar'>@destinations</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_destination'>destination</span><span class='op'>|</span>
|
|
1040
|
+
<span class='id identifier rubyid_dest_is_storage_loc'>dest_is_storage_loc</span> <span class='op'>=</span> <span class='id identifier rubyid_destination'>destination</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">StorageLocation</a></span></span><span class='rparen'>)</span>
|
|
1041
|
+
|
|
1042
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_dest_is_storage_loc'>dest_is_storage_loc</span>
|
|
1043
|
+
<span class='id identifier rubyid_dest_path'>dest_path</span> <span class='op'>=</span> <span class='id identifier rubyid_destination'>destination</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span>
|
|
1044
|
+
<span class='kw'>else</span>
|
|
1045
|
+
<span class='id identifier rubyid_dest_path'>dest_path</span> <span class='op'>=</span> <span class='id identifier rubyid_destination'>destination</span>
|
|
1046
|
+
<span class='kw'>end</span>
|
|
1047
|
+
|
|
1048
|
+
<span class='comment'># Determine the path to the file being replicated relative to its storage location
|
|
1049
|
+
</span> <span class='id identifier rubyid_rel_path'>rel_path</span> <span class='op'>=</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_sub'>sub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_storage_location'>storage_location</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
1050
|
+
<span class='comment'># source path with . so that rsync will only create destination directories starting from that point
|
|
1051
|
+
</span> <span class='id identifier rubyid_source_path'>source_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_storage_location'>storage_location</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>./</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_rel_path'>rel_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
1052
|
+
|
|
1053
|
+
<span class='comment'># Check that the destination is available because attempting to write
|
|
1054
|
+
</span> <span class='id identifier rubyid_verify_destination_available'>verify_destination_available</span><span class='lparen'>(</span><span class='id identifier rubyid_destination'>destination</span><span class='comma'>,</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='rparen'>)</span>
|
|
1055
|
+
|
|
1056
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invoking rsync with command: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@command</span><span class='embexpr_end'>}</span><span class='tstring_content'> \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_source_path'>source_path</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dest_path'>dest_path</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" </span><span class='embexpr_beg'>#{</span><span class='ivar'>@options</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
1057
|
+
<span class='id identifier rubyid_stdout'>stdout</span><span class='comma'>,</span> <span class='id identifier rubyid_stderr'>stderr</span><span class='comma'>,</span> <span class='id identifier rubyid_status'>status</span> <span class='op'>=</span> <span class='const'>Open3</span><span class='period'>.</span><span class='id identifier rubyid_capture3'>capture3</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='ivar'>@command</span><span class='embexpr_end'>}</span><span class='tstring_content'> \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_source_path'>source_path</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" \"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dest_path'>dest_path</span><span class='embexpr_end'>}</span><span class='tstring_content'>\" </span><span class='embexpr_beg'>#{</span><span class='ivar'>@options</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
1058
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="PreservationServiceError.html" title="Longleaf::PreservationServiceError (class)">PreservationServiceError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Failed to replicate </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'> to </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dest_path'>dest_path</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_stderr'>stderr</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> \
|
|
1059
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_status'>status</span><span class='period'>.</span><span class='id identifier rubyid_success?'>success?</span>
|
|
1060
|
+
|
|
1061
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Replicated </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'> to destination </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_dest_path'>dest_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
1062
|
+
|
|
1063
|
+
<span class='comment'># For destinations which are storage locations, register the replica with longleaf
|
|
1064
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_dest_is_storage_loc'>dest_is_storage_loc</span>
|
|
1065
|
+
<span class='id identifier rubyid_register_replica'>register_replica</span><span class='lparen'>(</span><span class='id identifier rubyid_destination'>destination</span><span class='comma'>,</span> <span class='id identifier rubyid_rel_path'>rel_path</span><span class='comma'>,</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='rparen'>)</span>
|
|
1066
|
+
<span class='kw'>end</span>
|
|
1067
|
+
<span class='kw'>end</span>
|
|
1068
|
+
<span class='kw'>end</span></pre>
|
|
1069
|
+
</td>
|
|
1070
|
+
</tr>
|
|
1071
|
+
</table>
|
|
1072
|
+
</div>
|
|
1073
|
+
|
|
1074
|
+
<div class="method_details ">
|
|
1075
|
+
<h3 class="signature " id="register_replica-instance_method">
|
|
1076
|
+
|
|
1077
|
+
#<strong>register_replica</strong>(destination, rel_path, file_rec) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
|
1078
|
+
|
|
1079
|
+
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
</h3><table class="source_code">
|
|
1084
|
+
<tr>
|
|
1085
|
+
<td>
|
|
1086
|
+
<pre class="lines">
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
173
|
|
1090
|
+
174
|
|
1091
|
+
175
|
|
1092
|
+
176
|
|
1093
|
+
177
|
|
1094
|
+
178
|
|
1095
|
+
179
|
|
1096
|
+
180
|
|
1097
|
+
181
|
|
1098
|
+
182</pre>
|
|
1099
|
+
</td>
|
|
1100
|
+
<td>
|
|
1101
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/rsync_replication_service.rb', line 173</span>
|
|
1102
|
+
|
|
1103
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_register_replica'>register_replica</span><span class='lparen'>(</span><span class='id identifier rubyid_destination'>destination</span><span class='comma'>,</span> <span class='id identifier rubyid_rel_path'>rel_path</span><span class='comma'>,</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='rparen'>)</span>
|
|
1104
|
+
<span class='id identifier rubyid_dest_file_path'>dest_file_path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_destination'>destination</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_rel_path'>rel_path</span><span class='rparen'>)</span>
|
|
1105
|
+
<span class='id identifier rubyid_dest_file_rec'>dest_file_rec</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="FileRecord.html" title="Longleaf::FileRecord (class)">FileRecord</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="FileRecord.html#initialize-instance_method" title="Longleaf::FileRecord#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_dest_file_path'>dest_file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_destination'>destination</span><span class='rparen'>)</span>
|
|
1106
|
+
|
|
1107
|
+
<span class='id identifier rubyid_register_event'>register_event</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="RegisterEvent.html" title="Longleaf::RegisterEvent (class)">RegisterEvent</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RegisterEvent.html#initialize-instance_method" title="Longleaf::RegisterEvent#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>file_rec:</span> <span class='id identifier rubyid_dest_file_rec'>dest_file_rec</span><span class='comma'>,</span>
|
|
1108
|
+
<span class='label'>app_manager:</span> <span class='ivar'>@app_manager</span><span class='comma'>,</span>
|
|
1109
|
+
<span class='label'>force:</span> <span class='kw'>true</span><span class='comma'>,</span>
|
|
1110
|
+
<span class='label'>checksums:</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_metadata_record'>metadata_record</span><span class='period'>.</span><span class='id identifier rubyid_checksums'>checksums</span><span class='rparen'>)</span>
|
|
1111
|
+
<span class='id identifier rubyid_register_event'>register_event</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span>
|
|
1112
|
+
<span class='kw'>end</span></pre>
|
|
1113
|
+
</td>
|
|
1114
|
+
</tr>
|
|
1115
|
+
</table>
|
|
1116
|
+
</div>
|
|
1117
|
+
|
|
1118
|
+
<div class="method_details ">
|
|
1119
|
+
<h3 class="signature " id="verify_destination_available-instance_method">
|
|
1120
|
+
|
|
1121
|
+
#<strong>verify_destination_available</strong>(destination, file_rec) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
</h3><table class="source_code">
|
|
1128
|
+
<tr>
|
|
1129
|
+
<td>
|
|
1130
|
+
<pre class="lines">
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
159
|
|
1134
|
+
160
|
|
1135
|
+
161
|
|
1136
|
+
162
|
|
1137
|
+
163
|
|
1138
|
+
164
|
|
1139
|
+
165
|
|
1140
|
+
166
|
|
1141
|
+
167
|
|
1142
|
+
168
|
|
1143
|
+
169
|
|
1144
|
+
170
|
|
1145
|
+
171</pre>
|
|
1146
|
+
</td>
|
|
1147
|
+
<td>
|
|
1148
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/rsync_replication_service.rb', line 159</span>
|
|
1149
|
+
|
|
1150
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_verify_destination_available'>verify_destination_available</span><span class='lparen'>(</span><span class='id identifier rubyid_destination'>destination</span><span class='comma'>,</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='rparen'>)</span>
|
|
1151
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_destination'>destination</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">StorageLocation</a></span></span><span class='rparen'>)</span>
|
|
1152
|
+
<span class='kw'>begin</span>
|
|
1153
|
+
<span class='id identifier rubyid_destination'>destination</span><span class='period'>.</span><span class='id identifier rubyid_available?'>available?</span>
|
|
1154
|
+
<span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="StorageLocationUnavailableError.html" title="Longleaf::StorageLocationUnavailableError (class)">StorageLocationUnavailableError</a></span></span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
|
1155
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="StorageLocationUnavailableError.html" title="Longleaf::StorageLocationUnavailableError (class)">StorageLocationUnavailableError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Cannot replicate </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'> to destination </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_destination'>destination</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='tstring_end'>"</span></span> \
|
|
1156
|
+
<span class='op'>+</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
|
|
1157
|
+
<span class='kw'>end</span>
|
|
1158
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_destination'>destination</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
1159
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="StorageLocationUnavailableError.html" title="Longleaf::StorageLocationUnavailableError (class)">StorageLocationUnavailableError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Cannot replicate </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'> to destination</span><span class='tstring_end'>"</span></span> \
|
|
1160
|
+
<span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_destination'>destination</span><span class='embexpr_end'>}</span><span class='tstring_content'>, path does not exist.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_destination'>destination</span><span class='rparen'>)</span>
|
|
1161
|
+
<span class='kw'>end</span>
|
|
1162
|
+
<span class='kw'>end</span></pre>
|
|
1163
|
+
</td>
|
|
1164
|
+
</tr>
|
|
1165
|
+
</table>
|
|
1166
|
+
</div>
|
|
1167
|
+
|
|
1168
|
+
</div>
|
|
1169
|
+
|
|
1170
|
+
</div>
|
|
1171
|
+
|
|
1172
|
+
<div id="footer">
|
|
1173
|
+
Generated on Tue May 28 15:48:03 2019 by
|
|
1174
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1175
|
+
0.9.19 (ruby-2.6.3).
|
|
1176
|
+
</div>
|
|
1177
|
+
|
|
1178
|
+
</div>
|
|
1179
|
+
</body>
|
|
1180
|
+
</html>
|