longleaf 0.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) 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 +150 -0
  108. data/lib/longleaf/candidates/manifest_digest_provider.rb +17 -0
  109. data/lib/longleaf/candidates/physical_path_provider.rb +17 -0
  110. data/lib/longleaf/candidates/registered_file_selector.rb +67 -0
  111. data/lib/longleaf/candidates/service_candidate_filesystem_iterator.rb +93 -0
  112. data/lib/longleaf/candidates/service_candidate_index_iterator.rb +84 -0
  113. data/lib/longleaf/candidates/service_candidate_locator.rb +23 -0
  114. data/lib/longleaf/candidates/single_digest_provider.rb +13 -0
  115. data/lib/longleaf/cli.rb +252 -46
  116. data/lib/longleaf/commands/deregister_command.rb +51 -0
  117. data/lib/longleaf/commands/preserve_command.rb +50 -0
  118. data/lib/longleaf/commands/register_command.rb +34 -43
  119. data/lib/longleaf/commands/reindex_command.rb +92 -0
  120. data/lib/longleaf/commands/validate_config_command.rb +33 -8
  121. data/lib/longleaf/commands/validate_metadata_command.rb +51 -0
  122. data/lib/longleaf/errors.rb +26 -7
  123. data/lib/longleaf/events/deregister_event.rb +53 -0
  124. data/lib/longleaf/events/event_names.rb +9 -0
  125. data/lib/longleaf/events/event_status_tracking.rb +59 -0
  126. data/lib/longleaf/events/preserve_event.rb +82 -0
  127. data/lib/longleaf/events/register_event.rb +59 -51
  128. data/lib/longleaf/helpers/case_insensitive_hash.rb +38 -0
  129. data/lib/longleaf/helpers/digest_helper.rb +56 -0
  130. data/lib/longleaf/helpers/s3_uri_helper.rb +86 -0
  131. data/lib/longleaf/helpers/selection_options_parser.rb +215 -0
  132. data/lib/longleaf/helpers/service_date_helper.rb +78 -0
  133. data/lib/longleaf/indexing/index_manager.rb +101 -0
  134. data/lib/longleaf/indexing/sequel_index_driver.rb +306 -0
  135. data/lib/longleaf/logging.rb +5 -4
  136. data/lib/longleaf/logging/redirecting_logger.rb +30 -25
  137. data/lib/longleaf/models/app_fields.rb +7 -2
  138. data/lib/longleaf/models/file_record.rb +31 -8
  139. data/lib/longleaf/models/filesystem_metadata_location.rb +56 -0
  140. data/lib/longleaf/models/filesystem_storage_location.rb +52 -0
  141. data/lib/longleaf/models/md_fields.rb +3 -1
  142. data/lib/longleaf/models/metadata_location.rb +47 -0
  143. data/lib/longleaf/models/metadata_record.rb +43 -16
  144. data/lib/longleaf/models/s3_storage_location.rb +138 -0
  145. data/lib/longleaf/models/service_definition.rb +7 -6
  146. data/lib/longleaf/models/service_fields.rb +7 -1
  147. data/lib/longleaf/models/service_record.rb +10 -6
  148. data/lib/longleaf/models/storage_location.rb +24 -19
  149. data/lib/longleaf/models/storage_types.rb +9 -0
  150. data/lib/longleaf/models/system_config_fields.rb +9 -0
  151. data/lib/longleaf/preservation_services/file_check_service.rb +59 -0
  152. data/lib/longleaf/preservation_services/fixity_check_service.rb +124 -0
  153. data/lib/longleaf/preservation_services/rsync_replication_service.rb +198 -0
  154. data/lib/longleaf/preservation_services/s3_replication_service.rb +131 -0
  155. data/lib/longleaf/services/application_config_deserializer.rb +81 -24
  156. data/lib/longleaf/services/application_config_manager.rb +20 -6
  157. data/lib/longleaf/services/application_config_validator.rb +19 -9
  158. data/lib/longleaf/services/configuration_validator.rb +67 -4
  159. data/lib/longleaf/services/filesystem_location_validator.rb +16 -0
  160. data/lib/longleaf/services/metadata_deserializer.rb +115 -42
  161. data/lib/longleaf/services/metadata_persistence_manager.rb +47 -0
  162. data/lib/longleaf/services/metadata_serializer.rb +156 -23
  163. data/lib/longleaf/services/metadata_validator.rb +76 -0
  164. data/lib/longleaf/services/s3_location_validator.rb +19 -0
  165. data/lib/longleaf/services/service_class_cache.rb +112 -0
  166. data/lib/longleaf/services/service_definition_manager.rb +10 -7
  167. data/lib/longleaf/services/service_definition_validator.rb +25 -18
  168. data/lib/longleaf/services/service_manager.rb +86 -11
  169. data/lib/longleaf/services/service_mapping_manager.rb +13 -12
  170. data/lib/longleaf/services/service_mapping_validator.rb +36 -26
  171. data/lib/longleaf/services/storage_location_manager.rb +76 -15
  172. data/lib/longleaf/services/storage_location_validator.rb +49 -35
  173. data/lib/longleaf/specs/config_builder.rb +47 -23
  174. data/lib/longleaf/specs/config_validator_helpers.rb +16 -0
  175. data/lib/longleaf/specs/custom_matchers.rb +9 -0
  176. data/lib/longleaf/specs/file_helpers.rb +61 -0
  177. data/lib/longleaf/specs/metadata_builder.rb +98 -0
  178. data/lib/longleaf/specs/system_config_builder.rb +27 -0
  179. data/lib/longleaf/version.rb +1 -1
  180. data/longleaf.gemspec +20 -7
  181. data/mkdocs.yml +21 -0
  182. metadata +308 -24
  183. data/.travis.yml +0 -4
  184. data/lib/longleaf/commands/abstract_command.rb +0 -37
  185. data/lib/longleaf/services/storage_path_validator.rb +0 -16
