longleaf 0.1.0.pre.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +94 -0
- data/.editorconfig +13 -0
- data/.gitignore +4 -1
- data/.rubocop.yml +44 -0
- data/.rubocop_todo.yml +834 -0
- data/.yardopts +1 -0
- data/Gemfile +16 -1
- data/README.md +98 -12
- 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 +150 -0
- data/lib/longleaf/candidates/manifest_digest_provider.rb +17 -0
- data/lib/longleaf/candidates/physical_path_provider.rb +17 -0
- data/lib/longleaf/candidates/registered_file_selector.rb +67 -0
- data/lib/longleaf/candidates/service_candidate_filesystem_iterator.rb +93 -0
- data/lib/longleaf/candidates/service_candidate_index_iterator.rb +84 -0
- data/lib/longleaf/candidates/service_candidate_locator.rb +23 -0
- data/lib/longleaf/candidates/single_digest_provider.rb +13 -0
- data/lib/longleaf/cli.rb +249 -44
- data/lib/longleaf/commands/deregister_command.rb +51 -0
- data/lib/longleaf/commands/preserve_command.rb +50 -0
- data/lib/longleaf/commands/register_command.rb +34 -43
- data/lib/longleaf/commands/reindex_command.rb +92 -0
- data/lib/longleaf/commands/validate_config_command.rb +33 -8
- data/lib/longleaf/commands/validate_metadata_command.rb +51 -0
- data/lib/longleaf/errors.rb +26 -7
- data/lib/longleaf/events/deregister_event.rb +53 -0
- data/lib/longleaf/events/event_names.rb +9 -0
- data/lib/longleaf/events/event_status_tracking.rb +59 -0
- data/lib/longleaf/events/preserve_event.rb +82 -0
- data/lib/longleaf/events/register_event.rb +59 -51
- data/lib/longleaf/helpers/case_insensitive_hash.rb +38 -0
- data/lib/longleaf/helpers/digest_helper.rb +56 -0
- data/lib/longleaf/helpers/s3_uri_helper.rb +86 -0
- data/lib/longleaf/helpers/selection_options_parser.rb +215 -0
- data/lib/longleaf/helpers/service_date_helper.rb +78 -0
- data/lib/longleaf/indexing/index_manager.rb +101 -0
- data/lib/longleaf/indexing/sequel_index_driver.rb +306 -0
- data/lib/longleaf/logging.rb +5 -4
- data/lib/longleaf/logging/redirecting_logger.rb +30 -25
- data/lib/longleaf/models/app_fields.rb +7 -2
- data/lib/longleaf/models/file_record.rb +31 -8
- data/lib/longleaf/models/filesystem_metadata_location.rb +56 -0
- data/lib/longleaf/models/filesystem_storage_location.rb +52 -0
- data/lib/longleaf/models/md_fields.rb +3 -1
- data/lib/longleaf/models/metadata_location.rb +47 -0
- data/lib/longleaf/models/metadata_record.rb +43 -16
- data/lib/longleaf/models/s3_storage_location.rb +138 -0
- data/lib/longleaf/models/service_definition.rb +7 -6
- data/lib/longleaf/models/service_fields.rb +7 -1
- data/lib/longleaf/models/service_record.rb +10 -6
- data/lib/longleaf/models/storage_location.rb +24 -21
- data/lib/longleaf/models/storage_types.rb +9 -0
- data/lib/longleaf/models/system_config_fields.rb +9 -0
- data/lib/longleaf/preservation_services/file_check_service.rb +59 -0
- data/lib/longleaf/preservation_services/fixity_check_service.rb +124 -0
- data/lib/longleaf/preservation_services/rsync_replication_service.rb +198 -0
- data/lib/longleaf/preservation_services/s3_replication_service.rb +131 -0
- data/lib/longleaf/services/application_config_deserializer.rb +80 -21
- data/lib/longleaf/services/application_config_manager.rb +20 -6
- data/lib/longleaf/services/application_config_validator.rb +19 -9
- data/lib/longleaf/services/configuration_validator.rb +67 -4
- data/lib/longleaf/services/filesystem_location_validator.rb +16 -0
- data/lib/longleaf/services/metadata_deserializer.rb +115 -42
- data/lib/longleaf/services/metadata_persistence_manager.rb +47 -0
- data/lib/longleaf/services/metadata_serializer.rb +139 -25
- data/lib/longleaf/services/metadata_validator.rb +76 -0
- data/lib/longleaf/services/s3_location_validator.rb +19 -0
- data/lib/longleaf/services/service_class_cache.rb +112 -0
- data/lib/longleaf/services/service_definition_manager.rb +10 -7
- data/lib/longleaf/services/service_definition_validator.rb +25 -18
- data/lib/longleaf/services/service_manager.rb +86 -11
- data/lib/longleaf/services/service_mapping_manager.rb +13 -12
- data/lib/longleaf/services/service_mapping_validator.rb +36 -26
- data/lib/longleaf/services/storage_location_manager.rb +76 -15
- data/lib/longleaf/services/storage_location_validator.rb +49 -35
- data/lib/longleaf/specs/config_builder.rb +47 -23
- data/lib/longleaf/specs/config_validator_helpers.rb +16 -0
- data/lib/longleaf/specs/custom_matchers.rb +9 -0
- data/lib/longleaf/specs/file_helpers.rb +61 -0
- data/lib/longleaf/specs/metadata_builder.rb +98 -0
- data/lib/longleaf/specs/system_config_builder.rb +27 -0
- data/lib/longleaf/version.rb +1 -1
- data/longleaf.gemspec +20 -7
- data/mkdocs.yml +21 -0
- metadata +310 -26
- data/.travis.yml +0 -4
- data/lib/longleaf/commands/abstract_command.rb +0 -37
- data/lib/longleaf/services/storage_path_validator.rb +0 -16
@@ -0,0 +1,985 @@
|
|
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::StorageLocation
|
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::StorageLocation";
|
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 (S)</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">StorageLocation</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::StorageLocation
|
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::StorageLocation</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/longleaf/models/storage_location.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>Representation of a configured storage location</p>
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div class="tags">
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
118
|
+
<ul class="summary">
|
119
|
+
|
120
|
+
<li class="public ">
|
121
|
+
<span class="summary_signature">
|
122
|
+
|
123
|
+
<a href="#metadata_digests-instance_method" title="#metadata_digests (instance method)">#<strong>metadata_digests</strong> ⇒ Object </a>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</span>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<span class="note title readonly">readonly</span>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<span class="summary_desc"><div class='inline'>
|
143
|
+
<p>Returns the value of attribute metadata_digests.</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#metadata_path-instance_method" title="#metadata_path (instance method)">#<strong>metadata_path</strong> ⇒ Object </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<span class="note title readonly">readonly</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
172
|
+
<p>Returns the value of attribute metadata_path.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
<li class="public ">
|
179
|
+
<span class="summary_signature">
|
180
|
+
|
181
|
+
<a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> ⇒ Object </a>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</span>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<span class="note title readonly">readonly</span>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<span class="summary_desc"><div class='inline'>
|
201
|
+
<p>Returns the value of attribute name.</p>
|
202
|
+
</div></span>
|
203
|
+
|
204
|
+
</li>
|
205
|
+
|
206
|
+
|
207
|
+
<li class="public ">
|
208
|
+
<span class="summary_signature">
|
209
|
+
|
210
|
+
<a href="#path-instance_method" title="#path (instance method)">#<strong>path</strong> ⇒ Object </a>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
</span>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<span class="note title readonly">readonly</span>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<span class="summary_desc"><div class='inline'>
|
230
|
+
<p>Returns the value of attribute path.</p>
|
231
|
+
</div></span>
|
232
|
+
|
233
|
+
</li>
|
234
|
+
|
235
|
+
|
236
|
+
</ul>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<h2>
|
243
|
+
Instance Method Summary
|
244
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
245
|
+
</h2>
|
246
|
+
|
247
|
+
<ul class="summary">
|
248
|
+
|
249
|
+
<li class="public ">
|
250
|
+
<span class="summary_signature">
|
251
|
+
|
252
|
+
<a href="#available%3F-instance_method" title="#available? (instance method)">#<strong>available?</strong> ⇒ Boolean </a>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
</span>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<span class="summary_desc"><div class='inline'>
|
267
|
+
<p>Checks that the path and metadata path defined in this location are available.</p>
|
268
|
+
</div></span>
|
269
|
+
|
270
|
+
</li>
|
271
|
+
|
272
|
+
|
273
|
+
<li class="public ">
|
274
|
+
<span class="summary_signature">
|
275
|
+
|
276
|
+
<a href="#get_metadata_path_for-instance_method" title="#get_metadata_path_for (instance method)">#<strong>get_metadata_path_for</strong>(file_path) ⇒ Object </a>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
</span>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
<span class="summary_desc"><div class='inline'>
|
291
|
+
<p>Get the path for the metadata file for the given file path located in this storage location.</p>
|
292
|
+
</div></span>
|
293
|
+
|
294
|
+
</li>
|
295
|
+
|
296
|
+
|
297
|
+
<li class="public ">
|
298
|
+
<span class="summary_signature">
|
299
|
+
|
300
|
+
<a href="#get_path_from_metadata_path-instance_method" title="#get_path_from_metadata_path (instance method)">#<strong>get_path_from_metadata_path</strong>(md_path) ⇒ String </a>
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
</span>
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
<span class="summary_desc"><div class='inline'>
|
315
|
+
<p>Get the metadata path for the provided file path located in this storage location.</p>
|
316
|
+
</div></span>
|
317
|
+
|
318
|
+
</li>
|
319
|
+
|
320
|
+
|
321
|
+
<li class="public ">
|
322
|
+
<span class="summary_signature">
|
323
|
+
|
324
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(name:, path:, metadata_path:, metadata_digests: []) ⇒ StorageLocation </a>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
</span>
|
329
|
+
|
330
|
+
|
331
|
+
<span class="note title constructor">constructor</span>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
<span class="summary_desc"><div class='inline'>
|
341
|
+
<p>A new instance of StorageLocation.</p>
|
342
|
+
</div></span>
|
343
|
+
|
344
|
+
</li>
|
345
|
+
|
346
|
+
|
347
|
+
</ul>
|
348
|
+
|
349
|
+
|
350
|
+
<div id="constructor_details" class="method_details_list">
|
351
|
+
<h2>Constructor Details</h2>
|
352
|
+
|
353
|
+
<div class="method_details first">
|
354
|
+
<h3 class="signature first" id="initialize-instance_method">
|
355
|
+
|
356
|
+
#<strong>initialize</strong>(name:, path:, metadata_path:, metadata_digests: []) ⇒ <tt><span class='object_link'><a href="" title="Longleaf::StorageLocation (class)">StorageLocation</a></span></tt>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
</h3><div class="docstring">
|
363
|
+
<div class="discussion">
|
364
|
+
|
365
|
+
<p>Returns a new instance of StorageLocation</p>
|
366
|
+
|
367
|
+
|
368
|
+
</div>
|
369
|
+
</div>
|
370
|
+
<div class="tags">
|
371
|
+
<p class="tag_title">Parameters:</p>
|
372
|
+
<ul class="param">
|
373
|
+
|
374
|
+
<li>
|
375
|
+
|
376
|
+
<span class='name'>name</span>
|
377
|
+
|
378
|
+
|
379
|
+
<span class='type'>(<tt>String</tt>)</span>
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
—
|
384
|
+
<div class='inline'>
|
385
|
+
<p>the name of this storage location</p>
|
386
|
+
</div>
|
387
|
+
|
388
|
+
</li>
|
389
|
+
|
390
|
+
<li>
|
391
|
+
|
392
|
+
<span class='name'>path</span>
|
393
|
+
|
394
|
+
|
395
|
+
<span class='type'>(<tt>String</tt>)</span>
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
—
|
400
|
+
<div class='inline'>
|
401
|
+
<p>absolute path where the storage location is located</p>
|
402
|
+
</div>
|
403
|
+
|
404
|
+
</li>
|
405
|
+
|
406
|
+
<li>
|
407
|
+
|
408
|
+
<span class='name'>metadata_path</span>
|
409
|
+
|
410
|
+
|
411
|
+
<span class='type'>(<tt>String</tt>)</span>
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
—
|
416
|
+
<div class='inline'>
|
417
|
+
<p>absolute path where the metadata for files in this location will be stored.</p>
|
418
|
+
</div>
|
419
|
+
|
420
|
+
</li>
|
421
|
+
|
422
|
+
<li>
|
423
|
+
|
424
|
+
<span class='name'>metadata_digests</span>
|
425
|
+
|
426
|
+
|
427
|
+
<span class='type'></span>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
—
|
432
|
+
<div class='inline'>
|
433
|
+
<p>list of digest algorithms to use for metadata file digests in this location.</p>
|
434
|
+
</div>
|
435
|
+
|
436
|
+
</li>
|
437
|
+
|
438
|
+
</ul>
|
439
|
+
|
440
|
+
<p class="tag_title">Raises:</p>
|
441
|
+
<ul class="raise">
|
442
|
+
|
443
|
+
<li>
|
444
|
+
|
445
|
+
|
446
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
</li>
|
451
|
+
|
452
|
+
</ul>
|
453
|
+
|
454
|
+
</div><table class="source_code">
|
455
|
+
<tr>
|
456
|
+
<td>
|
457
|
+
<pre class="lines">
|
458
|
+
|
459
|
+
|
460
|
+
15
|
461
|
+
16
|
462
|
+
17
|
463
|
+
18
|
464
|
+
19
|
465
|
+
20
|
466
|
+
21
|
467
|
+
22
|
468
|
+
23
|
469
|
+
24
|
470
|
+
25
|
471
|
+
26
|
472
|
+
27
|
473
|
+
28
|
474
|
+
29
|
475
|
+
30
|
476
|
+
31
|
477
|
+
32</pre>
|
478
|
+
</td>
|
479
|
+
<td>
|
480
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/models/storage_location.rb', line 15</span>
|
481
|
+
|
482
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>name:</span><span class='comma'>,</span> <span class='label'>path:</span><span class='comma'>,</span> <span class='label'>metadata_path:</span><span class='comma'>,</span> <span class='label'>metadata_digests:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
483
|
+
<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'>Parameters name, path and metadata_path are required</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>&&</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>&&</span> <span class='id identifier rubyid_metadata_path'>metadata_path</span>
|
484
|
+
|
485
|
+
<span class='ivar'>@path</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
|
486
|
+
<span class='ivar'>@path</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='ivar'>@path</span><span class='period'>.</span><span class='id identifier rubyid_end_with?'>end_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>
|
487
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
488
|
+
<span class='ivar'>@metadata_path</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata_path'>metadata_path</span>
|
489
|
+
<span class='ivar'>@metadata_path</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='ivar'>@metadata_path</span><span class='period'>.</span><span class='id identifier rubyid_end_with?'>end_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>
|
490
|
+
|
491
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_metadata_digests'>metadata_digests</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
492
|
+
<span class='ivar'>@metadata_digests</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
493
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_metadata_digests'>metadata_digests</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>
|
494
|
+
<span class='ivar'>@metadata_digests</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_metadata_digests'>metadata_digests</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='rbracket'>]</span>
|
495
|
+
<span class='kw'>else</span>
|
496
|
+
<span class='ivar'>@metadata_digests</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata_digests'>metadata_digests</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:downcase</span><span class='rparen'>)</span>
|
497
|
+
<span class='kw'>end</span>
|
498
|
+
<span class='const'><span class='object_link'><a href="DigestHelper.html" title="Longleaf::DigestHelper (class)">DigestHelper</a></span></span><span class='op'>::</span><span class='id identifier rubyid_validate_algorithms'><span class='object_link'><a href="DigestHelper.html#validate_algorithms-class_method" title="Longleaf::DigestHelper.validate_algorithms (method)">validate_algorithms</a></span></span><span class='lparen'>(</span><span class='ivar'>@metadata_digests</span><span class='rparen'>)</span>
|
499
|
+
<span class='kw'>end</span></pre>
|
500
|
+
</td>
|
501
|
+
</tr>
|
502
|
+
</table>
|
503
|
+
</div>
|
504
|
+
|
505
|
+
</div>
|
506
|
+
|
507
|
+
<div id="instance_attr_details" class="attr_details">
|
508
|
+
<h2>Instance Attribute Details</h2>
|
509
|
+
|
510
|
+
|
511
|
+
<span id=""></span>
|
512
|
+
<div class="method_details first">
|
513
|
+
<h3 class="signature first" id="metadata_digests-instance_method">
|
514
|
+
|
515
|
+
#<strong>metadata_digests</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
</h3><div class="docstring">
|
522
|
+
<div class="discussion">
|
523
|
+
|
524
|
+
<p>Returns the value of attribute metadata_digests</p>
|
525
|
+
|
526
|
+
|
527
|
+
</div>
|
528
|
+
</div>
|
529
|
+
<div class="tags">
|
530
|
+
|
531
|
+
|
532
|
+
</div><table class="source_code">
|
533
|
+
<tr>
|
534
|
+
<td>
|
535
|
+
<pre class="lines">
|
536
|
+
|
537
|
+
|
538
|
+
9
|
539
|
+
10
|
540
|
+
11</pre>
|
541
|
+
</td>
|
542
|
+
<td>
|
543
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/models/storage_location.rb', line 9</span>
|
544
|
+
|
545
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_metadata_digests'>metadata_digests</span>
|
546
|
+
<span class='ivar'>@metadata_digests</span>
|
547
|
+
<span class='kw'>end</span></pre>
|
548
|
+
</td>
|
549
|
+
</tr>
|
550
|
+
</table>
|
551
|
+
</div>
|
552
|
+
|
553
|
+
|
554
|
+
<span id=""></span>
|
555
|
+
<div class="method_details ">
|
556
|
+
<h3 class="signature " id="metadata_path-instance_method">
|
557
|
+
|
558
|
+
#<strong>metadata_path</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
</h3><div class="docstring">
|
565
|
+
<div class="discussion">
|
566
|
+
|
567
|
+
<p>Returns the value of attribute metadata_path</p>
|
568
|
+
|
569
|
+
|
570
|
+
</div>
|
571
|
+
</div>
|
572
|
+
<div class="tags">
|
573
|
+
|
574
|
+
|
575
|
+
</div><table class="source_code">
|
576
|
+
<tr>
|
577
|
+
<td>
|
578
|
+
<pre class="lines">
|
579
|
+
|
580
|
+
|
581
|
+
8
|
582
|
+
9
|
583
|
+
10</pre>
|
584
|
+
</td>
|
585
|
+
<td>
|
586
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/models/storage_location.rb', line 8</span>
|
587
|
+
|
588
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_metadata_path'>metadata_path</span>
|
589
|
+
<span class='ivar'>@metadata_path</span>
|
590
|
+
<span class='kw'>end</span></pre>
|
591
|
+
</td>
|
592
|
+
</tr>
|
593
|
+
</table>
|
594
|
+
</div>
|
595
|
+
|
596
|
+
|
597
|
+
<span id=""></span>
|
598
|
+
<div class="method_details ">
|
599
|
+
<h3 class="signature " id="name-instance_method">
|
600
|
+
|
601
|
+
#<strong>name</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
</h3><div class="docstring">
|
608
|
+
<div class="discussion">
|
609
|
+
|
610
|
+
<p>Returns the value of attribute name</p>
|
611
|
+
|
612
|
+
|
613
|
+
</div>
|
614
|
+
</div>
|
615
|
+
<div class="tags">
|
616
|
+
|
617
|
+
|
618
|
+
</div><table class="source_code">
|
619
|
+
<tr>
|
620
|
+
<td>
|
621
|
+
<pre class="lines">
|
622
|
+
|
623
|
+
|
624
|
+
6
|
625
|
+
7
|
626
|
+
8</pre>
|
627
|
+
</td>
|
628
|
+
<td>
|
629
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/models/storage_location.rb', line 6</span>
|
630
|
+
|
631
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
632
|
+
<span class='ivar'>@name</span>
|
633
|
+
<span class='kw'>end</span></pre>
|
634
|
+
</td>
|
635
|
+
</tr>
|
636
|
+
</table>
|
637
|
+
</div>
|
638
|
+
|
639
|
+
|
640
|
+
<span id=""></span>
|
641
|
+
<div class="method_details ">
|
642
|
+
<h3 class="signature " id="path-instance_method">
|
643
|
+
|
644
|
+
#<strong>path</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
</h3><div class="docstring">
|
651
|
+
<div class="discussion">
|
652
|
+
|
653
|
+
<p>Returns the value of attribute path</p>
|
654
|
+
|
655
|
+
|
656
|
+
</div>
|
657
|
+
</div>
|
658
|
+
<div class="tags">
|
659
|
+
|
660
|
+
|
661
|
+
</div><table class="source_code">
|
662
|
+
<tr>
|
663
|
+
<td>
|
664
|
+
<pre class="lines">
|
665
|
+
|
666
|
+
|
667
|
+
7
|
668
|
+
8
|
669
|
+
9</pre>
|
670
|
+
</td>
|
671
|
+
<td>
|
672
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/models/storage_location.rb', line 7</span>
|
673
|
+
|
674
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_path'>path</span>
|
675
|
+
<span class='ivar'>@path</span>
|
676
|
+
<span class='kw'>end</span></pre>
|
677
|
+
</td>
|
678
|
+
</tr>
|
679
|
+
</table>
|
680
|
+
</div>
|
681
|
+
|
682
|
+
</div>
|
683
|
+
|
684
|
+
|
685
|
+
<div id="instance_method_details" class="method_details_list">
|
686
|
+
<h2>Instance Method Details</h2>
|
687
|
+
|
688
|
+
|
689
|
+
<div class="method_details first">
|
690
|
+
<h3 class="signature first" id="available?-instance_method">
|
691
|
+
|
692
|
+
#<strong>available?</strong> ⇒ <tt>Boolean</tt>
|
693
|
+
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
</h3><div class="docstring">
|
699
|
+
<div class="discussion">
|
700
|
+
|
701
|
+
<p>Checks that the path and metadata path defined in this location are available</p>
|
702
|
+
|
703
|
+
|
704
|
+
</div>
|
705
|
+
</div>
|
706
|
+
<div class="tags">
|
707
|
+
|
708
|
+
<p class="tag_title">Returns:</p>
|
709
|
+
<ul class="return">
|
710
|
+
|
711
|
+
<li>
|
712
|
+
|
713
|
+
|
714
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
</li>
|
719
|
+
|
720
|
+
</ul>
|
721
|
+
<p class="tag_title">Raises:</p>
|
722
|
+
<ul class="raise">
|
723
|
+
|
724
|
+
<li>
|
725
|
+
|
726
|
+
|
727
|
+
<span class='type'>(<tt><span class='object_link'><a href="StorageLocationUnavailableError.html" title="Longleaf::StorageLocationUnavailableError (class)">StorageLocationUnavailableError</a></span></tt>)</span>
|
728
|
+
|
729
|
+
|
730
|
+
|
731
|
+
—
|
732
|
+
<div class='inline'>
|
733
|
+
<p>if the storage location is not available</p>
|
734
|
+
</div>
|
735
|
+
|
736
|
+
</li>
|
737
|
+
|
738
|
+
</ul>
|
739
|
+
|
740
|
+
</div><table class="source_code">
|
741
|
+
<tr>
|
742
|
+
<td>
|
743
|
+
<pre class="lines">
|
744
|
+
|
745
|
+
|
746
|
+
66
|
747
|
+
67
|
748
|
+
68
|
749
|
+
69
|
750
|
+
70
|
751
|
+
71</pre>
|
752
|
+
</td>
|
753
|
+
<td>
|
754
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/models/storage_location.rb', line 66</span>
|
755
|
+
|
756
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_available?'>available?</span>
|
757
|
+
<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'>Path does not exist or is not a directory: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>\
|
758
|
+
<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='ivar'>@path</span><span class='rparen'>)</span>
|
759
|
+
<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'>Metadata path does not exist or is not a directory: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@metadata_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>\
|
760
|
+
<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='ivar'>@metadata_path</span><span class='rparen'>)</span>
|
761
|
+
<span class='kw'>end</span></pre>
|
762
|
+
</td>
|
763
|
+
</tr>
|
764
|
+
</table>
|
765
|
+
</div>
|
766
|
+
|
767
|
+
<div class="method_details ">
|
768
|
+
<h3 class="signature " id="get_metadata_path_for-instance_method">
|
769
|
+
|
770
|
+
#<strong>get_metadata_path_for</strong>(file_path) ⇒ <tt>Object</tt>
|
771
|
+
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
</h3><div class="docstring">
|
777
|
+
<div class="discussion">
|
778
|
+
|
779
|
+
<p>Get the path for the metadata file for the given file path located in this storage location.</p>
|
780
|
+
|
781
|
+
|
782
|
+
</div>
|
783
|
+
</div>
|
784
|
+
<div class="tags">
|
785
|
+
<p class="tag_title">Parameters:</p>
|
786
|
+
<ul class="param">
|
787
|
+
|
788
|
+
<li>
|
789
|
+
|
790
|
+
<span class='name'>file_path</span>
|
791
|
+
|
792
|
+
|
793
|
+
<span class='type'>(<tt>String</tt>)</span>
|
794
|
+
|
795
|
+
|
796
|
+
|
797
|
+
—
|
798
|
+
<div class='inline'>
|
799
|
+
<p>path of the file</p>
|
800
|
+
</div>
|
801
|
+
|
802
|
+
</li>
|
803
|
+
|
804
|
+
</ul>
|
805
|
+
|
806
|
+
<p class="tag_title">Raises:</p>
|
807
|
+
<ul class="raise">
|
808
|
+
|
809
|
+
<li>
|
810
|
+
|
811
|
+
|
812
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
813
|
+
|
814
|
+
|
815
|
+
|
816
|
+
—
|
817
|
+
<div class='inline'>
|
818
|
+
<p>if the file_path is not provided or is not in this storage location.</p>
|
819
|
+
</div>
|
820
|
+
|
821
|
+
</li>
|
822
|
+
|
823
|
+
</ul>
|
824
|
+
|
825
|
+
</div><table class="source_code">
|
826
|
+
<tr>
|
827
|
+
<td>
|
828
|
+
<pre class="lines">
|
829
|
+
|
830
|
+
|
831
|
+
37
|
832
|
+
38
|
833
|
+
39
|
834
|
+
40
|
835
|
+
41
|
836
|
+
42
|
837
|
+
43
|
838
|
+
44
|
839
|
+
45
|
840
|
+
46
|
841
|
+
47
|
842
|
+
48
|
843
|
+
49</pre>
|
844
|
+
</td>
|
845
|
+
<td>
|
846
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/models/storage_location.rb', line 37</span>
|
847
|
+
|
848
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_metadata_path_for'>get_metadata_path_for</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
|
849
|
+
<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'>A file_path parameter is required</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
850
|
+
<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'>Provided file path is not contained by storage location </span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_path'>file_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> \
|
851
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='ivar'>@path</span><span class='rparen'>)</span>
|
852
|
+
|
853
|
+
<span class='id identifier rubyid_md_path'>md_path</span> <span class='op'>=</span> <span class='id identifier rubyid_file_path'>file_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'>^</span><span class='embexpr_beg'>#{</span><span class='ivar'>@path</span><span class='embexpr_end'>}</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='ivar'>@metadata_path</span><span class='rparen'>)</span>
|
854
|
+
<span class='comment'># If the file_path is to a file, then add metadata suffix.
|
855
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_md_path'>md_path</span><span class='period'>.</span><span class='id identifier rubyid_end_with?'>end_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>
|
856
|
+
<span class='id identifier rubyid_md_path'>md_path</span>
|
857
|
+
<span class='kw'>else</span>
|
858
|
+
<span class='id identifier rubyid_md_path'>md_path</span> <span class='op'>+</span> <span class='const'><span class='object_link'><a href="MetadataSerializer.html" title="Longleaf::MetadataSerializer (class)">MetadataSerializer</a></span></span><span class='op'>::</span><span class='id identifier rubyid_metadata_suffix'><span class='object_link'><a href="MetadataSerializer.html#metadata_suffix-class_method" title="Longleaf::MetadataSerializer.metadata_suffix (method)">metadata_suffix</a></span></span>
|
859
|
+
<span class='kw'>end</span>
|
860
|
+
<span class='kw'>end</span></pre>
|
861
|
+
</td>
|
862
|
+
</tr>
|
863
|
+
</table>
|
864
|
+
</div>
|
865
|
+
|
866
|
+
<div class="method_details ">
|
867
|
+
<h3 class="signature " id="get_path_from_metadata_path-instance_method">
|
868
|
+
|
869
|
+
#<strong>get_path_from_metadata_path</strong>(md_path) ⇒ <tt>String</tt>
|
870
|
+
|
871
|
+
|
872
|
+
|
873
|
+
|
874
|
+
|
875
|
+
</h3><div class="docstring">
|
876
|
+
<div class="discussion">
|
877
|
+
|
878
|
+
<p>Get the metadata path for the provided file path located in this storage location.</p>
|
879
|
+
|
880
|
+
|
881
|
+
</div>
|
882
|
+
</div>
|
883
|
+
<div class="tags">
|
884
|
+
<p class="tag_title">Parameters:</p>
|
885
|
+
<ul class="param">
|
886
|
+
|
887
|
+
<li>
|
888
|
+
|
889
|
+
<span class='name'>md_path</span>
|
890
|
+
|
891
|
+
|
892
|
+
<span class='type'>(<tt>String</tt>)</span>
|
893
|
+
|
894
|
+
|
895
|
+
|
896
|
+
—
|
897
|
+
<div class='inline'>
|
898
|
+
<p>metadata file path</p>
|
899
|
+
</div>
|
900
|
+
|
901
|
+
</li>
|
902
|
+
|
903
|
+
</ul>
|
904
|
+
|
905
|
+
<p class="tag_title">Returns:</p>
|
906
|
+
<ul class="return">
|
907
|
+
|
908
|
+
<li>
|
909
|
+
|
910
|
+
|
911
|
+
<span class='type'>(<tt>String</tt>)</span>
|
912
|
+
|
913
|
+
|
914
|
+
|
915
|
+
—
|
916
|
+
<div class='inline'>
|
917
|
+
<p>the path for the file associated with this metadata</p>
|
918
|
+
</div>
|
919
|
+
|
920
|
+
</li>
|
921
|
+
|
922
|
+
</ul>
|
923
|
+
<p class="tag_title">Raises:</p>
|
924
|
+
<ul class="raise">
|
925
|
+
|
926
|
+
<li>
|
927
|
+
|
928
|
+
|
929
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
930
|
+
|
931
|
+
|
932
|
+
|
933
|
+
—
|
934
|
+
<div class='inline'>
|
935
|
+
<p>if the md_path is not in this storage location</p>
|
936
|
+
</div>
|
937
|
+
|
938
|
+
</li>
|
939
|
+
|
940
|
+
</ul>
|
941
|
+
|
942
|
+
</div><table class="source_code">
|
943
|
+
<tr>
|
944
|
+
<td>
|
945
|
+
<pre class="lines">
|
946
|
+
|
947
|
+
|
948
|
+
55
|
949
|
+
56
|
950
|
+
57
|
951
|
+
58
|
952
|
+
59
|
953
|
+
60
|
954
|
+
61
|
955
|
+
62</pre>
|
956
|
+
</td>
|
957
|
+
<td>
|
958
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/models/storage_location.rb', line 55</span>
|
959
|
+
|
960
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_path_from_metadata_path'>get_path_from_metadata_path</span><span class='lparen'>(</span><span class='id identifier rubyid_md_path'>md_path</span><span class='rparen'>)</span>
|
961
|
+
<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'>A file_path parameter is required</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_md_path'>md_path</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_md_path'>md_path</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
962
|
+
<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'>Provided metadata path is not contained by storage location </span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_md_path'>md_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> \
|
963
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_md_path'>md_path</span><span class='op'>&.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='ivar'>@metadata_path</span><span class='rparen'>)</span>
|
964
|
+
|
965
|
+
<span class='id identifier rubyid_file_path'>file_path</span> <span class='op'>=</span> <span class='id identifier rubyid_md_path'>md_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'>^</span><span class='embexpr_beg'>#{</span><span class='ivar'>@metadata_path</span><span class='embexpr_end'>}</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='ivar'>@path</span><span class='rparen'>)</span>
|
966
|
+
<span class='id identifier rubyid_file_path'>file_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='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="MetadataSerializer.html" title="Longleaf::MetadataSerializer (class)">MetadataSerializer</a></span></span><span class='op'>::</span><span class='id identifier rubyid_metadata_suffix'><span class='object_link'><a href="MetadataSerializer.html#metadata_suffix-class_method" title="Longleaf::MetadataSerializer.metadata_suffix (method)">metadata_suffix</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>$</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>
|
967
|
+
<span class='kw'>end</span></pre>
|
968
|
+
</td>
|
969
|
+
</tr>
|
970
|
+
</table>
|
971
|
+
</div>
|
972
|
+
|
973
|
+
</div>
|
974
|
+
|
975
|
+
</div>
|
976
|
+
|
977
|
+
<div id="footer">
|
978
|
+
Generated on Tue May 28 15:48:01 2019 by
|
979
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
980
|
+
0.9.19 (ruby-2.6.3).
|
981
|
+
</div>
|
982
|
+
|
983
|
+
</div>
|
984
|
+
</body>
|
985
|
+
</html>
|