longleaf 0.1.0.pre.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +94 -0
  3. data/.editorconfig +13 -0
  4. data/.gitignore +4 -1
  5. data/.rubocop.yml +44 -0
  6. data/.rubocop_todo.yml +834 -0
  7. data/.yardopts +1 -0
  8. data/Gemfile +16 -1
  9. data/README.md +98 -12
  10. data/Rakefile +6 -0
  11. data/bin/setup +16 -1
  12. data/docs/aboutlongleaf.md +28 -0
  13. data/docs/extra.css +32 -0
  14. data/docs/img/change-file.png +0 -0
  15. data/docs/img/ll-example-preserved.png +0 -0
  16. data/docs/index.md +19 -0
  17. data/docs/install.md +66 -0
  18. data/docs/ll-example/config-example-relative.yml +33 -0
  19. data/docs/ll-example/files-dir/LLexample-PDF.pdf +0 -0
  20. data/docs/ll-example/files-dir/LLexample-TOCHANGE.txt +15 -0
  21. data/docs/ll-example/files-dir/LLexample-tokeep.txt +10 -0
  22. data/docs/ll-example/metadata-dir/.gitkeep +0 -0
  23. data/docs/ll-example/replica-files/.gitkeep +0 -0
  24. data/docs/ll-example/replica-metadata/.gitkeep +0 -0
  25. data/docs/quickstart.md +270 -0
  26. data/docs/rdocs/Longleaf.html +135 -0
  27. data/docs/rdocs/Longleaf/AppFields.html +178 -0
  28. data/docs/rdocs/Longleaf/ApplicationConfigDeserializer.html +631 -0
  29. data/docs/rdocs/Longleaf/ApplicationConfigManager.html +610 -0
  30. data/docs/rdocs/Longleaf/ApplicationConfigValidator.html +238 -0
  31. data/docs/rdocs/Longleaf/CLI.html +909 -0
  32. data/docs/rdocs/Longleaf/ChecksumMismatchError.html +151 -0
  33. data/docs/rdocs/Longleaf/ConfigBuilder.html +1339 -0
  34. data/docs/rdocs/Longleaf/ConfigurationError.html +143 -0
  35. data/docs/rdocs/Longleaf/ConfigurationValidator.html +227 -0
  36. data/docs/rdocs/Longleaf/DeregisterCommand.html +420 -0
  37. data/docs/rdocs/Longleaf/DeregisterEvent.html +453 -0
  38. data/docs/rdocs/Longleaf/DeregistrationError.html +151 -0
  39. data/docs/rdocs/Longleaf/DigestHelper.html +419 -0
  40. data/docs/rdocs/Longleaf/EventError.html +147 -0
  41. data/docs/rdocs/Longleaf/EventNames.html +163 -0
  42. data/docs/rdocs/Longleaf/EventStatusTracking.html +656 -0
  43. data/docs/rdocs/Longleaf/FileCheckService.html +540 -0
  44. data/docs/rdocs/Longleaf/FileHelpers.html +520 -0
  45. data/docs/rdocs/Longleaf/FileRecord.html +716 -0
  46. data/docs/rdocs/Longleaf/FileSelector.html +901 -0
  47. data/docs/rdocs/Longleaf/FixityCheckService.html +691 -0
  48. data/docs/rdocs/Longleaf/IndexManager.html +1155 -0
  49. data/docs/rdocs/Longleaf/InvalidDigestAlgorithmError.html +143 -0
  50. data/docs/rdocs/Longleaf/InvalidStoragePathError.html +143 -0
  51. data/docs/rdocs/Longleaf/Logging.html +405 -0
  52. data/docs/rdocs/Longleaf/Logging/RedirectingLogger.html +1213 -0
  53. data/docs/rdocs/Longleaf/LongleafError.html +139 -0
  54. data/docs/rdocs/Longleaf/MDFields.html +193 -0
  55. data/docs/rdocs/Longleaf/MetadataBuilder.html +787 -0
  56. data/docs/rdocs/Longleaf/MetadataDeserializer.html +537 -0
  57. data/docs/rdocs/Longleaf/MetadataError.html +143 -0
  58. data/docs/rdocs/Longleaf/MetadataPersistenceManager.html +539 -0
  59. data/docs/rdocs/Longleaf/MetadataRecord.html +1411 -0
  60. data/docs/rdocs/Longleaf/MetadataSerializer.html +786 -0
  61. data/docs/rdocs/Longleaf/PreservationServiceError.html +147 -0
  62. data/docs/rdocs/Longleaf/PreserveCommand.html +410 -0
  63. data/docs/rdocs/Longleaf/PreserveEvent.html +491 -0
  64. data/docs/rdocs/Longleaf/RegisterCommand.html +428 -0
  65. data/docs/rdocs/Longleaf/RegisterEvent.html +628 -0
  66. data/docs/rdocs/Longleaf/RegisteredFileSelector.html +446 -0
  67. data/docs/rdocs/Longleaf/RegistrationError.html +151 -0
  68. data/docs/rdocs/Longleaf/ReindexCommand.html +576 -0
  69. data/docs/rdocs/Longleaf/RsyncReplicationService.html +1180 -0
  70. data/docs/rdocs/Longleaf/SequelIndexDriver.html +1978 -0
  71. data/docs/rdocs/Longleaf/ServiceCandidateFilesystemIterator.html +572 -0
  72. data/docs/rdocs/Longleaf/ServiceCandidateIndexIterator.html +532 -0
  73. data/docs/rdocs/Longleaf/ServiceCandidateLocator.html +333 -0
  74. data/docs/rdocs/Longleaf/ServiceClassCache.html +725 -0
  75. data/docs/rdocs/Longleaf/ServiceDateHelper.html +425 -0
  76. data/docs/rdocs/Longleaf/ServiceDefinition.html +683 -0
  77. data/docs/rdocs/Longleaf/ServiceDefinitionManager.html +371 -0
  78. data/docs/rdocs/Longleaf/ServiceDefinitionValidator.html +269 -0
  79. data/docs/rdocs/Longleaf/ServiceFields.html +173 -0
  80. data/docs/rdocs/Longleaf/ServiceManager.html +1229 -0
  81. data/docs/rdocs/Longleaf/ServiceMappingManager.html +410 -0
  82. data/docs/rdocs/Longleaf/ServiceMappingValidator.html +347 -0
  83. data/docs/rdocs/Longleaf/ServiceRecord.html +821 -0
  84. data/docs/rdocs/Longleaf/StorageLocation.html +985 -0
  85. data/docs/rdocs/Longleaf/StorageLocationManager.html +729 -0
  86. data/docs/rdocs/Longleaf/StorageLocationUnavailableError.html +143 -0
  87. data/docs/rdocs/Longleaf/StorageLocationValidator.html +373 -0
  88. data/docs/rdocs/Longleaf/StoragePathValidator.html +253 -0
  89. data/docs/rdocs/Longleaf/SystemConfigBuilder.html +441 -0
  90. data/docs/rdocs/Longleaf/SystemConfigFields.html +163 -0
  91. data/docs/rdocs/Longleaf/ValidateConfigCommand.html +451 -0
  92. data/docs/rdocs/Longleaf/ValidateMetadataCommand.html +408 -0
  93. data/docs/rdocs/_index.html +660 -0
  94. data/docs/rdocs/class_list.html +51 -0
  95. data/docs/rdocs/css/common.css +1 -0
  96. data/docs/rdocs/css/full_list.css +58 -0
  97. data/docs/rdocs/css/style.css +496 -0
  98. data/docs/rdocs/file.README.html +165 -0
  99. data/docs/rdocs/file_list.html +56 -0
  100. data/docs/rdocs/frames.html +17 -0
  101. data/docs/rdocs/index.html +165 -0
  102. data/docs/rdocs/js/app.js +303 -0
  103. data/docs/rdocs/js/full_list.js +216 -0
  104. data/docs/rdocs/js/jquery.js +4 -0
  105. data/docs/rdocs/method_list.html +2051 -0
  106. data/docs/rdocs/top-level-namespace.html +110 -0
  107. data/lib/longleaf/candidates/file_selector.rb +139 -0
  108. data/lib/longleaf/candidates/manifest_digest_provider.rb +17 -0
  109. data/lib/longleaf/candidates/registered_file_selector.rb +67 -0
  110. data/lib/longleaf/candidates/service_candidate_filesystem_iterator.rb +93 -0
  111. data/lib/longleaf/candidates/service_candidate_index_iterator.rb +84 -0
  112. data/lib/longleaf/candidates/service_candidate_locator.rb +23 -0
  113. data/lib/longleaf/candidates/single_digest_provider.rb +13 -0
  114. data/lib/longleaf/cli.rb +237 -46
  115. data/lib/longleaf/commands/deregister_command.rb +51 -0
  116. data/lib/longleaf/commands/preserve_command.rb +50 -0
  117. data/lib/longleaf/commands/register_command.rb +32 -43
  118. data/lib/longleaf/commands/reindex_command.rb +92 -0
  119. data/lib/longleaf/commands/validate_config_command.rb +33 -8
  120. data/lib/longleaf/commands/validate_metadata_command.rb +51 -0
  121. data/lib/longleaf/errors.rb +26 -7
  122. data/lib/longleaf/events/deregister_event.rb +53 -0
  123. data/lib/longleaf/events/event_names.rb +9 -0
  124. data/lib/longleaf/events/event_status_tracking.rb +59 -0
  125. data/lib/longleaf/events/preserve_event.rb +81 -0
  126. data/lib/longleaf/events/register_event.rb +52 -51
  127. data/lib/longleaf/helpers/case_insensitive_hash.rb +38 -0
  128. data/lib/longleaf/helpers/digest_helper.rb +56 -0
  129. data/lib/longleaf/helpers/s3_uri_helper.rb +86 -0
  130. data/lib/longleaf/helpers/selection_options_parser.rb +189 -0
  131. data/lib/longleaf/helpers/service_date_helper.rb +78 -0
  132. data/lib/longleaf/indexing/index_manager.rb +101 -0
  133. data/lib/longleaf/indexing/sequel_index_driver.rb +306 -0
  134. data/lib/longleaf/logging.rb +5 -4
  135. data/lib/longleaf/logging/redirecting_logger.rb +26 -25
  136. data/lib/longleaf/models/app_fields.rb +7 -2
  137. data/lib/longleaf/models/file_record.rb +17 -8
  138. data/lib/longleaf/models/filesystem_metadata_location.rb +56 -0
  139. data/lib/longleaf/models/filesystem_storage_location.rb +52 -0
  140. data/lib/longleaf/models/md_fields.rb +2 -1
  141. data/lib/longleaf/models/metadata_location.rb +47 -0
  142. data/lib/longleaf/models/metadata_record.rb +39 -15
  143. data/lib/longleaf/models/s3_storage_location.rb +133 -0
  144. data/lib/longleaf/models/service_definition.rb +7 -6
  145. data/lib/longleaf/models/service_fields.rb +7 -1
  146. data/lib/longleaf/models/service_record.rb +10 -6
  147. data/lib/longleaf/models/storage_location.rb +24 -19
  148. data/lib/longleaf/models/storage_types.rb +9 -0
  149. data/lib/longleaf/models/system_config_fields.rb +9 -0
  150. data/lib/longleaf/preservation_services/file_check_service.rb +58 -0
  151. data/lib/longleaf/preservation_services/fixity_check_service.rb +123 -0
  152. data/lib/longleaf/preservation_services/rsync_replication_service.rb +182 -0
  153. data/lib/longleaf/preservation_services/s3_replication_service.rb +143 -0
  154. data/lib/longleaf/services/application_config_deserializer.rb +81 -24
  155. data/lib/longleaf/services/application_config_manager.rb +20 -6
  156. data/lib/longleaf/services/application_config_validator.rb +19 -9
  157. data/lib/longleaf/services/configuration_validator.rb +67 -4
  158. data/lib/longleaf/services/filesystem_location_validator.rb +16 -0
  159. data/lib/longleaf/services/metadata_deserializer.rb +113 -42
  160. data/lib/longleaf/services/metadata_persistence_manager.rb +47 -0
  161. data/lib/longleaf/services/metadata_serializer.rb +138 -25
  162. data/lib/longleaf/services/metadata_validator.rb +76 -0
  163. data/lib/longleaf/services/s3_location_validator.rb +19 -0
  164. data/lib/longleaf/services/service_class_cache.rb +112 -0
  165. data/lib/longleaf/services/service_definition_manager.rb +10 -7
  166. data/lib/longleaf/services/service_definition_validator.rb +25 -18
  167. data/lib/longleaf/services/service_manager.rb +86 -11
  168. data/lib/longleaf/services/service_mapping_manager.rb +13 -12
  169. data/lib/longleaf/services/service_mapping_validator.rb +36 -26
  170. data/lib/longleaf/services/storage_location_manager.rb +76 -15
  171. data/lib/longleaf/services/storage_location_validator.rb +49 -35
  172. data/lib/longleaf/specs/config_builder.rb +47 -23
  173. data/lib/longleaf/specs/config_validator_helpers.rb +16 -0
  174. data/lib/longleaf/specs/custom_matchers.rb +9 -0
  175. data/lib/longleaf/specs/file_helpers.rb +61 -0
  176. data/lib/longleaf/specs/metadata_builder.rb +92 -0
  177. data/lib/longleaf/specs/system_config_builder.rb +27 -0
  178. data/lib/longleaf/version.rb +1 -1
  179. data/longleaf.gemspec +20 -7
  180. data/mkdocs.yml +21 -0
  181. metadata +306 -23
  182. data/.travis.yml +0 -4
  183. data/lib/longleaf/commands/abstract_command.rb +0 -37
  184. data/lib/longleaf/services/storage_path_validator.rb +0 -16
