longleaf 0.2.0.pre.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +84 -0
  3. data/.gitignore +4 -2
  4. data/.rubocop.yml +42 -2
  5. data/.rubocop_todo.yml +390 -311
  6. data/.yardopts +1 -0
  7. data/Gemfile +16 -1
  8. data/README.md +67 -13
  9. data/Rakefile +6 -0
  10. data/bin/setup +16 -1
  11. data/docs/aboutlongleaf.md +28 -0
  12. data/docs/extra.css +32 -0
  13. data/docs/img/change-file.png +0 -0
  14. data/docs/img/ll-example-preserved.png +0 -0
  15. data/docs/index.md +19 -0
  16. data/docs/install.md +66 -0
  17. data/docs/ll-example/config-example-relative.yml +33 -0
  18. data/docs/ll-example/files-dir/LLexample-PDF.pdf +0 -0
  19. data/docs/ll-example/files-dir/LLexample-TOCHANGE.txt +15 -0
  20. data/docs/ll-example/files-dir/LLexample-tokeep.txt +10 -0
  21. data/docs/ll-example/metadata-dir/.gitkeep +0 -0
  22. data/docs/ll-example/replica-files/.gitkeep +0 -0
  23. data/docs/ll-example/replica-metadata/.gitkeep +0 -0
  24. data/docs/quickstart.md +270 -0
  25. data/docs/rdocs/Longleaf.html +135 -0
  26. data/docs/rdocs/Longleaf/AppFields.html +178 -0
  27. data/docs/rdocs/Longleaf/ApplicationConfigDeserializer.html +631 -0
  28. data/docs/rdocs/Longleaf/ApplicationConfigManager.html +610 -0
  29. data/docs/rdocs/Longleaf/ApplicationConfigValidator.html +238 -0
  30. data/docs/rdocs/Longleaf/CLI.html +909 -0
  31. data/docs/rdocs/Longleaf/ChecksumMismatchError.html +151 -0
  32. data/docs/rdocs/Longleaf/ConfigBuilder.html +1339 -0
  33. data/docs/rdocs/Longleaf/ConfigurationError.html +143 -0
  34. data/docs/rdocs/Longleaf/ConfigurationValidator.html +227 -0
  35. data/docs/rdocs/Longleaf/DeregisterCommand.html +420 -0
  36. data/docs/rdocs/Longleaf/DeregisterEvent.html +453 -0
  37. data/docs/rdocs/Longleaf/DeregistrationError.html +151 -0
  38. data/docs/rdocs/Longleaf/DigestHelper.html +419 -0
  39. data/docs/rdocs/Longleaf/EventError.html +147 -0
  40. data/docs/rdocs/Longleaf/EventNames.html +163 -0
  41. data/docs/rdocs/Longleaf/EventStatusTracking.html +656 -0
  42. data/docs/rdocs/Longleaf/FileCheckService.html +540 -0
  43. data/docs/rdocs/Longleaf/FileHelpers.html +520 -0
  44. data/docs/rdocs/Longleaf/FileRecord.html +716 -0
  45. data/docs/rdocs/Longleaf/FileSelector.html +901 -0
  46. data/docs/rdocs/Longleaf/FixityCheckService.html +691 -0
  47. data/docs/rdocs/Longleaf/IndexManager.html +1155 -0
  48. data/docs/rdocs/Longleaf/InvalidDigestAlgorithmError.html +143 -0
  49. data/docs/rdocs/Longleaf/InvalidStoragePathError.html +143 -0
  50. data/docs/rdocs/Longleaf/Logging.html +405 -0
  51. data/docs/rdocs/Longleaf/Logging/RedirectingLogger.html +1213 -0
  52. data/docs/rdocs/Longleaf/LongleafError.html +139 -0
  53. data/docs/rdocs/Longleaf/MDFields.html +193 -0
  54. data/docs/rdocs/Longleaf/MetadataBuilder.html +787 -0
  55. data/docs/rdocs/Longleaf/MetadataDeserializer.html +537 -0
  56. data/docs/rdocs/Longleaf/MetadataError.html +143 -0
  57. data/docs/rdocs/Longleaf/MetadataPersistenceManager.html +539 -0
  58. data/docs/rdocs/Longleaf/MetadataRecord.html +1411 -0
  59. data/docs/rdocs/Longleaf/MetadataSerializer.html +786 -0
  60. data/docs/rdocs/Longleaf/PreservationServiceError.html +147 -0
  61. data/docs/rdocs/Longleaf/PreserveCommand.html +410 -0
  62. data/docs/rdocs/Longleaf/PreserveEvent.html +491 -0
  63. data/docs/rdocs/Longleaf/RegisterCommand.html +428 -0
  64. data/docs/rdocs/Longleaf/RegisterEvent.html +628 -0
  65. data/docs/rdocs/Longleaf/RegisteredFileSelector.html +446 -0
  66. data/docs/rdocs/Longleaf/RegistrationError.html +151 -0
  67. data/docs/rdocs/Longleaf/ReindexCommand.html +576 -0
  68. data/docs/rdocs/Longleaf/RsyncReplicationService.html +1180 -0
  69. data/docs/rdocs/Longleaf/SequelIndexDriver.html +1978 -0
  70. data/docs/rdocs/Longleaf/ServiceCandidateFilesystemIterator.html +572 -0
  71. data/docs/rdocs/Longleaf/ServiceCandidateIndexIterator.html +532 -0
  72. data/docs/rdocs/Longleaf/ServiceCandidateLocator.html +333 -0
  73. data/docs/rdocs/Longleaf/ServiceClassCache.html +725 -0
  74. data/docs/rdocs/Longleaf/ServiceDateHelper.html +425 -0
  75. data/docs/rdocs/Longleaf/ServiceDefinition.html +683 -0
  76. data/docs/rdocs/Longleaf/ServiceDefinitionManager.html +371 -0
  77. data/docs/rdocs/Longleaf/ServiceDefinitionValidator.html +269 -0
  78. data/docs/rdocs/Longleaf/ServiceFields.html +173 -0
  79. data/docs/rdocs/Longleaf/ServiceManager.html +1229 -0
  80. data/docs/rdocs/Longleaf/ServiceMappingManager.html +410 -0
  81. data/docs/rdocs/Longleaf/ServiceMappingValidator.html +347 -0
  82. data/docs/rdocs/Longleaf/ServiceRecord.html +821 -0
  83. data/docs/rdocs/Longleaf/StorageLocation.html +985 -0
  84. data/docs/rdocs/Longleaf/StorageLocationManager.html +729 -0
  85. data/docs/rdocs/Longleaf/StorageLocationUnavailableError.html +143 -0
  86. data/docs/rdocs/Longleaf/StorageLocationValidator.html +373 -0
  87. data/docs/rdocs/Longleaf/StoragePathValidator.html +253 -0
  88. data/docs/rdocs/Longleaf/SystemConfigBuilder.html +441 -0
  89. data/docs/rdocs/Longleaf/SystemConfigFields.html +163 -0
  90. data/docs/rdocs/Longleaf/ValidateConfigCommand.html +451 -0
  91. data/docs/rdocs/Longleaf/ValidateMetadataCommand.html +408 -0
  92. data/docs/rdocs/_index.html +660 -0
  93. data/docs/rdocs/class_list.html +51 -0
  94. data/docs/rdocs/css/common.css +1 -0
  95. data/docs/rdocs/css/full_list.css +58 -0
  96. data/docs/rdocs/css/style.css +496 -0
  97. data/docs/rdocs/file.README.html +165 -0
  98. data/docs/rdocs/file_list.html +56 -0
  99. data/docs/rdocs/frames.html +17 -0
  100. data/docs/rdocs/index.html +165 -0
  101. data/docs/rdocs/js/app.js +303 -0
  102. data/docs/rdocs/js/full_list.js +216 -0
  103. data/docs/rdocs/js/jquery.js +4 -0
  104. data/docs/rdocs/method_list.html +2051 -0
  105. data/docs/rdocs/top-level-namespace.html +110 -0
  106. data/lib/longleaf/candidates/file_selector.rb +47 -15
  107. data/lib/longleaf/candidates/registered_file_selector.rb +67 -0
  108. data/lib/longleaf/candidates/service_candidate_filesystem_iterator.rb +29 -35
  109. data/lib/longleaf/candidates/service_candidate_index_iterator.rb +84 -0
  110. data/lib/longleaf/candidates/service_candidate_locator.rb +9 -4
  111. data/lib/longleaf/cli.rb +162 -80
  112. data/lib/longleaf/commands/deregister_command.rb +12 -11
  113. data/lib/longleaf/commands/preserve_command.rb +13 -8
  114. data/lib/longleaf/commands/register_command.rb +9 -6
  115. data/lib/longleaf/commands/reindex_command.rb +92 -0
  116. data/lib/longleaf/commands/validate_config_command.rb +27 -6
  117. data/lib/longleaf/commands/validate_metadata_command.rb +11 -9
  118. data/lib/longleaf/errors.rb +12 -12
  119. data/lib/longleaf/events/deregister_event.rb +13 -15
  120. data/lib/longleaf/events/event_status_tracking.rb +7 -7
  121. data/lib/longleaf/events/preserve_event.rb +24 -14
  122. data/lib/longleaf/events/register_event.rb +21 -35
  123. data/lib/longleaf/helpers/digest_helper.rb +4 -4
  124. data/lib/longleaf/helpers/service_date_helper.rb +5 -6
  125. data/lib/longleaf/indexing/index_manager.rb +101 -0
  126. data/lib/longleaf/indexing/sequel_index_driver.rb +324 -0
  127. data/lib/longleaf/logging.rb +4 -4
  128. data/lib/longleaf/logging/redirecting_logger.rb +20 -20
  129. data/lib/longleaf/models/app_fields.rb +2 -1
  130. data/lib/longleaf/models/file_record.rb +10 -6
  131. data/lib/longleaf/models/md_fields.rb +1 -1
  132. data/lib/longleaf/models/metadata_record.rb +22 -12
  133. data/lib/longleaf/models/service_definition.rb +3 -3
  134. data/lib/longleaf/models/service_fields.rb +1 -1
  135. data/lib/longleaf/models/service_record.rb +6 -5
  136. data/lib/longleaf/models/storage_location.rb +26 -7
  137. data/lib/longleaf/models/system_config_fields.rb +9 -0
  138. data/lib/longleaf/preservation_services/file_check_service.rb +58 -0
  139. data/lib/longleaf/preservation_services/fixity_check_service.rb +16 -14
  140. data/lib/longleaf/preservation_services/rsync_replication_service.rb +32 -31
  141. data/lib/longleaf/services/application_config_deserializer.rb +55 -18
  142. data/lib/longleaf/services/application_config_manager.rb +16 -4
  143. data/lib/longleaf/services/application_config_validator.rb +1 -2
  144. data/lib/longleaf/services/configuration_validator.rb +6 -4
  145. data/lib/longleaf/services/metadata_deserializer.rb +40 -38
  146. data/lib/longleaf/services/metadata_persistence_manager.rb +46 -0
  147. data/lib/longleaf/services/metadata_serializer.rb +23 -22
  148. data/lib/longleaf/services/service_class_cache.rb +15 -15
  149. data/lib/longleaf/services/service_definition_manager.rb +5 -6
  150. data/lib/longleaf/services/service_definition_validator.rb +5 -6
  151. data/lib/longleaf/services/service_manager.rb +37 -17
  152. data/lib/longleaf/services/service_mapping_manager.rb +9 -9
  153. data/lib/longleaf/services/service_mapping_validator.rb +9 -10
  154. data/lib/longleaf/services/storage_location_manager.rb +22 -8
  155. data/lib/longleaf/services/storage_location_validator.rb +11 -8
  156. data/lib/longleaf/services/storage_path_validator.rb +1 -1
  157. data/lib/longleaf/specs/config_builder.rb +30 -17
  158. data/lib/longleaf/specs/custom_matchers.rb +1 -1
  159. data/lib/longleaf/specs/file_helpers.rb +15 -14
  160. data/lib/longleaf/specs/metadata_builder.rb +91 -0
  161. data/lib/longleaf/specs/system_config_builder.rb +27 -0
  162. data/lib/longleaf/version.rb +1 -1
  163. data/longleaf.gemspec +17 -7
  164. data/mkdocs.yml +20 -0
  165. metadata +233 -22
