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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +94 -0
- data/.editorconfig +13 -0
- data/.gitignore +4 -1
- data/.rubocop.yml +44 -0
- data/.rubocop_todo.yml +834 -0
- data/.yardopts +1 -0
- data/Gemfile +16 -1
- data/README.md +98 -12
- data/Rakefile +6 -0
- data/bin/setup +16 -1
- data/docs/aboutlongleaf.md +28 -0
- data/docs/extra.css +32 -0
- data/docs/img/change-file.png +0 -0
- data/docs/img/ll-example-preserved.png +0 -0
- data/docs/index.md +19 -0
- data/docs/install.md +66 -0
- data/docs/ll-example/config-example-relative.yml +33 -0
- data/docs/ll-example/files-dir/LLexample-PDF.pdf +0 -0
- data/docs/ll-example/files-dir/LLexample-TOCHANGE.txt +15 -0
- data/docs/ll-example/files-dir/LLexample-tokeep.txt +10 -0
- data/docs/ll-example/metadata-dir/.gitkeep +0 -0
- data/docs/ll-example/replica-files/.gitkeep +0 -0
- data/docs/ll-example/replica-metadata/.gitkeep +0 -0
- data/docs/quickstart.md +270 -0
- data/docs/rdocs/Longleaf.html +135 -0
- data/docs/rdocs/Longleaf/AppFields.html +178 -0
- data/docs/rdocs/Longleaf/ApplicationConfigDeserializer.html +631 -0
- data/docs/rdocs/Longleaf/ApplicationConfigManager.html +610 -0
- data/docs/rdocs/Longleaf/ApplicationConfigValidator.html +238 -0
- data/docs/rdocs/Longleaf/CLI.html +909 -0
- data/docs/rdocs/Longleaf/ChecksumMismatchError.html +151 -0
- data/docs/rdocs/Longleaf/ConfigBuilder.html +1339 -0
- data/docs/rdocs/Longleaf/ConfigurationError.html +143 -0
- data/docs/rdocs/Longleaf/ConfigurationValidator.html +227 -0
- data/docs/rdocs/Longleaf/DeregisterCommand.html +420 -0
- data/docs/rdocs/Longleaf/DeregisterEvent.html +453 -0
- data/docs/rdocs/Longleaf/DeregistrationError.html +151 -0
- data/docs/rdocs/Longleaf/DigestHelper.html +419 -0
- data/docs/rdocs/Longleaf/EventError.html +147 -0
- data/docs/rdocs/Longleaf/EventNames.html +163 -0
- data/docs/rdocs/Longleaf/EventStatusTracking.html +656 -0
- data/docs/rdocs/Longleaf/FileCheckService.html +540 -0
- data/docs/rdocs/Longleaf/FileHelpers.html +520 -0
- data/docs/rdocs/Longleaf/FileRecord.html +716 -0
- data/docs/rdocs/Longleaf/FileSelector.html +901 -0
- data/docs/rdocs/Longleaf/FixityCheckService.html +691 -0
- data/docs/rdocs/Longleaf/IndexManager.html +1155 -0
- data/docs/rdocs/Longleaf/InvalidDigestAlgorithmError.html +143 -0
- data/docs/rdocs/Longleaf/InvalidStoragePathError.html +143 -0
- data/docs/rdocs/Longleaf/Logging.html +405 -0
- data/docs/rdocs/Longleaf/Logging/RedirectingLogger.html +1213 -0
- data/docs/rdocs/Longleaf/LongleafError.html +139 -0
- data/docs/rdocs/Longleaf/MDFields.html +193 -0
- data/docs/rdocs/Longleaf/MetadataBuilder.html +787 -0
- data/docs/rdocs/Longleaf/MetadataDeserializer.html +537 -0
- data/docs/rdocs/Longleaf/MetadataError.html +143 -0
- data/docs/rdocs/Longleaf/MetadataPersistenceManager.html +539 -0
- data/docs/rdocs/Longleaf/MetadataRecord.html +1411 -0
- data/docs/rdocs/Longleaf/MetadataSerializer.html +786 -0
- data/docs/rdocs/Longleaf/PreservationServiceError.html +147 -0
- data/docs/rdocs/Longleaf/PreserveCommand.html +410 -0
- data/docs/rdocs/Longleaf/PreserveEvent.html +491 -0
- data/docs/rdocs/Longleaf/RegisterCommand.html +428 -0
- data/docs/rdocs/Longleaf/RegisterEvent.html +628 -0
- data/docs/rdocs/Longleaf/RegisteredFileSelector.html +446 -0
- data/docs/rdocs/Longleaf/RegistrationError.html +151 -0
- data/docs/rdocs/Longleaf/ReindexCommand.html +576 -0
- data/docs/rdocs/Longleaf/RsyncReplicationService.html +1180 -0
- data/docs/rdocs/Longleaf/SequelIndexDriver.html +1978 -0
- data/docs/rdocs/Longleaf/ServiceCandidateFilesystemIterator.html +572 -0
- data/docs/rdocs/Longleaf/ServiceCandidateIndexIterator.html +532 -0
- data/docs/rdocs/Longleaf/ServiceCandidateLocator.html +333 -0
- data/docs/rdocs/Longleaf/ServiceClassCache.html +725 -0
- data/docs/rdocs/Longleaf/ServiceDateHelper.html +425 -0
- data/docs/rdocs/Longleaf/ServiceDefinition.html +683 -0
- data/docs/rdocs/Longleaf/ServiceDefinitionManager.html +371 -0
- data/docs/rdocs/Longleaf/ServiceDefinitionValidator.html +269 -0
- data/docs/rdocs/Longleaf/ServiceFields.html +173 -0
- data/docs/rdocs/Longleaf/ServiceManager.html +1229 -0
- data/docs/rdocs/Longleaf/ServiceMappingManager.html +410 -0
- data/docs/rdocs/Longleaf/ServiceMappingValidator.html +347 -0
- data/docs/rdocs/Longleaf/ServiceRecord.html +821 -0
- data/docs/rdocs/Longleaf/StorageLocation.html +985 -0
- data/docs/rdocs/Longleaf/StorageLocationManager.html +729 -0
- data/docs/rdocs/Longleaf/StorageLocationUnavailableError.html +143 -0
- data/docs/rdocs/Longleaf/StorageLocationValidator.html +373 -0
- data/docs/rdocs/Longleaf/StoragePathValidator.html +253 -0
- data/docs/rdocs/Longleaf/SystemConfigBuilder.html +441 -0
- data/docs/rdocs/Longleaf/SystemConfigFields.html +163 -0
- data/docs/rdocs/Longleaf/ValidateConfigCommand.html +451 -0
- data/docs/rdocs/Longleaf/ValidateMetadataCommand.html +408 -0
- data/docs/rdocs/_index.html +660 -0
- data/docs/rdocs/class_list.html +51 -0
- data/docs/rdocs/css/common.css +1 -0
- data/docs/rdocs/css/full_list.css +58 -0
- data/docs/rdocs/css/style.css +496 -0
- data/docs/rdocs/file.README.html +165 -0
- data/docs/rdocs/file_list.html +56 -0
- data/docs/rdocs/frames.html +17 -0
- data/docs/rdocs/index.html +165 -0
- data/docs/rdocs/js/app.js +303 -0
- data/docs/rdocs/js/full_list.js +216 -0
- data/docs/rdocs/js/jquery.js +4 -0
- data/docs/rdocs/method_list.html +2051 -0
- data/docs/rdocs/top-level-namespace.html +110 -0
- data/lib/longleaf/candidates/file_selector.rb +139 -0
- data/lib/longleaf/candidates/manifest_digest_provider.rb +17 -0
- data/lib/longleaf/candidates/registered_file_selector.rb +67 -0
- data/lib/longleaf/candidates/service_candidate_filesystem_iterator.rb +93 -0
- data/lib/longleaf/candidates/service_candidate_index_iterator.rb +84 -0
- data/lib/longleaf/candidates/service_candidate_locator.rb +23 -0
- data/lib/longleaf/candidates/single_digest_provider.rb +13 -0
- data/lib/longleaf/cli.rb +237 -46
- data/lib/longleaf/commands/deregister_command.rb +51 -0
- data/lib/longleaf/commands/preserve_command.rb +50 -0
- data/lib/longleaf/commands/register_command.rb +32 -43
- data/lib/longleaf/commands/reindex_command.rb +92 -0
- data/lib/longleaf/commands/validate_config_command.rb +33 -8
- data/lib/longleaf/commands/validate_metadata_command.rb +51 -0
- data/lib/longleaf/errors.rb +26 -7
- data/lib/longleaf/events/deregister_event.rb +53 -0
- data/lib/longleaf/events/event_names.rb +9 -0
- data/lib/longleaf/events/event_status_tracking.rb +59 -0
- data/lib/longleaf/events/preserve_event.rb +81 -0
- data/lib/longleaf/events/register_event.rb +52 -51
- data/lib/longleaf/helpers/case_insensitive_hash.rb +38 -0
- data/lib/longleaf/helpers/digest_helper.rb +56 -0
- data/lib/longleaf/helpers/s3_uri_helper.rb +86 -0
- data/lib/longleaf/helpers/selection_options_parser.rb +189 -0
- data/lib/longleaf/helpers/service_date_helper.rb +78 -0
- data/lib/longleaf/indexing/index_manager.rb +101 -0
- data/lib/longleaf/indexing/sequel_index_driver.rb +306 -0
- data/lib/longleaf/logging.rb +5 -4
- data/lib/longleaf/logging/redirecting_logger.rb +26 -25
- data/lib/longleaf/models/app_fields.rb +7 -2
- data/lib/longleaf/models/file_record.rb +17 -8
- data/lib/longleaf/models/filesystem_metadata_location.rb +56 -0
- data/lib/longleaf/models/filesystem_storage_location.rb +52 -0
- data/lib/longleaf/models/md_fields.rb +2 -1
- data/lib/longleaf/models/metadata_location.rb +47 -0
- data/lib/longleaf/models/metadata_record.rb +39 -15
- data/lib/longleaf/models/s3_storage_location.rb +133 -0
- data/lib/longleaf/models/service_definition.rb +7 -6
- data/lib/longleaf/models/service_fields.rb +7 -1
- data/lib/longleaf/models/service_record.rb +10 -6
- data/lib/longleaf/models/storage_location.rb +24 -19
- data/lib/longleaf/models/storage_types.rb +9 -0
- data/lib/longleaf/models/system_config_fields.rb +9 -0
- data/lib/longleaf/preservation_services/file_check_service.rb +58 -0
- data/lib/longleaf/preservation_services/fixity_check_service.rb +123 -0
- data/lib/longleaf/preservation_services/rsync_replication_service.rb +182 -0
- data/lib/longleaf/preservation_services/s3_replication_service.rb +143 -0
- data/lib/longleaf/services/application_config_deserializer.rb +81 -24
- data/lib/longleaf/services/application_config_manager.rb +20 -6
- data/lib/longleaf/services/application_config_validator.rb +19 -9
- data/lib/longleaf/services/configuration_validator.rb +67 -4
- data/lib/longleaf/services/filesystem_location_validator.rb +16 -0
- data/lib/longleaf/services/metadata_deserializer.rb +113 -42
- data/lib/longleaf/services/metadata_persistence_manager.rb +47 -0
- data/lib/longleaf/services/metadata_serializer.rb +138 -25
- data/lib/longleaf/services/metadata_validator.rb +76 -0
- data/lib/longleaf/services/s3_location_validator.rb +19 -0
- data/lib/longleaf/services/service_class_cache.rb +112 -0
- data/lib/longleaf/services/service_definition_manager.rb +10 -7
- data/lib/longleaf/services/service_definition_validator.rb +25 -18
- data/lib/longleaf/services/service_manager.rb +86 -11
- data/lib/longleaf/services/service_mapping_manager.rb +13 -12
- data/lib/longleaf/services/service_mapping_validator.rb +36 -26
- data/lib/longleaf/services/storage_location_manager.rb +76 -15
- data/lib/longleaf/services/storage_location_validator.rb +49 -35
- data/lib/longleaf/specs/config_builder.rb +47 -23
- data/lib/longleaf/specs/config_validator_helpers.rb +16 -0
- data/lib/longleaf/specs/custom_matchers.rb +9 -0
- data/lib/longleaf/specs/file_helpers.rb +61 -0
- data/lib/longleaf/specs/metadata_builder.rb +92 -0
- data/lib/longleaf/specs/system_config_builder.rb +27 -0
- data/lib/longleaf/version.rb +1 -1
- data/longleaf.gemspec +20 -7
- data/mkdocs.yml +21 -0
- metadata +306 -23
- data/.travis.yml +0 -4
- data/lib/longleaf/commands/abstract_command.rb +0 -37
- data/lib/longleaf/services/storage_path_validator.rb +0 -16
@@ -0,0 +1,786 @@
|
|
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::MetadataSerializer
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.19
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Longleaf::MetadataSerializer";
|
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 (M)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">MetadataSerializer</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::MetadataSerializer
|
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::MetadataSerializer</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
<dl>
|
89
|
+
<dt>Extended by:</dt>
|
90
|
+
<dd><span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></dd>
|
91
|
+
</dl>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dl>
|
101
|
+
<dt>Defined in:</dt>
|
102
|
+
<dd>lib/longleaf/services/metadata_serializer.rb</dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<h2>Overview</h2><div class="docstring">
|
108
|
+
<div class="discussion">
|
109
|
+
|
110
|
+
<p>Service which serializes MetadataRecord objects</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
|
+
Class 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="#metadata_suffix-class_method" title="metadata_suffix (class method)">.<strong>metadata_suffix</strong>(format: 'yaml') ⇒ String </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>The suffix used to indicate that a file is a metadata file in the provided encoding.</p>
|
152
|
+
</div></span>
|
153
|
+
|
154
|
+
</li>
|
155
|
+
|
156
|
+
|
157
|
+
<li class="public ">
|
158
|
+
<span class="summary_signature">
|
159
|
+
|
160
|
+
<a href="#to_hash-class_method" title="to_hash (class method)">.<strong>to_hash</strong>(metadata) ⇒ Object </a>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
</span>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
<span class="summary_desc"><div class='inline'>
|
175
|
+
<p>Create a hash representation of the given MetadataRecord file.</p>
|
176
|
+
</div></span>
|
177
|
+
|
178
|
+
</li>
|
179
|
+
|
180
|
+
|
181
|
+
<li class="public ">
|
182
|
+
<span class="summary_signature">
|
183
|
+
|
184
|
+
<a href="#to_yaml-class_method" title="to_yaml (class method)">.<strong>to_yaml</strong>(metadata) ⇒ String </a>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
</span>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<span class="summary_desc"><div class='inline'>
|
199
|
+
<p>A yaml representation of the provided MetadataRecord.</p>
|
200
|
+
</div></span>
|
201
|
+
|
202
|
+
</li>
|
203
|
+
|
204
|
+
|
205
|
+
<li class="public ">
|
206
|
+
<span class="summary_signature">
|
207
|
+
|
208
|
+
<a href="#write-class_method" title="write (class method)">.<strong>write</strong>(metadata:, file_path:, format: 'yaml', digest_algs: []) ⇒ Object </a>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
</span>
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<span class="summary_desc"><div class='inline'>
|
223
|
+
<p>Serialize the contents of the provided metadata record to the specified path.</p>
|
224
|
+
</div></span>
|
225
|
+
|
226
|
+
</li>
|
227
|
+
|
228
|
+
|
229
|
+
<li class="private ">
|
230
|
+
<span class="summary_signature">
|
231
|
+
|
232
|
+
<a href="#write_digests-class_method" title="write_digests (class method)">.<strong>write_digests</strong>(file_path, content, digests) ⇒ Object </a>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
</span>
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<span class="note title private">private</span>
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
247
|
+
|
248
|
+
</li>
|
249
|
+
|
250
|
+
|
251
|
+
</ul>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></h3>
|
264
|
+
<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>
|
265
|
+
|
266
|
+
|
267
|
+
<div id="class_method_details" class="method_details_list">
|
268
|
+
<h2>Class Method Details</h2>
|
269
|
+
|
270
|
+
|
271
|
+
<div class="method_details first">
|
272
|
+
<h3 class="signature first" id="metadata_suffix-class_method">
|
273
|
+
|
274
|
+
.<strong>metadata_suffix</strong>(format: 'yaml') ⇒ <tt>String</tt>
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
</h3><div class="docstring">
|
281
|
+
<div class="discussion">
|
282
|
+
|
283
|
+
<p>Returns the suffix used to indicate that a file is a metadata file in the provided encoding</p>
|
284
|
+
|
285
|
+
|
286
|
+
</div>
|
287
|
+
</div>
|
288
|
+
<div class="tags">
|
289
|
+
<p class="tag_title">Parameters:</p>
|
290
|
+
<ul class="param">
|
291
|
+
|
292
|
+
<li>
|
293
|
+
|
294
|
+
<span class='name'>format</span>
|
295
|
+
|
296
|
+
|
297
|
+
<span class='type'>(<tt>String</tt>)</span>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
—
|
302
|
+
<div class='inline'>
|
303
|
+
<p>encoding format used for metadata file</p>
|
304
|
+
</div>
|
305
|
+
|
306
|
+
</li>
|
307
|
+
|
308
|
+
</ul>
|
309
|
+
|
310
|
+
<p class="tag_title">Returns:</p>
|
311
|
+
<ul class="return">
|
312
|
+
|
313
|
+
<li>
|
314
|
+
|
315
|
+
|
316
|
+
<span class='type'>(<tt>String</tt>)</span>
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
—
|
321
|
+
<div class='inline'>
|
322
|
+
<p>the suffix used to indicate that a file is a metadata file in the provided encoding</p>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
</li>
|
326
|
+
|
327
|
+
</ul>
|
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
|
+
—
|
339
|
+
<div class='inline'>
|
340
|
+
<p>raised if the provided format is not a supported metadata encoding format</p>
|
341
|
+
</div>
|
342
|
+
|
343
|
+
</li>
|
344
|
+
|
345
|
+
</ul>
|
346
|
+
|
347
|
+
</div><table class="source_code">
|
348
|
+
<tr>
|
349
|
+
<td>
|
350
|
+
<pre class="lines">
|
351
|
+
|
352
|
+
|
353
|
+
79
|
354
|
+
80
|
355
|
+
81
|
356
|
+
82
|
357
|
+
83
|
358
|
+
84
|
359
|
+
85
|
360
|
+
86</pre>
|
361
|
+
</td>
|
362
|
+
<td>
|
363
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/services/metadata_serializer.rb', line 79</span>
|
364
|
+
|
365
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_metadata_suffix'>metadata_suffix</span><span class='lparen'>(</span><span class='label'>format:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>yaml</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
366
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_format'>format</span>
|
367
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>yaml</span><span class='tstring_end'>'</span></span>
|
368
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-llmd.yaml</span><span class='tstring_end'>'</span></span>
|
369
|
+
<span class='kw'>else</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'>"</span><span class='tstring_content'>Invalid serialization format </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_content'> specified</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
371
|
+
<span class='kw'>end</span>
|
372
|
+
<span class='kw'>end</span></pre>
|
373
|
+
</td>
|
374
|
+
</tr>
|
375
|
+
</table>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
<div class="method_details ">
|
379
|
+
<h3 class="signature " id="to_hash-class_method">
|
380
|
+
|
381
|
+
.<strong>to_hash</strong>(metadata) ⇒ <tt>Object</tt>
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
</h3><div class="docstring">
|
388
|
+
<div class="discussion">
|
389
|
+
|
390
|
+
<p>Create a hash representation of the given MetadataRecord file</p>
|
391
|
+
|
392
|
+
|
393
|
+
</div>
|
394
|
+
</div>
|
395
|
+
<div class="tags">
|
396
|
+
<p class="tag_title">Parameters:</p>
|
397
|
+
<ul class="param">
|
398
|
+
|
399
|
+
<li>
|
400
|
+
|
401
|
+
<span class='name'>metadata</span>
|
402
|
+
|
403
|
+
|
404
|
+
<span class='type'>(<tt><span class='object_link'><a href="MetadataRecord.html" title="Longleaf::MetadataRecord (class)">MetadataRecord</a></span></tt>)</span>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
—
|
409
|
+
<div class='inline'>
|
410
|
+
<p>metadata record to transform into a hash</p>
|
411
|
+
</div>
|
412
|
+
|
413
|
+
</li>
|
414
|
+
|
415
|
+
</ul>
|
416
|
+
|
417
|
+
|
418
|
+
</div><table class="source_code">
|
419
|
+
<tr>
|
420
|
+
<td>
|
421
|
+
<pre class="lines">
|
422
|
+
|
423
|
+
|
424
|
+
50
|
425
|
+
51
|
426
|
+
52
|
427
|
+
53
|
428
|
+
54
|
429
|
+
55
|
430
|
+
56
|
431
|
+
57
|
432
|
+
58
|
433
|
+
59
|
434
|
+
60
|
435
|
+
61
|
436
|
+
62
|
437
|
+
63
|
438
|
+
64
|
439
|
+
65
|
440
|
+
66
|
441
|
+
67
|
442
|
+
68
|
443
|
+
69
|
444
|
+
70
|
445
|
+
71
|
446
|
+
72
|
447
|
+
73
|
448
|
+
74</pre>
|
449
|
+
</td>
|
450
|
+
<td>
|
451
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/services/metadata_serializer.rb', line 50</span>
|
452
|
+
|
453
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_hash'>to_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
454
|
+
<span class='id identifier rubyid_props'>props</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
455
|
+
|
456
|
+
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span><span class='rparen'>)</span>
|
457
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>REGISTERED_TIMESTAMP</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_registered'>registered</span> <span class='kw'>if</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_registered'>registered</span>
|
458
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>DEREGISTERED_TIMESTAMP</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_deregistered'>deregistered</span> <span class='kw'>if</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_deregistered'>deregistered</span>
|
459
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>CHECKSUMS</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_checksums'>checksums</span> <span class='kw'>unless</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_checksums'>checksums</span> <span class='op'>&&</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_checksums'>checksums</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
460
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>FILE_SIZE</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_file_size'>file_size</span> <span class='kw'>unless</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_file_size'>file_size</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
461
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>LAST_MODIFIED</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_last_modified'>last_modified</span> <span class='kw'>if</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_last_modified'>last_modified</span>
|
462
|
+
|
463
|
+
<span class='id identifier rubyid_props'>props</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>DATA</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span>
|
464
|
+
|
465
|
+
<span class='id identifier rubyid_services'>services</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
466
|
+
<span class='id identifier rubyid_metadata'>metadata</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_name'>name</span><span class='op'>|</span>
|
467
|
+
<span class='id identifier rubyid_service'>service</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_service'>service</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
468
|
+
<span class='id identifier rubyid_service'>service</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>STALE_REPLICAS</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_stale_replicas'>stale_replicas</span> <span class='kw'>if</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_stale_replicas'>stale_replicas</span>
|
469
|
+
<span class='id identifier rubyid_service'>service</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>SERVICE_TIMESTAMP</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_timestamp'>timestamp</span> <span class='kw'>unless</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_timestamp'>timestamp</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
470
|
+
<span class='id identifier rubyid_service'>service</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>RUN_NEEDED</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_run_needed'>run_needed</span> <span class='kw'>if</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_run_needed'>run_needed</span>
|
471
|
+
<span class='id identifier rubyid_services'>services</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_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span> <span class='kw'>unless</span> <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_properties'>properties</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
472
|
+
<span class='kw'>end</span>
|
473
|
+
|
474
|
+
<span class='id identifier rubyid_props'>props</span><span class='lbracket'>[</span><span class='const'>MDF</span><span class='op'>::</span><span class='const'>SERVICES</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_services'>services</span>
|
475
|
+
|
476
|
+
<span class='id identifier rubyid_props'>props</span>
|
477
|
+
<span class='kw'>end</span></pre>
|
478
|
+
</td>
|
479
|
+
</tr>
|
480
|
+
</table>
|
481
|
+
</div>
|
482
|
+
|
483
|
+
<div class="method_details ">
|
484
|
+
<h3 class="signature " id="to_yaml-class_method">
|
485
|
+
|
486
|
+
.<strong>to_yaml</strong>(metadata) ⇒ <tt>String</tt>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
</h3><div class="docstring">
|
493
|
+
<div class="discussion">
|
494
|
+
|
495
|
+
<p>Returns a yaml representation of the provided MetadataRecord</p>
|
496
|
+
|
497
|
+
|
498
|
+
</div>
|
499
|
+
</div>
|
500
|
+
<div class="tags">
|
501
|
+
<p class="tag_title">Parameters:</p>
|
502
|
+
<ul class="param">
|
503
|
+
|
504
|
+
<li>
|
505
|
+
|
506
|
+
<span class='name'>metadata</span>
|
507
|
+
|
508
|
+
|
509
|
+
<span class='type'>(<tt><span class='object_link'><a href="MetadataRecord.html" title="Longleaf::MetadataRecord (class)">MetadataRecord</a></span></tt>)</span>
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
—
|
514
|
+
<div class='inline'>
|
515
|
+
<p>metadata record to transform</p>
|
516
|
+
</div>
|
517
|
+
|
518
|
+
</li>
|
519
|
+
|
520
|
+
</ul>
|
521
|
+
|
522
|
+
<p class="tag_title">Returns:</p>
|
523
|
+
<ul class="return">
|
524
|
+
|
525
|
+
<li>
|
526
|
+
|
527
|
+
|
528
|
+
<span class='type'>(<tt>String</tt>)</span>
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
—
|
533
|
+
<div class='inline'>
|
534
|
+
<p>a yaml representation of the provided MetadataRecord</p>
|
535
|
+
</div>
|
536
|
+
|
537
|
+
</li>
|
538
|
+
|
539
|
+
</ul>
|
540
|
+
|
541
|
+
</div><table class="source_code">
|
542
|
+
<tr>
|
543
|
+
<td>
|
544
|
+
<pre class="lines">
|
545
|
+
|
546
|
+
|
547
|
+
43
|
548
|
+
44
|
549
|
+
45
|
550
|
+
46</pre>
|
551
|
+
</td>
|
552
|
+
<td>
|
553
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/services/metadata_serializer.rb', line 43</span>
|
554
|
+
|
555
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_yaml'>to_yaml</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
556
|
+
<span class='id identifier rubyid_props'>props</span> <span class='op'>=</span> <span class='id identifier rubyid_to_hash'>to_hash</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
557
|
+
<span class='id identifier rubyid_props'>props</span><span class='period'>.</span><span class='id identifier rubyid_to_yaml'>to_yaml</span>
|
558
|
+
<span class='kw'>end</span></pre>
|
559
|
+
</td>
|
560
|
+
</tr>
|
561
|
+
</table>
|
562
|
+
</div>
|
563
|
+
|
564
|
+
<div class="method_details ">
|
565
|
+
<h3 class="signature " id="write-class_method">
|
566
|
+
|
567
|
+
.<strong>write</strong>(metadata:, file_path:, format: 'yaml', digest_algs: []) ⇒ <tt>Object</tt>
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
</h3><div class="docstring">
|
574
|
+
<div class="discussion">
|
575
|
+
|
576
|
+
<p>Serialize the contents of the provided metadata record to the specified path</p>
|
577
|
+
|
578
|
+
|
579
|
+
</div>
|
580
|
+
</div>
|
581
|
+
<div class="tags">
|
582
|
+
<p class="tag_title">Parameters:</p>
|
583
|
+
<ul class="param">
|
584
|
+
|
585
|
+
<li>
|
586
|
+
|
587
|
+
<span class='name'>metadata</span>
|
588
|
+
|
589
|
+
|
590
|
+
<span class='type'>(<tt><span class='object_link'><a href="MetadataRecord.html" title="Longleaf::MetadataRecord (class)">MetadataRecord</a></span></tt>)</span>
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
—
|
595
|
+
<div class='inline'>
|
596
|
+
<p>metadata record to serialize. Required.</p>
|
597
|
+
</div>
|
598
|
+
|
599
|
+
</li>
|
600
|
+
|
601
|
+
<li>
|
602
|
+
|
603
|
+
<span class='name'>file_path</span>
|
604
|
+
|
605
|
+
|
606
|
+
<span class='type'>(<tt>String</tt>)</span>
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
—
|
611
|
+
<div class='inline'>
|
612
|
+
<p>path to write the file to. Required.</p>
|
613
|
+
</div>
|
614
|
+
|
615
|
+
</li>
|
616
|
+
|
617
|
+
<li>
|
618
|
+
|
619
|
+
<span class='name'>format</span>
|
620
|
+
|
621
|
+
|
622
|
+
<span class='type'>(<tt>String</tt>)</span>
|
623
|
+
|
624
|
+
|
625
|
+
|
626
|
+
—
|
627
|
+
<div class='inline'>
|
628
|
+
<p>format to serialize the metadata in. Default is 'yaml'.</p>
|
629
|
+
</div>
|
630
|
+
|
631
|
+
</li>
|
632
|
+
|
633
|
+
<li>
|
634
|
+
|
635
|
+
<span class='name'>digest_algs</span>
|
636
|
+
|
637
|
+
|
638
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
639
|
+
|
640
|
+
|
641
|
+
|
642
|
+
—
|
643
|
+
<div class='inline'>
|
644
|
+
<p>if provided, sidecar digest files for the metadata file will be generated for each algorithm.</p>
|
645
|
+
</div>
|
646
|
+
|
647
|
+
</li>
|
648
|
+
|
649
|
+
</ul>
|
650
|
+
|
651
|
+
<p class="tag_title">Raises:</p>
|
652
|
+
<ul class="raise">
|
653
|
+
|
654
|
+
<li>
|
655
|
+
|
656
|
+
|
657
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
</li>
|
662
|
+
|
663
|
+
</ul>
|
664
|
+
|
665
|
+
</div><table class="source_code">
|
666
|
+
<tr>
|
667
|
+
<td>
|
668
|
+
<pre class="lines">
|
669
|
+
|
670
|
+
|
671
|
+
22
|
672
|
+
23
|
673
|
+
24
|
674
|
+
25
|
675
|
+
26
|
676
|
+
27
|
677
|
+
28
|
678
|
+
29
|
679
|
+
30
|
680
|
+
31
|
681
|
+
32
|
682
|
+
33
|
683
|
+
34
|
684
|
+
35
|
685
|
+
36
|
686
|
+
37
|
687
|
+
38
|
688
|
+
39</pre>
|
689
|
+
</td>
|
690
|
+
<td>
|
691
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/services/metadata_serializer.rb', line 22</span>
|
692
|
+
|
693
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='label'>metadata:</span><span class='comma'>,</span> <span class='label'>file_path:</span><span class='comma'>,</span> <span class='label'>format:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>yaml</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>digest_algs:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
694
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>metadata parameter must be a MetadataRecord</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> \
|
695
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'><span class='object_link'><a href="MetadataRecord.html" title="Longleaf::MetadataRecord (class)">MetadataRecord</a></span></span>
|
696
|
+
|
697
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_format'>format</span>
|
698
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>yaml</span><span class='tstring_end'>'</span></span>
|
699
|
+
<span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='id identifier rubyid_to_yaml'>to_yaml</span><span class='lparen'>(</span><span class='id identifier rubyid_metadata'>metadata</span><span class='rparen'>)</span>
|
700
|
+
<span class='kw'>else</span>
|
701
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Invalid serialization format </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_content'> specified</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
702
|
+
<span class='kw'>end</span>
|
703
|
+
|
704
|
+
<span class='comment'># Fill in parent directories if they do not exist
|
705
|
+
</span> <span class='id identifier rubyid_parent_dir'>parent_dir</span> <span class='op'>=</span> <span class='const'>Pathname</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_parent'>parent</span>
|
706
|
+
<span class='id identifier rubyid_parent_dir'>parent_dir</span><span class='period'>.</span><span class='id identifier rubyid_mkpath'>mkpath</span> <span class='kw'>unless</span> <span class='id identifier rubyid_parent_dir'>parent_dir</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span>
|
707
|
+
|
708
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
|
709
|
+
<span class='id identifier rubyid_write_digests'>write_digests</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_digest_algs'>digest_algs</span><span class='rparen'>)</span>
|
710
|
+
<span class='kw'>end</span></pre>
|
711
|
+
</td>
|
712
|
+
</tr>
|
713
|
+
</table>
|
714
|
+
</div>
|
715
|
+
|
716
|
+
<div class="method_details ">
|
717
|
+
<h3 class="signature " id="write_digests-class_method">
|
718
|
+
|
719
|
+
.<strong>write_digests</strong>(file_path, content, digests) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
720
|
+
|
721
|
+
|
722
|
+
|
723
|
+
|
724
|
+
|
725
|
+
</h3><table class="source_code">
|
726
|
+
<tr>
|
727
|
+
<td>
|
728
|
+
<pre class="lines">
|
729
|
+
|
730
|
+
|
731
|
+
88
|
732
|
+
89
|
733
|
+
90
|
734
|
+
91
|
735
|
+
92
|
736
|
+
93
|
737
|
+
94
|
738
|
+
95
|
739
|
+
96
|
740
|
+
97
|
741
|
+
98
|
742
|
+
99
|
743
|
+
100
|
744
|
+
101
|
745
|
+
102
|
746
|
+
103
|
747
|
+
104</pre>
|
748
|
+
</td>
|
749
|
+
<td>
|
750
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/services/metadata_serializer.rb', line 88</span>
|
751
|
+
|
752
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_write_digests'>write_digests</span><span class='lparen'>(</span><span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_digests'>digests</span><span class='rparen'>)</span>
|
753
|
+
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_digests'>digests</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_digests'>digests</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
754
|
+
|
755
|
+
<span class='id identifier rubyid_digests'>digests</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_alg'>alg</span><span class='op'>|</span>
|
756
|
+
<span class='id identifier rubyid_digest_class'>digest_class</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="DigestHelper.html" title="Longleaf::DigestHelper (class)">DigestHelper</a></span></span><span class='op'>::</span><span class='id identifier rubyid_start_digest'><span class='object_link'><a href="DigestHelper.html#start_digest-class_method" title="Longleaf::DigestHelper.start_digest (method)">start_digest</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_alg'>alg</span><span class='rparen'>)</span>
|
757
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_digest_class'>digest_class</span><span class='period'>.</span><span class='id identifier rubyid_hexdigest'>hexdigest</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
|
758
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:path</span><span class='rparen'>)</span>
|
759
|
+
<span class='id identifier rubyid_digest_path'>digest_path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_file_path'>file_path</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_alg'>alg</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
760
|
+
<span class='kw'>else</span>
|
761
|
+
<span class='id identifier rubyid_digest_path'>digest_path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</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'>.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_alg'>alg</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
762
|
+
<span class='kw'>end</span>
|
763
|
+
|
764
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_digest_path'>digest_path</span><span class='comma'>,</span> <span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
|
765
|
+
|
766
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Generated </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_alg'>alg</span><span class='embexpr_end'>}</span><span class='tstring_content'> digest for metadata file </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'>: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_result'>result</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
767
|
+
<span class='kw'>end</span>
|
768
|
+
<span class='kw'>end</span></pre>
|
769
|
+
</td>
|
770
|
+
</tr>
|
771
|
+
</table>
|
772
|
+
</div>
|
773
|
+
|
774
|
+
</div>
|
775
|
+
|
776
|
+
</div>
|
777
|
+
|
778
|
+
<div id="footer">
|
779
|
+
Generated on Tue May 28 15:48:02 2019 by
|
780
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
781
|
+
0.9.19 (ruby-2.6.3).
|
782
|
+
</div>
|
783
|
+
|
784
|
+
</div>
|
785
|
+
</body>
|
786
|
+
</html>
|