@@ -0,0 +1,729 @@
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::StorageLocationManager
8
+
9
+ &mdash; 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::StorageLocationManager";
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> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span>
41
+ &raquo;
42
+ <span class="title">StorageLocationManager</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::StorageLocationManager
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::StorageLocationManager</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/services/storage_location_manager.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Manager which loads and provides access to <span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">StorageLocation</a></span> objects</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="#locations-instance_method" title="#locations (instance method)">#<strong>locations</strong> &#x21d2; 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>Hash mapping storage location names to <span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">StorageLocation</a></span> objects.</p>
144
+ </div></span>
145
+
146
+ </li>
147
+
148
+
149
+ </ul>
150
+
151
+
152
+
153
+
154
+
155
+ <h2>
156
+ Instance Method Summary
157
+ <small><a href="#" class="summary_toggle">collapse</a></small>
158
+ </h2>
159
+
160
+ <ul class="summary">
161
+
162
+ <li class="public ">
163
+ <span class="summary_signature">
164
+
165
+ <a href="#get_location_by_metadata_path-instance_method" title="#get_location_by_metadata_path (instance method)">#<strong>get_location_by_metadata_path</strong>(md_path) &#x21d2; Longleaf::StorageLocation </a>
166
+
167
+
168
+
169
+ </span>
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+ <span class="summary_desc"><div class='inline'>
180
+ <p>Get the <span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">StorageLocation</a></span> object which should contain the given metadata path.</p>
181
+ </div></span>
182
+
183
+ </li>
184
+
185
+
186
+ <li class="public ">
187
+ <span class="summary_signature">
188
+
189
+ <a href="#get_location_by_path-instance_method" title="#get_location_by_path (instance method)">#<strong>get_location_by_path</strong>(path) &#x21d2; Longleaf::StorageLocation </a>
190
+
191
+
192
+
193
+ </span>
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+ <span class="summary_desc"><div class='inline'>
204
+ <p>Get the <span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">StorageLocation</a></span> object which should contain the given path.</p>
205
+ </div></span>
206
+
207
+ </li>
208
+
209
+
210
+ <li class="public ">
211
+ <span class="summary_signature">
212
+
213
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(config) &#x21d2; StorageLocationManager </a>
214
+
215
+
216
+
217
+ </span>
218
+
219
+
220
+ <span class="note title constructor">constructor</span>
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+ <span class="summary_desc"><div class='inline'>
230
+ <p>A new instance of StorageLocationManager.</p>
231
+ </div></span>
232
+
233
+ </li>
234
+
235
+
236
+ <li class="public ">
237
+ <span class="summary_signature">
238
+
239
+ <a href="#verify_path_in_location-instance_method" title="#verify_path_in_location (instance method)">#<strong>verify_path_in_location</strong>(path, expected_loc = nil) &#x21d2; StorageLocation </a>
240
+
241
+
242
+
243
+ </span>
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+ <span class="summary_desc"><div class='inline'>
254
+ <p>Raises a <span class='object_link'><a href="StorageLocationUnavailableError.html" title="Longleaf::StorageLocationUnavailableError (class)">StorageLocationUnavailableError</a></span> if the given path is not in a known storage location, or if it is not within the expected location if provided.</p>
255
+ </div></span>
256
+
257
+ </li>
258
+
259
+
260
+ </ul>
261
+
262
+
263
+ <div id="constructor_details" class="method_details_list">
264
+ <h2>Constructor Details</h2>
265
+
266
+ <div class="method_details first">
267
+ <h3 class="signature first" id="initialize-instance_method">
268
+
269
+ #<strong>initialize</strong>(config) &#x21d2; <tt><span class='object_link'><a href="" title="Longleaf::StorageLocationManager (class)">StorageLocationManager</a></span></tt>
270
+
271
+
272
+
273
+
274
+
275
+ </h3><div class="docstring">
276
+ <div class="discussion">
277
+
278
+ <p>Returns a new instance of StorageLocationManager</p>
279
+
280
+
281
+ </div>
282
+ </div>
283
+ <div class="tags">
284
+ <p class="tag_title">Parameters:</p>
285
+ <ul class="param">
286
+
287
+ <li>
288
+
289
+ <span class='name'>config</span>
290
+
291
+
292
+ <span class='type'>(<tt>Hash</tt>)</span>
293
+
294
+
295
+
296
+ &mdash;
297
+ <div class='inline'>
298
+ <p>has representation of the application configuration</p>
299
+ </div>
300
+
301
+ </li>
302
+
303
+ </ul>
304
+
305
+ <p class="tag_title">Raises:</p>
306
+ <ul class="raise">
307
+
308
+ <li>
309
+
310
+
311
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
312
+
313
+
314
+
315
+ </li>
316
+
317
+ </ul>
318
+
319
+ </div><table class="source_code">
320
+ <tr>
321
+ <td>
322
+ <pre class="lines">
323
+
324
+
325
+ 14
326
+ 15
327
+ 16
328
+ 17
329
+ 18
330
+ 19
331
+ 20
332
+ 21
333
+ 22
334
+ 23
335
+ 24
336
+ 25
337
+ 26
338
+ 27
339
+ 28
340
+ 29
341
+ 30</pre>
342
+ </td>
343
+ <td>
344
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/storage_location_manager.rb', line 14</span>
345
+
346
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span>
347
+ <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'>&quot;</span><span class='tstring_content'>Configuration must be provided</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='op'>&amp;.</span><span class='id identifier rubyid_empty?'>empty?</span>
348
+
349
+ <span class='ivar'>@locations</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
350
+ <span class='id identifier rubyid_config'>config</span><span class='lbracket'>[</span><span class='const'>AF</span><span class='op'>::</span><span class='const'>LOCATIONS</span><span class='rbracket'>]</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_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_properties'>properties</span><span class='op'>|</span>
351
+ <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_properties'>properties</span><span class='lbracket'>[</span><span class='const'>AF</span><span class='op'>::</span><span class='const'>LOCATION_PATH</span><span class='rbracket'>]</span>
352
+ <span class='id identifier rubyid_md_path'>md_path</span> <span class='op'>=</span> <span class='id identifier rubyid_properties'>properties</span><span class='lbracket'>[</span><span class='const'>AF</span><span class='op'>::</span><span class='const'>METADATA_PATH</span><span class='rbracket'>]</span>
353
+ <span class='id identifier rubyid_md_digests'>md_digests</span> <span class='op'>=</span> <span class='id identifier rubyid_properties'>properties</span><span class='lbracket'>[</span><span class='const'>AF</span><span class='op'>::</span><span class='const'>METADATA_DIGESTS</span><span class='rbracket'>]</span>
354
+ <span class='id identifier rubyid_location'>location</span> <span class='op'>=</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='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="StorageLocation.html#initialize-instance_method" title="Longleaf::StorageLocation#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
355
+ <span class='label'>path:</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span>
356
+ <span class='label'>metadata_path:</span> <span class='id identifier rubyid_md_path'>md_path</span><span class='comma'>,</span>
357
+ <span class='label'>metadata_digests:</span> <span class='id identifier rubyid_md_digests'>md_digests</span><span class='rparen'>)</span>
358
+
359
+ <span class='ivar'>@locations</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_location'>location</span>
360
+ <span class='kw'>end</span>
361
+ <span class='ivar'>@locations</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
362
+ <span class='kw'>end</span></pre>
363
+ </td>
364
+ </tr>
365
+ </table>
366
+ </div>
367
+
368
+ </div>
369
+
370
+ <div id="instance_attr_details" class="attr_details">
371
+ <h2>Instance Attribute Details</h2>
372
+
373
+
374
+ <span id=""></span>
375
+ <div class="method_details first">
376
+ <h3 class="signature first" id="locations-instance_method">
377
+
378
+ #<strong>locations</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
379
+
380
+
381
+
382
+
383
+
384
+ </h3><div class="docstring">
385
+ <div class="discussion">
386
+
387
+ <p>Hash mapping storage location names to <span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">Longleaf::StorageLocation</a></span> objects</p>
388
+
389
+
390
+ </div>
391
+ </div>
392
+ <div class="tags">
393
+
394
+
395
+ </div><table class="source_code">
396
+ <tr>
397
+ <td>
398
+ <pre class="lines">
399
+
400
+
401
+ 11
402
+ 12
403
+ 13</pre>
404
+ </td>
405
+ <td>
406
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/storage_location_manager.rb', line 11</span>
407
+
408
+ <span class='kw'>def</span> <span class='id identifier rubyid_locations'>locations</span>
409
+ <span class='ivar'>@locations</span>
410
+ <span class='kw'>end</span></pre>
411
+ </td>
412
+ </tr>
413
+ </table>
414
+ </div>
415
+
416
+ </div>
417
+
418
+
419
+ <div id="instance_method_details" class="method_details_list">
420
+ <h2>Instance Method Details</h2>
421
+
422
+
423
+ <div class="method_details first">
424
+ <h3 class="signature first" id="get_location_by_metadata_path-instance_method">
425
+
426
+ #<strong>get_location_by_metadata_path</strong>(md_path) &#x21d2; <tt><span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">Longleaf::StorageLocation</a></span></tt>
427
+
428
+
429
+
430
+
431
+
432
+ </h3><div class="docstring">
433
+ <div class="discussion">
434
+
435
+ <p>Get the <span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">Longleaf::StorageLocation</a></span> object which should contain the given metadata path</p>
436
+
437
+
438
+ </div>
439
+ </div>
440
+ <div class="tags">
441
+
442
+ <p class="tag_title">Returns:</p>
443
+ <ul class="return">
444
+
445
+ <li>
446
+
447
+
448
+ <span class='type'>(<tt><span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">Longleaf::StorageLocation</a></span></tt>)</span>
449
+
450
+
451
+
452
+ &mdash;
453
+ <div class='inline'>
454
+ <p>location containing the given metadata path or nil if the path is not contained by a registered location.</p>
455
+ </div>
456
+
457
+ </li>
458
+
459
+ </ul>
460
+ <p class="tag_title">Raises:</p>
461
+ <ul class="raise">
462
+
463
+ <li>
464
+
465
+
466
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
467
+
468
+
469
+
470
+ </li>
471
+
472
+ </ul>
473
+
474
+ </div><table class="source_code">
475
+ <tr>
476
+ <td>
477
+ <pre class="lines">
478
+
479
+
480
+ 47
481
+ 48
482
+ 49
483
+ 50
484
+ 51
485
+ 52
486
+ 53
487
+ 54</pre>
488
+ </td>
489
+ <td>
490
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/storage_location_manager.rb', line 47</span>
491
+
492
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_location_by_metadata_path'>get_location_by_metadata_path</span><span class='lparen'>(</span><span class='id identifier rubyid_md_path'>md_path</span><span class='rparen'>)</span>
493
+ <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'>&quot;</span><span class='tstring_content'>Metadata path parameter is required</span><span class='tstring_end'>&quot;</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>
494
+ <span class='ivar'>@locations</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_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_location'>location</span><span class='op'>|</span>
495
+ <span class='kw'>return</span> <span class='id identifier rubyid_location'>location</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_start_with?'>start_with?</span><span class='lparen'>(</span><span class='id identifier rubyid_location'>location</span><span class='period'>.</span><span class='id identifier rubyid_metadata_path'>metadata_path</span><span class='rparen'>)</span>
496
+ <span class='kw'>end</span>
497
+
498
+ <span class='kw'>nil</span>
499
+ <span class='kw'>end</span></pre>
500
+ </td>
501
+ </tr>
502
+ </table>
503
+ </div>
504
+
505
+ <div class="method_details ">
506
+ <h3 class="signature " id="get_location_by_path-instance_method">
507
+
508
+ #<strong>get_location_by_path</strong>(path) &#x21d2; <tt><span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">Longleaf::StorageLocation</a></span></tt>
509
+
510
+
511
+
512
+
513
+
514
+ </h3><div class="docstring">
515
+ <div class="discussion">
516
+
517
+ <p>Get the <span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">Longleaf::StorageLocation</a></span> object which should contain the given path</p>
518
+
519
+
520
+ </div>
521
+ </div>
522
+ <div class="tags">
523
+
524
+ <p class="tag_title">Returns:</p>
525
+ <ul class="return">
526
+
527
+ <li>
528
+
529
+
530
+ <span class='type'>(<tt><span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">Longleaf::StorageLocation</a></span></tt>)</span>
531
+
532
+
533
+
534
+ &mdash;
535
+ <div class='inline'>
536
+ <p>location containing the given path or nil if the path is not contained by a registered location.</p>
537
+ </div>
538
+
539
+ </li>
540
+
541
+ </ul>
542
+ <p class="tag_title">Raises:</p>
543
+ <ul class="raise">
544
+
545
+ <li>
546
+
547
+
548
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
549
+
550
+
551
+
552
+ </li>
553
+
554
+ </ul>
555
+
556
+ </div><table class="source_code">
557
+ <tr>
558
+ <td>
559
+ <pre class="lines">
560
+
561
+
562
+ 35
563
+ 36
564
+ 37
565
+ 38
566
+ 39
567
+ 40
568
+ 41
569
+ 42</pre>
570
+ </td>
571
+ <td>
572
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/storage_location_manager.rb', line 35</span>
573
+
574
+ <span class='kw'>def</span> <span class='id identifier rubyid_get_location_by_path'>get_location_by_path</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
575
+ <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'>&quot;</span><span class='tstring_content'>Path parameter is required</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
576
+ <span class='ivar'>@locations</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_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_location'>location</span><span class='op'>|</span>
577
+ <span class='kw'>return</span> <span class='id identifier rubyid_location'>location</span> <span class='kw'>if</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='id identifier rubyid_location'>location</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
578
+ <span class='kw'>end</span>
579
+
580
+ <span class='kw'>nil</span>
581
+ <span class='kw'>end</span></pre>
582
+ </td>
583
+ </tr>
584
+ </table>
585
+ </div>
586
+
587
+ <div class="method_details ">
588
+ <h3 class="signature " id="verify_path_in_location-instance_method">
589
+
590
+ #<strong>verify_path_in_location</strong>(path, expected_loc = nil) &#x21d2; <tt><span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">StorageLocation</a></span></tt>
591
+
592
+
593
+
594
+
595
+
596
+ </h3><div class="docstring">
597
+ <div class="discussion">
598
+
599
+ <p>Raises a <span class='object_link'><a href="StorageLocationUnavailableError.html" title="Longleaf::StorageLocationUnavailableError (class)">Longleaf::StorageLocationUnavailableError</a></span> if the given path is not in a known storage location,</p>
600
+
601
+ <pre class="code ruby"><code class="ruby">or if it is not within the expected location if provided
602
+ </code></pre>
603
+
604
+
605
+ </div>
606
+ </div>
607
+ <div class="tags">
608
+ <p class="tag_title">Parameters:</p>
609
+ <ul class="param">
610
+
611
+ <li>
612
+
613
+ <span class='name'>path</span>
614
+
615
+
616
+ <span class='type'>(<tt>String</tt>)</span>
617
+
618
+
619
+
620
+ &mdash;
621
+ <div class='inline'>
622
+ <p>file path</p>
623
+ </div>
624
+
625
+ </li>
626
+
627
+ <li>
628
+
629
+ <span class='name'>expected_loc</span>
630
+
631
+
632
+ <span class='type'>(<tt>String</tt>)</span>
633
+
634
+
635
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
636
+
637
+
638
+ &mdash;
639
+ <div class='inline'>
640
+ <p>name of the storage location which path should be contained by</p>
641
+ </div>
642
+
643
+ </li>
644
+
645
+ </ul>
646
+
647
+ <p class="tag_title">Returns:</p>
648
+ <ul class="return">
649
+
650
+ <li>
651
+
652
+
653
+ <span class='type'>(<tt><span class='object_link'><a href="StorageLocation.html" title="Longleaf::StorageLocation (class)">StorageLocation</a></span></tt>)</span>
654
+
655
+
656
+
657
+ &mdash;
658
+ <div class='inline'>
659
+ <p>the storage location which contains path, if it was within one.</p>
660
+ </div>
661
+
662
+ </li>
663
+
664
+ </ul>
665
+ <p class="tag_title">Raises:</p>
666
+ <ul class="raise">
667
+
668
+ <li>
669
+
670
+
671
+ <span class='type'>(<tt><span class='object_link'><a href="StorageLocationUnavailableError.html" title="Longleaf::StorageLocationUnavailableError (class)">StorageLocationUnavailableError</a></span></tt>)</span>
672
+
673
+
674
+
675
+ &mdash;
676
+ <div class='inline'>
677
+ <p>if the path is not in a known/expected storage location</p>
678
+ </div>
679
+
680
+ </li>
681
+
682
+ </ul>
683
+
684
+ </div><table class="source_code">
685
+ <tr>
686
+ <td>
687
+ <pre class="lines">
688
+
689
+
690
+ 62
691
+ 63
692
+ 64
693
+ 65
694
+ 66
695
+ 67
696
+ 68
697
+ 69
698
+ 70</pre>
699
+ </td>
700
+ <td>
701
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/storage_location_manager.rb', line 62</span>
702
+
703
+ <span class='kw'>def</span> <span class='id identifier rubyid_verify_path_in_location'>verify_path_in_location</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_expected_loc'>expected_loc</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
704
+ <span class='id identifier rubyid_location'>location</span> <span class='op'>=</span> <span class='id identifier rubyid_get_location_by_path'>get_location_by_path</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
705
+ <span class='kw'>if</span> <span class='id identifier rubyid_location'>location</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
706
+ <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'>&quot;</span><span class='tstring_content'>Path </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not from a known storage location.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
707
+ <span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_expected_loc'>expected_loc</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_expected_loc'>expected_loc</span> <span class='op'>!=</span> <span class='id identifier rubyid_location'>location</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
708
+ <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'>&quot;</span><span class='tstring_content'>Path </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not contained by storage location </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_expected_loc'>expected_loc</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
709
+ <span class='kw'>end</span>
710
+ <span class='id identifier rubyid_location'>location</span>
711
+ <span class='kw'>end</span></pre>
712
+ </td>
713
+ </tr>
714
+ </table>
715
+ </div>
716
+
717
+ </div>
718
+
719
+ </div>
720
+
721
+ <div id="footer">
722
+ Generated on Tue May 28 15:48:02 2019 by
723
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
724
+ 0.9.19 (ruby-2.6.3).
725
+ </div>
726
+
727
+ </div>
728
+ </body>
729
+ </html>