@@ -0,0 +1,540 @@
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::FileCheckService
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::FileCheckService";
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 (F)</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">FileCheckService</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::FileCheckService
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::FileCheckService</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <dl>
91
+ <dt>Includes:</dt>
92
+ <dd><span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></dd>
93
+ </dl>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dl>
101
+ <dt>Defined in:</dt>
102
+ <dd>lib/longleaf/preservation_services/file_check_service.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <h2>Overview</h2><div class="docstring">
108
+ <div class="discussion">
109
+
110
+ <p>Preservation service which validates a file using current filesystem information compared against the last registered details for that file. Checks using file name, size and last modified timestamp.</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>(service_def, app_manager) &#x21d2; FileCheckService </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>Initialize a FileCheckService from the given service definition.</p>
154
+ </div></span>
155
+
156
+ </li>
157
+
158
+
159
+ <li class="public ">
160
+ <span class="summary_signature">
161
+
162
+ <a href="#is_applicable%3F-instance_method" title="#is_applicable? (instance method)">#<strong>is_applicable?</strong>(event) &#x21d2; Boolean </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>Determine if this service is applicable for the provided event, given the configured service definition.</p>
178
+ </div></span>
179
+
180
+ </li>
181
+
182
+
183
+ <li class="public ">
184
+ <span class="summary_signature">
185
+
186
+ <a href="#perform-instance_method" title="#perform (instance method)">#<strong>perform</strong>(file_rec, event) &#x21d2; Object </a>
187
+
188
+
189
+
190
+ </span>
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+ <span class="summary_desc"><div class='inline'>
201
+ <p>Perform file information check.</p>
202
+ </div></span>
203
+
204
+ </li>
205
+
206
+
207
+ </ul>
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></h3>
220
+ <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>
221
+ <div id="constructor_details" class="method_details_list">
222
+ <h2>Constructor Details</h2>
223
+
224
+ <div class="method_details first">
225
+ <h3 class="signature first" id="initialize-instance_method">
226
+
227
+ #<strong>initialize</strong>(service_def, app_manager) &#x21d2; <tt><span class='object_link'><a href="" title="Longleaf::FileCheckService (class)">FileCheckService</a></span></tt>
228
+
229
+
230
+
231
+
232
+
233
+ </h3><div class="docstring">
234
+ <div class="discussion">
235
+
236
+ <p>Initialize a FileCheckService from the given service definition</p>
237
+
238
+
239
+ </div>
240
+ </div>
241
+ <div class="tags">
242
+ <p class="tag_title">Parameters:</p>
243
+ <ul class="param">
244
+
245
+ <li>
246
+
247
+ <span class='name'>service_def</span>
248
+
249
+
250
+ <span class='type'>(<tt><span class='object_link'><a href="ServiceDefinition.html" title="Longleaf::ServiceDefinition (class)">ServiceDefinition</a></span></tt>)</span>
251
+
252
+
253
+
254
+ &mdash;
255
+ <div class='inline'>
256
+ <p>the configuration for this service</p>
257
+ </div>
258
+
259
+ </li>
260
+
261
+ <li>
262
+
263
+ <span class='name'>app_manager</span>
264
+
265
+
266
+ <span class='type'>(<tt><span class='object_link'><a href="ApplicationConfigManager.html" title="Longleaf::ApplicationConfigManager (class)">ApplicationConfigManager</a></span></tt>)</span>
267
+
268
+
269
+
270
+ &mdash;
271
+ <div class='inline'>
272
+ <p>manager for configured storage locations</p>
273
+ </div>
274
+
275
+ </li>
276
+
277
+ </ul>
278
+
279
+
280
+ </div><table class="source_code">
281
+ <tr>
282
+ <td>
283
+ <pre class="lines">
284
+
285
+
286
+ 14
287
+ 15
288
+ 16
289
+ 17</pre>
290
+ </td>
291
+ <td>
292
+ <pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/file_check_service.rb', line 14</span>
293
+
294
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_service_def'>service_def</span><span class='comma'>,</span> <span class='id identifier rubyid_app_manager'>app_manager</span><span class='rparen'>)</span>
295
+ <span class='ivar'>@service_def</span> <span class='op'>=</span> <span class='id identifier rubyid_service_def'>service_def</span>
296
+ <span class='ivar'>@app_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_app_manager'>app_manager</span>
297
+ <span class='kw'>end</span></pre>
298
+ </td>
299
+ </tr>
300
+ </table>
301
+ </div>
302
+
303
+ </div>
304
+
305
+
306
+ <div id="instance_method_details" class="method_details_list">
307
+ <h2>Instance Method Details</h2>
308
+
309
+
310
+ <div class="method_details first">
311
+ <h3 class="signature first" id="is_applicable?-instance_method">
312
+
313
+ #<strong>is_applicable?</strong>(event) &#x21d2; <tt>Boolean</tt>
314
+
315
+
316
+
317
+
318
+
319
+ </h3><div class="docstring">
320
+ <div class="discussion">
321
+
322
+ <p>Determine if this service is applicable for the provided event, given the configured service definition</p>
323
+
324
+
325
+ </div>
326
+ </div>
327
+ <div class="tags">
328
+ <p class="tag_title">Parameters:</p>
329
+ <ul class="param">
330
+
331
+ <li>
332
+
333
+ <span class='name'>event</span>
334
+
335
+
336
+ <span class='type'>(<tt>String</tt>)</span>
337
+
338
+
339
+
340
+ &mdash;
341
+ <div class='inline'>
342
+ <p>name of the event</p>
343
+ </div>
344
+
345
+ </li>
346
+
347
+ </ul>
348
+
349
+ <p class="tag_title">Returns:</p>
350
+ <ul class="return">
351
+
352
+ <li>
353
+
354
+
355
+ <span class='type'>(<tt>Boolean</tt>)</span>
356
+
357
+
358
+
359
+ &mdash;
360
+ <div class='inline'>
361
+ <p>returns true if this service is applicable for the provided event</p>
362
+ </div>
363
+
364
+ </li>
365
+
366
+ </ul>
367
+
368
+ </div><table class="source_code">
369
+ <tr>
370
+ <td>
371
+ <pre class="lines">
372
+
373
+
374
+ 49
375
+ 50
376
+ 51
377
+ 52
378
+ 53
379
+ 54
380
+ 55
381
+ 56</pre>
382
+ </td>
383
+ <td>
384
+ <pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/file_check_service.rb', line 49</span>
385
+
386
+ <span class='kw'>def</span> <span class='id identifier rubyid_is_applicable?'>is_applicable?</span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
387
+ <span class='kw'>case</span> <span class='id identifier rubyid_event'>event</span>
388
+ <span class='kw'>when</span> <span class='const'><span class='object_link'><a href="EventNames.html" title="Longleaf::EventNames (class)">EventNames</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="EventNames.html#PRESERVE-constant" title="Longleaf::EventNames::PRESERVE (constant)">PRESERVE</a></span></span>
389
+ <span class='kw'>true</span>
390
+ <span class='kw'>else</span>
391
+ <span class='kw'>false</span>
392
+ <span class='kw'>end</span>
393
+ <span class='kw'>end</span></pre>
394
+ </td>
395
+ </tr>
396
+ </table>
397
+ </div>
398
+
399
+ <div class="method_details ">
400
+ <h3 class="signature " id="perform-instance_method">
401
+
402
+ #<strong>perform</strong>(file_rec, event) &#x21d2; <tt>Object</tt>
403
+
404
+
405
+
406
+
407
+
408
+ </h3><div class="docstring">
409
+ <div class="discussion">
410
+
411
+ <p>Perform file information check.</p>
412
+
413
+
414
+ </div>
415
+ </div>
416
+ <div class="tags">
417
+ <p class="tag_title">Parameters:</p>
418
+ <ul class="param">
419
+
420
+ <li>
421
+
422
+ <span class='name'>file_rec</span>
423
+
424
+
425
+ <span class='type'>(<tt><span class='object_link'><a href="FileRecord.html" title="Longleaf::FileRecord (class)">FileRecord</a></span></tt>)</span>
426
+
427
+
428
+
429
+ &mdash;
430
+ <div class='inline'>
431
+ <p>record representing the file to perform the service on.</p>
432
+ </div>
433
+
434
+ </li>
435
+
436
+ <li>
437
+
438
+ <span class='name'>event</span>
439
+
440
+
441
+ <span class='type'>(<tt>String</tt>)</span>
442
+
443
+
444
+
445
+ &mdash;
446
+ <div class='inline'>
447
+ <p>name of the event this service is being invoked by.</p>
448
+ </div>
449
+
450
+ </li>
451
+
452
+ </ul>
453
+
454
+ <p class="tag_title">Raises:</p>
455
+ <ul class="raise">
456
+
457
+ <li>
458
+
459
+
460
+ <span class='type'>(<tt><span class='object_link'><a href="PreservationServiceError.html" title="Longleaf::PreservationServiceError (class)">PreservationServiceError</a></span></tt>)</span>
461
+
462
+
463
+
464
+ &mdash;
465
+ <div class='inline'>
466
+ <p>if the file system information does not match the stored details</p>
467
+ </div>
468
+
469
+ </li>
470
+
471
+ </ul>
472
+
473
+ </div><table class="source_code">
474
+ <tr>
475
+ <td>
476
+ <pre class="lines">
477
+
478
+
479
+ 24
480
+ 25
481
+ 26
482
+ 27
483
+ 28
484
+ 29
485
+ 30
486
+ 31
487
+ 32
488
+ 33
489
+ 34
490
+ 35
491
+ 36
492
+ 37
493
+ 38
494
+ 39
495
+ 40
496
+ 41
497
+ 42
498
+ 43</pre>
499
+ </td>
500
+ <td>
501
+ <pre class="code"><span class="info file"># File 'lib/longleaf/preservation_services/file_check_service.rb', line 24</span>
502
+
503
+ <span class='kw'>def</span> <span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='comma'>,</span> <span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
504
+ <span class='id identifier rubyid_file_path'>file_path</span> <span class='op'>=</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span>
505
+ <span class='id identifier rubyid_md_rec'>md_rec</span> <span class='op'>=</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_metadata_record'>metadata_record</span>
506
+
507
+ <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Performing file information check of </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_path'>file_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
508
+
509
+ <span class='kw'>if</span> <span class='op'>!</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span>
510
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="PreservationServiceError.html" title="Longleaf::PreservationServiceError (class)">PreservationServiceError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>File does not exist: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_path'>file_path</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
511
+ <span class='kw'>end</span>
512
+
513
+ <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='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
514
+ <span class='kw'>if</span> <span class='id identifier rubyid_file_size'>file_size</span> <span class='op'>!=</span> <span class='id identifier rubyid_md_rec'>md_rec</span><span class='period'>.</span><span class='id identifier rubyid_file_size'>file_size</span>
515
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="PreservationServiceError.html" title="Longleaf::PreservationServiceError (class)">PreservationServiceError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>File size for </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_path'>file_path</span><span class='embexpr_end'>}</span><span class='tstring_content'> does not match the expected value: registered = </span><span class='embexpr_beg'>#{</span><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='embexpr_end'>}</span><span class='tstring_content'> bytes, actual = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_size'>file_size</span><span class='embexpr_end'>}</span><span class='tstring_content'> bytes</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
516
+ <span class='kw'>end</span>
517
+
518
+ <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='id identifier rubyid_file_rec'>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>
519
+ <span class='kw'>if</span> <span class='id identifier rubyid_last_modified'>last_modified</span> <span class='op'>!=</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>
520
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="PreservationServiceError.html" title="Longleaf::PreservationServiceError (class)">PreservationServiceError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Last modified timestamp for </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_path'>file_path</span><span class='embexpr_end'>}</span><span class='tstring_content'> does not match the expected value: registered = </span><span class='embexpr_beg'>#{</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='embexpr_end'>}</span><span class='tstring_content'>, actual = </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_last_modified'>last_modified</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
521
+ <span class='kw'>end</span>
522
+ <span class='kw'>end</span></pre>
523
+ </td>
524
+ </tr>
525
+ </table>
526
+ </div>
527
+
528
+ </div>
529
+
530
+ </div>
531
+
532
+ <div id="footer">
533
+ Generated on Tue May 28 15:48:02 2019 by
534
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
535
+ 0.9.19 (ruby-2.6.3).
536
+ </div>
537
+
538
+ </div>
539
+ </body>
540
+ </html>