@@ -0,0 +1,428 @@
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::RegisterCommand
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::RegisterCommand";
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> &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">RegisterCommand</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::RegisterCommand
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::RegisterCommand</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="EventStatusTracking.html" title="Longleaf::EventStatusTracking (module)">EventStatusTracking</a></span></dd>
93
+ </dl>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dl>
101
+ <dt>Defined in:</dt>
102
+ <dd>lib/longleaf/commands/register_command.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <h2>Overview</h2><div class="docstring">
108
+ <div class="discussion">
109
+
110
+ <p>Command for registering files with longleaf</p>
111
+
112
+
113
+ </div>
114
+ </div>
115
+ <div class="tags">
116
+
117
+
118
+ </div>
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <h2>
127
+ Instance Method Summary
128
+ <small><a href="#" class="summary_toggle">collapse</a></small>
129
+ </h2>
130
+
131
+ <ul class="summary">
132
+
133
+ <li class="public ">
134
+ <span class="summary_signature">
135
+
136
+ <a href="#execute-instance_method" title="#execute (instance method)">#<strong>execute</strong>(file_selector:, force: false, checksums: nil) &#x21d2; Integer </a>
137
+
138
+
139
+
140
+ </span>
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <span class="summary_desc"><div class='inline'>
151
+ <p>Execute the register command on the given parameters.</p>
152
+ </div></span>
153
+
154
+ </li>
155
+
156
+
157
+ <li class="public ">
158
+ <span class="summary_signature">
159
+
160
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(app_manager) &#x21d2; RegisterCommand </a>
161
+
162
+
163
+
164
+ </span>
165
+
166
+
167
+ <span class="note title constructor">constructor</span>
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+ <span class="summary_desc"><div class='inline'>
177
+ <p>A new instance of RegisterCommand.</p>
178
+ </div></span>
179
+
180
+ </li>
181
+
182
+
183
+ </ul>
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="EventStatusTracking.html" title="Longleaf::EventStatusTracking (module)">EventStatusTracking</a></span></h3>
196
+ <p class="inherited"><span class='object_link'><a href="EventStatusTracking.html#record_failure-instance_method" title="Longleaf::EventStatusTracking#record_failure (method)">#record_failure</a></span>, <span class='object_link'><a href="EventStatusTracking.html#record_success-instance_method" title="Longleaf::EventStatusTracking#record_success (method)">#record_success</a></span>, <span class='object_link'><a href="EventStatusTracking.html#return_status-instance_method" title="Longleaf::EventStatusTracking#return_status (method)">#return_status</a></span>, <span class='object_link'><a href="EventStatusTracking.html#track_failure-instance_method" title="Longleaf::EventStatusTracking#track_failure (method)">#track_failure</a></span>, <span class='object_link'><a href="EventStatusTracking.html#track_status-instance_method" title="Longleaf::EventStatusTracking#track_status (method)">#track_status</a></span>, <span class='object_link'><a href="EventStatusTracking.html#track_success-instance_method" title="Longleaf::EventStatusTracking#track_success (method)">#track_success</a></span></p>
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></h3>
207
+ <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>
208
+ <div id="constructor_details" class="method_details_list">
209
+ <h2>Constructor Details</h2>
210
+
211
+ <div class="method_details first">
212
+ <h3 class="signature first" id="initialize-instance_method">
213
+
214
+ #<strong>initialize</strong>(app_manager) &#x21d2; <tt><span class='object_link'><a href="" title="Longleaf::RegisterCommand (class)">RegisterCommand</a></span></tt>
215
+
216
+
217
+
218
+
219
+
220
+ </h3><div class="docstring">
221
+ <div class="discussion">
222
+
223
+ <p>Returns a new instance of RegisterCommand</p>
224
+
225
+
226
+ </div>
227
+ </div>
228
+ <div class="tags">
229
+
230
+
231
+ </div><table class="source_code">
232
+ <tr>
233
+ <td>
234
+ <pre class="lines">
235
+
236
+
237
+ 12
238
+ 13
239
+ 14</pre>
240
+ </td>
241
+ <td>
242
+ <pre class="code"><span class="info file"># File 'lib/longleaf/commands/register_command.rb', line 12</span>
243
+
244
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app_manager'>app_manager</span><span class='rparen'>)</span>
245
+ <span class='ivar'>@app_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_app_manager'>app_manager</span>
246
+ <span class='kw'>end</span></pre>
247
+ </td>
248
+ </tr>
249
+ </table>
250
+ </div>
251
+
252
+ </div>
253
+
254
+
255
+ <div id="instance_method_details" class="method_details_list">
256
+ <h2>Instance Method Details</h2>
257
+
258
+
259
+ <div class="method_details first">
260
+ <h3 class="signature first" id="execute-instance_method">
261
+
262
+ #<strong>execute</strong>(file_selector:, force: false, checksums: nil) &#x21d2; <tt>Integer</tt>
263
+
264
+
265
+
266
+
267
+
268
+ </h3><div class="docstring">
269
+ <div class="discussion">
270
+
271
+ <p>Execute the register command on the given parameters</p>
272
+
273
+
274
+ </div>
275
+ </div>
276
+ <div class="tags">
277
+ <p class="tag_title">Parameters:</p>
278
+ <ul class="param">
279
+
280
+ <li>
281
+
282
+ <span class='name'>file_selector</span>
283
+
284
+
285
+ <span class='type'>(<tt><span class='object_link'><a href="FileSelector.html" title="Longleaf::FileSelector (class)">FileSelector</a></span></tt>)</span>
286
+
287
+
288
+
289
+ &mdash;
290
+ <div class='inline'>
291
+ <p>selector for files to register</p>
292
+ </div>
293
+
294
+ </li>
295
+
296
+ <li>
297
+
298
+ <span class='name'>force</span>
299
+
300
+
301
+ <span class='type'>(<tt>Boolean</tt>)</span>
302
+
303
+
304
+
305
+ &mdash;
306
+ <div class='inline'>
307
+ <p>force flag</p>
308
+ </div>
309
+
310
+ </li>
311
+
312
+ <li>
313
+
314
+ <span class='name'>checksums</span>
315
+
316
+
317
+ <span class='type'>(<tt>Array</tt>)</span>
318
+
319
+
320
+
321
+ &mdash;
322
+ <div class='inline'>
323
+ <p>array of checksums</p>
324
+ </div>
325
+
326
+ </li>
327
+
328
+ </ul>
329
+
330
+ <p class="tag_title">Returns:</p>
331
+ <ul class="return">
332
+
333
+ <li>
334
+
335
+
336
+ <span class='type'>(<tt>Integer</tt>)</span>
337
+
338
+
339
+
340
+ &mdash;
341
+ <div class='inline'>
342
+ <p>status code</p>
343
+ </div>
344
+
345
+ </li>
346
+
347
+ </ul>
348
+
349
+ </div><table class="source_code">
350
+ <tr>
351
+ <td>
352
+ <pre class="lines">
353
+
354
+
355
+ 21
356
+ 22
357
+ 23
358
+ 24
359
+ 25
360
+ 26
361
+ 27
362
+ 28
363
+ 29
364
+ 30
365
+ 31
366
+ 32
367
+ 33
368
+ 34
369
+ 35
370
+ 36
371
+ 37
372
+ 38
373
+ 39
374
+ 40
375
+ 41
376
+ 42
377
+ 43
378
+ 44
379
+ 45
380
+ 46</pre>
381
+ </td>
382
+ <td>
383
+ <pre class="code"><span class="info file"># File 'lib/longleaf/commands/register_command.rb', line 21</span>
384
+
385
+ <span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='label'>file_selector:</span><span class='comma'>,</span> <span class='label'>force:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>checksums:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
386
+ <span class='id identifier rubyid_start_time'>start_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
387
+ <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'>&#39;</span><span class='tstring_content'>Performing register command</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span>
388
+ <span class='kw'>begin</span>
389
+ <span class='comment'># Perform register events on each of the file paths provided
390
+ </span> <span class='id identifier rubyid_loop'>loop</span> <span class='kw'>do</span>
391
+ <span class='id identifier rubyid_f_path'>f_path</span> <span class='op'>=</span> <span class='id identifier rubyid_file_selector'>file_selector</span><span class='period'>.</span><span class='id identifier rubyid_next_path'>next_path</span>
392
+ <span class='kw'>break</span> <span class='kw'>if</span> <span class='id identifier rubyid_f_path'>f_path</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
393
+
394
+ <span class='id identifier rubyid_storage_location'>storage_location</span> <span class='op'>=</span> <span class='ivar'>@app_manager</span><span class='period'>.</span><span class='id identifier rubyid_location_manager'>location_manager</span><span class='period'>.</span><span class='id identifier rubyid_get_location_by_path'>get_location_by_path</span><span class='lparen'>(</span><span class='id identifier rubyid_f_path'>f_path</span><span class='rparen'>)</span>
395
+
396
+ <span class='id identifier rubyid_file_rec'>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_f_path'>f_path</span><span class='comma'>,</span> <span class='id identifier rubyid_storage_location'>storage_location</span><span class='rparen'>)</span>
397
+
398
+ <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_file_rec'>file_rec</span><span class='comma'>,</span> <span class='label'>force:</span> <span class='id identifier rubyid_force'>force</span><span class='comma'>,</span> <span class='label'>app_manager:</span> <span class='ivar'>@app_manager</span><span class='comma'>,</span>
399
+ <span class='label'>checksums:</span> <span class='id identifier rubyid_checksums'>checksums</span><span class='rparen'>)</span>
400
+ <span class='id identifier rubyid_track_status'>track_status</span><span class='lparen'>(</span><span class='id identifier rubyid_register_event'>register_event</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='rparen'>)</span>
401
+ <span class='kw'>end</span>
402
+ <span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="InvalidStoragePathError.html" title="Longleaf::InvalidStoragePathError (class)">InvalidStoragePathError</a></span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="StorageLocationUnavailableError.html" title="Longleaf::StorageLocationUnavailableError (class)">StorageLocationUnavailableError</a></span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_err'>err</span>
403
+ <span class='id identifier rubyid_record_failure'>record_failure</span><span class='lparen'>(</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#REGISTER-constant" title="Longleaf::EventNames::REGISTER (constant)">REGISTER</a></span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_err'>err</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
404
+ <span class='kw'>rescue</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_err'>err</span>
405
+ <span class='id identifier rubyid_record_failure'>record_failure</span><span class='lparen'>(</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#REGISTER-constant" title="Longleaf::EventNames::REGISTER (constant)">REGISTER</a></span></span><span class='comma'>,</span> <span class='label'>error:</span> <span class='id identifier rubyid_err'>err</span><span class='rparen'>)</span>
406
+ <span class='kw'>end</span>
407
+
408
+ <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'>&quot;</span><span class='tstring_content'>Completed register command in </span><span class='embexpr_beg'>#{</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='id identifier rubyid_start_time'>start_time</span><span class='embexpr_end'>}</span><span class='tstring_content'>s</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
409
+ <span class='id identifier rubyid_return_status'>return_status</span>
410
+ <span class='kw'>end</span></pre>
411
+ </td>
412
+ </tr>
413
+ </table>
414
+ </div>
415
+
416
+ </div>
417
+
418
+ </div>
419
+
420
+ <div id="footer">
421
+ Generated on Tue May 28 15:48:01 2019 by
422
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
423
+ 0.9.19 (ruby-2.6.3).
424
+ </div>
425
+
426
+ </div>
427
+ </body>
428
+ </html>
@@ -0,0 +1,628 @@
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::RegisterEvent
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::RegisterEvent";
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> &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">RegisterEvent</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::RegisterEvent
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::RegisterEvent</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="EventStatusTracking.html" title="Longleaf::EventStatusTracking (module)">EventStatusTracking</a></span></dd>
93
+ </dl>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dl>
101
+ <dt>Defined in:</dt>
102
+ <dd>lib/longleaf/events/register_event.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <h2>Overview</h2><div class="docstring">
108
+ <div class="discussion">
109
+
110
+ <p>Event to register a file with longleaf</p>
111
+
112
+
113
+ </div>
114
+ </div>
115
+ <div class="tags">
116
+
117
+
118
+ </div>
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+ <h2>
127
+ Instance Method Summary
128
+ <small><a href="#" class="summary_toggle">collapse</a></small>
129
+ </h2>
130
+
131
+ <ul class="summary">
132
+
133
+ <li class="public ">
134
+ <span class="summary_signature">
135
+
136
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(file_rec:, app_manager:, force: false, checksums: nil) &#x21d2; RegisterEvent </a>
137
+
138
+
139
+
140
+ </span>
141
+
142
+
143
+ <span class="note title constructor">constructor</span>
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+ <span class="summary_desc"><div class='inline'>
153
+ <p>A new instance of RegisterEvent.</p>
154
+ </div></span>
155
+
156
+ </li>
157
+
158
+
159
+ <li class="public ">
160
+ <span class="summary_signature">
161
+
162
+ <a href="#perform-instance_method" title="#perform (instance method)">#<strong>perform</strong> &#x21d2; Object </a>
163
+
164
+
165
+
166
+ </span>
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+ <span class="summary_desc"><div class='inline'>
177
+ <p>Perform a registration event on the given file.</p>
178
+ </div></span>
179
+
180
+ </li>
181
+
182
+
183
+ <li class="private ">
184
+ <span class="summary_signature">
185
+
186
+ <a href="#populate_file_properties-instance_method" title="#populate_file_properties (instance method)">#<strong>populate_file_properties</strong> &#x21d2; Object </a>
187
+
188
+
189
+
190
+ </span>
191
+
192
+
193
+
194
+ <span class="note title private">private</span>
195
+
196
+
197
+
198
+
199
+
200
+ <span class="summary_desc"><div class='inline'></div></span>
201
+
202
+ </li>
203
+
204
+
205
+ <li class="private ">
206
+ <span class="summary_signature">
207
+
208
+ <a href="#retain_existing_properties-instance_method" title="#retain_existing_properties (instance method)">#<strong>retain_existing_properties</strong> &#x21d2; Object </a>
209
+
210
+
211
+
212
+ </span>
213
+
214
+
215
+
216
+ <span class="note title private">private</span>
217
+
218
+
219
+
220
+
221
+
222
+ <span class="summary_desc"><div class='inline'>
223
+ <p>Copy a subset of properties from an existing metadata record to the new record.</p>
224
+ </div></span>
225
+
226
+ </li>
227
+
228
+
229
+ </ul>
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="EventStatusTracking.html" title="Longleaf::EventStatusTracking (module)">EventStatusTracking</a></span></h3>
242
+ <p class="inherited"><span class='object_link'><a href="EventStatusTracking.html#record_failure-instance_method" title="Longleaf::EventStatusTracking#record_failure (method)">#record_failure</a></span>, <span class='object_link'><a href="EventStatusTracking.html#record_success-instance_method" title="Longleaf::EventStatusTracking#record_success (method)">#record_success</a></span>, <span class='object_link'><a href="EventStatusTracking.html#return_status-instance_method" title="Longleaf::EventStatusTracking#return_status (method)">#return_status</a></span>, <span class='object_link'><a href="EventStatusTracking.html#track_failure-instance_method" title="Longleaf::EventStatusTracking#track_failure (method)">#track_failure</a></span>, <span class='object_link'><a href="EventStatusTracking.html#track_status-instance_method" title="Longleaf::EventStatusTracking#track_status (method)">#track_status</a></span>, <span class='object_link'><a href="EventStatusTracking.html#track_success-instance_method" title="Longleaf::EventStatusTracking#track_success (method)">#track_success</a></span></p>
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></h3>
253
+ <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>
254
+ <div id="constructor_details" class="method_details_list">
255
+ <h2>Constructor Details</h2>
256
+
257
+ <div class="method_details first">
258
+ <h3 class="signature first" id="initialize-instance_method">
259
+
260
+ #<strong>initialize</strong>(file_rec:, app_manager:, force: false, checksums: nil) &#x21d2; <tt><span class='object_link'><a href="" title="Longleaf::RegisterEvent (class)">RegisterEvent</a></span></tt>
261
+
262
+
263
+
264
+
265
+
266
+ </h3><div class="docstring">
267
+ <div class="discussion">
268
+
269
+ <p>Returns a new instance of RegisterEvent</p>
270
+
271
+
272
+ </div>
273
+ </div>
274
+ <div class="tags">
275
+ <p class="tag_title">Parameters:</p>
276
+ <ul class="param">
277
+
278
+ <li>
279
+
280
+ <span class='name'>file_rec</span>
281
+
282
+
283
+ <span class='type'>(<tt><span class='object_link'><a href="FileRecord.html" title="Longleaf::FileRecord (class)">FileRecord</a></span></tt>)</span>
284
+
285
+
286
+
287
+ &mdash;
288
+ <div class='inline'>
289
+ <p>file record</p>
290
+ </div>
291
+
292
+ </li>
293
+
294
+ <li>
295
+
296
+ <span class='name'>app_manager</span>
297
+
298
+
299
+ <span class='type'>(<tt><span class='object_link'><a href="ApplicationConfigManager.html" title="Longleaf::ApplicationConfigManager (class)">ApplicationConfigManager</a></span></tt>)</span>
300
+
301
+
302
+
303
+ &mdash;
304
+ <div class='inline'>
305
+ <p>the application configuration</p>
306
+ </div>
307
+
308
+ </li>
309
+
310
+ <li>
311
+
312
+ <span class='name'>force</span>
313
+
314
+
315
+ <span class='type'>(<tt>boolean</tt>)</span>
316
+
317
+
318
+
319
+ &mdash;
320
+ <div class='inline'>
321
+ <p>if true, then already registered files will be re-registered</p>
322
+ </div>
323
+
324
+ </li>
325
+
326
+ </ul>
327
+
328
+ <p class="tag_title">Raises:</p>
329
+ <ul class="raise">
330
+
331
+ <li>
332
+
333
+
334
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
335
+
336
+
337
+
338
+ </li>
339
+
340
+ </ul>
341
+
342
+ </div><table class="source_code">
343
+ <tr>
344
+ <td>
345
+ <pre class="lines">
346
+
347
+
348
+ 17
349
+ 18
350
+ 19
351
+ 20
352
+ 21
353
+ 22
354
+ 23
355
+ 24
356
+ 25
357
+ 26
358
+ 27
359
+ 28
360
+ 29</pre>
361
+ </td>
362
+ <td>
363
+ <pre class="code"><span class="info file"># File 'lib/longleaf/events/register_event.rb', line 17</span>
364
+
365
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>file_rec:</span><span class='comma'>,</span> <span class='label'>app_manager:</span><span class='comma'>,</span> <span class='label'>force:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>checksums:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
366
+ <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'>&#39;</span><span class='tstring_content'>Must provide a file_rec parameter</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
367
+ <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'>&#39;</span><span class='tstring_content'>Parameter file_rec must be a FileRecord</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> \
368
+ <span class='kw'>unless</span> <span class='id identifier rubyid_file_rec'>file_rec</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="FileRecord.html" title="Longleaf::FileRecord (class)">FileRecord</a></span></span><span class='rparen'>)</span>
369
+ <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'>&#39;</span><span class='tstring_content'>Must provide an ApplicationConfigManager</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_app_manager'>app_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
370
+ <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'>&#39;</span><span class='tstring_content'>Parameter app_manager must be an ApplicationConfigManager</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> \
371
+ <span class='kw'>unless</span> <span class='id identifier rubyid_app_manager'>app_manager</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="ApplicationConfigManager.html" title="Longleaf::ApplicationConfigManager (class)">ApplicationConfigManager</a></span></span><span class='rparen'>)</span>
372
+
373
+ <span class='ivar'>@app_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_app_manager'>app_manager</span>
374
+ <span class='ivar'>@file_rec</span> <span class='op'>=</span> <span class='id identifier rubyid_file_rec'>file_rec</span>
375
+ <span class='ivar'>@force</span> <span class='op'>=</span> <span class='id identifier rubyid_force'>force</span>
376
+ <span class='ivar'>@checksums</span> <span class='op'>=</span> <span class='id identifier rubyid_checksums'>checksums</span>
377
+ <span class='kw'>end</span></pre>
378
+ </td>
379
+ </tr>
380
+ </table>
381
+ </div>
382
+
383
+ </div>
384
+
385
+
386
+ <div id="instance_method_details" class="method_details_list">
387
+ <h2>Instance Method Details</h2>
388
+
389
+
390
+ <div class="method_details first">
391
+ <h3 class="signature first" id="perform-instance_method">
392
+
393
+ #<strong>perform</strong> &#x21d2; <tt>Object</tt>
394
+
395
+
396
+
397
+
398
+
399
+ </h3><div class="docstring">
400
+ <div class="discussion">
401
+
402
+ <p>Perform a registration event on the given file</p>
403
+
404
+
405
+ </div>
406
+ </div>
407
+ <div class="tags">
408
+
409
+ <p class="tag_title">Raises:</p>
410
+ <ul class="raise">
411
+
412
+ <li>
413
+
414
+
415
+ <span class='type'></span>
416
+
417
+
418
+
419
+
420
+ <div class='inline'>
421
+ <p>RegistrationError if a file cannot be registered</p>
422
+ </div>
423
+
424
+ </li>
425
+
426
+ </ul>
427
+
428
+ </div><table class="source_code">
429
+ <tr>
430
+ <td>
431
+ <pre class="lines">
432
+
433
+
434
+ 33
435
+ 34
436
+ 35
437
+ 36
438
+ 37
439
+ 38
440
+ 39
441
+ 40
442
+ 41
443
+ 42
444
+ 43
445
+ 44
446
+ 45
447
+ 46
448
+ 47
449
+ 48
450
+ 49
451
+ 50
452
+ 51
453
+ 52
454
+ 53
455
+ 54
456
+ 55
457
+ 56
458
+ 57
459
+ 58
460
+ 59
461
+ 60
462
+ 61
463
+ 62
464
+ 63
465
+ 64</pre>
466
+ </td>
467
+ <td>
468
+ <pre class="code"><span class="info file"># File 'lib/longleaf/events/register_event.rb', line 33</span>
469
+
470
+ <span class='kw'>def</span> <span class='id identifier rubyid_perform'>perform</span>
471
+ <span class='kw'>begin</span>
472
+ <span class='comment'># Only need to re-register file if the force flag is provided
473
+ </span> <span class='kw'>if</span> <span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_metadata_present?'>metadata_present?</span> <span class='op'>&amp;&amp;</span> <span class='op'>!</span><span class='ivar'>@force</span>
474
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="RegistrationError.html" title="Longleaf::RegistrationError (class)">RegistrationError</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'>Unable to register &#39;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>&#39;, it is already registered.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
475
+ <span class='kw'>end</span>
476
+
477
+ <span class='comment'># create metadata record
478
+ </span> <span class='id identifier rubyid_md_rec'>md_rec</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="MetadataRecord.html" title="Longleaf::MetadataRecord (class)">MetadataRecord</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="MetadataRecord.html#initialize-instance_method" title="Longleaf::MetadataRecord#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>registered:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='period'>.</span><span class='id identifier rubyid_iso8601'>iso8601</span><span class='lparen'>(</span><span class='int'>3</span><span class='rparen'>)</span><span class='rparen'>)</span>
479
+ <span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_metadata_record'>metadata_record</span> <span class='op'>=</span> <span class='id identifier rubyid_md_rec'>md_rec</span>
480
+
481
+ <span class='comment'># retain significant details from former record
482
+ </span> <span class='kw'>if</span> <span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_metadata_present?'>metadata_present?</span>
483
+ <span class='id identifier rubyid_retain_existing_properties'>retain_existing_properties</span>
484
+ <span class='kw'>end</span>
485
+
486
+ <span class='id identifier rubyid_populate_file_properties'>populate_file_properties</span>
487
+
488
+ <span class='id identifier rubyid_md_rec'>md_rec</span><span class='period'>.</span><span class='id identifier rubyid_checksums'>checksums</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='ivar'>@checksums</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='ivar'>@checksums</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
489
+
490
+ <span class='comment'># persist the metadata
491
+ </span> <span class='ivar'>@app_manager</span><span class='period'>.</span><span class='id identifier rubyid_md_manager'>md_manager</span><span class='period'>.</span><span class='id identifier rubyid_persist'>persist</span><span class='lparen'>(</span><span class='ivar'>@file_rec</span><span class='rparen'>)</span>
492
+
493
+ <span class='id identifier rubyid_record_success'>record_success</span><span class='lparen'>(</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#REGISTER-constant" title="Longleaf::EventNames::REGISTER (constant)">REGISTER</a></span></span><span class='comma'>,</span> <span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
494
+ <span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="RegistrationError.html" title="Longleaf::RegistrationError (class)">RegistrationError</a></span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_err'>err</span>
495
+ <span class='id identifier rubyid_record_failure'>record_failure</span><span class='lparen'>(</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#REGISTER-constant" title="Longleaf::EventNames::REGISTER (constant)">REGISTER</a></span></span><span class='comma'>,</span> <span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_err'>err</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
496
+ <span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="InvalidStoragePathError.html" title="Longleaf::InvalidStoragePathError (class)">InvalidStoragePathError</a></span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_err'>err</span>
497
+ <span class='id identifier rubyid_record_failure'>record_failure</span><span class='lparen'>(</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#REGISTER-constant" title="Longleaf::EventNames::REGISTER (constant)">REGISTER</a></span></span><span class='comma'>,</span> <span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_err'>err</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
498
+ <span class='kw'>end</span>
499
+
500
+ <span class='id identifier rubyid_return_status'>return_status</span>
501
+ <span class='kw'>end</span></pre>
502
+ </td>
503
+ </tr>
504
+ </table>
505
+ </div>
506
+
507
+ <div class="method_details ">
508
+ <h3 class="signature " id="populate_file_properties-instance_method">
509
+
510
+ #<strong>populate_file_properties</strong> &#x21d2; <tt>Object</tt> <span class="extras">(private)</span>
511
+
512
+
513
+
514
+
515
+
516
+ </h3><table class="source_code">
517
+ <tr>
518
+ <td>
519
+ <pre class="lines">
520
+
521
+
522
+ 67
523
+ 68
524
+ 69
525
+ 70
526
+ 71
527
+ 72
528
+ 73</pre>
529
+ </td>
530
+ <td>
531
+ <pre class="code"><span class="info file"># File 'lib/longleaf/events/register_event.rb', line 67</span>
532
+
533
+ <span class='kw'>def</span> <span class='id identifier rubyid_populate_file_properties'>populate_file_properties</span>
534
+ <span class='id identifier rubyid_md_rec'>md_rec</span> <span class='op'>=</span> <span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_metadata_record'>metadata_record</span>
535
+
536
+ <span class='comment'># Set file properties
537
+ </span> <span class='id identifier rubyid_md_rec'>md_rec</span><span class='period'>.</span><span class='id identifier rubyid_last_modified'>last_modified</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_mtime'>mtime</span><span class='lparen'>(</span><span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='period'>.</span><span class='id identifier rubyid_iso8601'>iso8601</span><span class='lparen'>(</span><span class='int'>3</span><span class='rparen'>)</span>
538
+ <span class='id identifier rubyid_md_rec'>md_rec</span><span class='period'>.</span><span class='id identifier rubyid_file_size'>file_size</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='lparen'>(</span><span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
539
+ <span class='kw'>end</span></pre>
540
+ </td>
541
+ </tr>
542
+ </table>
543
+ </div>
544
+
545
+ <div class="method_details ">
546
+ <h3 class="signature " id="retain_existing_properties-instance_method">
547
+
548
+ #<strong>retain_existing_properties</strong> &#x21d2; <tt>Object</tt> <span class="extras">(private)</span>
549
+
550
+
551
+
552
+
553
+
554
+ </h3><div class="docstring">
555
+ <div class="discussion">
556
+
557
+ <p>Copy a subset of properties from an existing metadata record to the new record</p>
558
+
559
+
560
+ </div>
561
+ </div>
562
+ <div class="tags">
563
+
564
+
565
+ </div><table class="source_code">
566
+ <tr>
567
+ <td>
568
+ <pre class="lines">
569
+
570
+
571
+ 76
572
+ 77
573
+ 78
574
+ 79
575
+ 80
576
+ 81
577
+ 82
578
+ 83
579
+ 84
580
+ 85
581
+ 86
582
+ 87
583
+ 88
584
+ 89
585
+ 90
586
+ 91
587
+ 92
588
+ 93</pre>
589
+ </td>
590
+ <td>
591
+ <pre class="code"><span class="info file"># File 'lib/longleaf/events/register_event.rb', line 76</span>
592
+
593
+ <span class='kw'>def</span> <span class='id identifier rubyid_retain_existing_properties'>retain_existing_properties</span>
594
+ <span class='id identifier rubyid_md_rec'>md_rec</span> <span class='op'>=</span> <span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_metadata_record'>metadata_record</span>
595
+
596
+ <span class='id identifier rubyid_old_md'>old_md</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="MetadataDeserializer.html" title="Longleaf::MetadataDeserializer (class)">MetadataDeserializer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_deserialize'><span class='object_link'><a href="MetadataDeserializer.html#deserialize-class_method" title="Longleaf::MetadataDeserializer.deserialize (method)">deserialize</a></span></span><span class='lparen'>(</span><span class='label'>file_path:</span> <span class='ivar'>@file_rec</span><span class='period'>.</span><span class='id identifier rubyid_metadata_path'>metadata_path</span><span class='comma'>,</span>
597
+ <span class='label'>digest_algs:</span> <span class='ivar'>@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_metadata_digests'>metadata_digests</span><span class='rparen'>)</span>
598
+ <span class='comment'># Copy custom properties
599
+ </span> <span class='id identifier rubyid_old_md'>old_md</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_md_rec'>md_rec</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</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_value'>value</span> <span class='rbrace'>}</span>
600
+ <span class='comment'># Copy stale-replicas flag per service
601
+ </span> <span class='id identifier rubyid_old_md'>old_md</span><span class='period'>.</span><span class='id identifier rubyid_list_services'>list_services</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_serv_name'>serv_name</span><span class='op'>|</span>
602
+ <span class='id identifier rubyid_serv_rec'>serv_rec</span> <span class='op'>=</span> <span class='id identifier rubyid_old_md'>old_md</span><span class='period'>.</span><span class='id identifier rubyid_service'>service</span><span class='lparen'>(</span><span class='id identifier rubyid_serv_name'>serv_name</span><span class='rparen'>)</span>
603
+
604
+ <span class='id identifier rubyid_stale_replicas'>stale_replicas</span> <span class='op'>=</span> <span class='id identifier rubyid_serv_rec'>serv_rec</span><span class='period'>.</span><span class='id identifier rubyid_stale_replicas'>stale_replicas</span>
605
+ <span class='kw'>if</span> <span class='id identifier rubyid_stale_replicas'>stale_replicas</span>
606
+ <span class='id identifier rubyid_new_service'>new_service</span> <span class='op'>=</span> <span class='id identifier rubyid_md_rec'>md_rec</span><span class='period'>.</span><span class='id identifier rubyid_service'>service</span><span class='lparen'>(</span><span class='id identifier rubyid_serv_name'>serv_name</span><span class='rparen'>)</span>
607
+ <span class='id identifier rubyid_new_service'>new_service</span><span class='period'>.</span><span class='id identifier rubyid_stale_replicas'>stale_replicas</span> <span class='op'>=</span> <span class='id identifier rubyid_stale_replicas'>stale_replicas</span> <span class='kw'>unless</span> <span class='id identifier rubyid_new_service'>new_service</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
608
+ <span class='kw'>end</span>
609
+ <span class='kw'>end</span>
610
+ <span class='kw'>end</span></pre>
611
+ </td>
612
+ </tr>
613
+ </table>
614
+ </div>
615
+
616
+ </div>
617
+
618
+ </div>
619
+
620
+ <div id="footer">
621
+ Generated on Tue May 28 15:48:01 2019 by
622
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
623
+ 0.9.19 (ruby-2.6.3).
624
+ </div>
625
+
626
+ </div>
627
+ </body>
628
+ </html>