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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +84 -0
- data/.gitignore +4 -2
- data/.rubocop.yml +42 -2
- data/.rubocop_todo.yml +390 -311
- data/.yardopts +1 -0
- data/Gemfile +16 -1
- data/README.md +67 -13
- 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 +47 -15
- data/lib/longleaf/candidates/registered_file_selector.rb +67 -0
- data/lib/longleaf/candidates/service_candidate_filesystem_iterator.rb +29 -35
- data/lib/longleaf/candidates/service_candidate_index_iterator.rb +84 -0
- data/lib/longleaf/candidates/service_candidate_locator.rb +9 -4
- data/lib/longleaf/cli.rb +162 -80
- data/lib/longleaf/commands/deregister_command.rb +12 -11
- data/lib/longleaf/commands/preserve_command.rb +13 -8
- data/lib/longleaf/commands/register_command.rb +9 -6
- data/lib/longleaf/commands/reindex_command.rb +92 -0
- data/lib/longleaf/commands/validate_config_command.rb +27 -6
- data/lib/longleaf/commands/validate_metadata_command.rb +11 -9
- data/lib/longleaf/errors.rb +12 -12
- data/lib/longleaf/events/deregister_event.rb +13 -15
- data/lib/longleaf/events/event_status_tracking.rb +7 -7
- data/lib/longleaf/events/preserve_event.rb +24 -14
- data/lib/longleaf/events/register_event.rb +21 -35
- data/lib/longleaf/helpers/digest_helper.rb +4 -4
- data/lib/longleaf/helpers/service_date_helper.rb +5 -6
- data/lib/longleaf/indexing/index_manager.rb +101 -0
- data/lib/longleaf/indexing/sequel_index_driver.rb +324 -0
- data/lib/longleaf/logging.rb +4 -4
- data/lib/longleaf/logging/redirecting_logger.rb +20 -20
- data/lib/longleaf/models/app_fields.rb +2 -1
- data/lib/longleaf/models/file_record.rb +10 -6
- data/lib/longleaf/models/md_fields.rb +1 -1
- data/lib/longleaf/models/metadata_record.rb +22 -12
- data/lib/longleaf/models/service_definition.rb +3 -3
- data/lib/longleaf/models/service_fields.rb +1 -1
- data/lib/longleaf/models/service_record.rb +6 -5
- data/lib/longleaf/models/storage_location.rb +26 -7
- 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 +16 -14
- data/lib/longleaf/preservation_services/rsync_replication_service.rb +32 -31
- data/lib/longleaf/services/application_config_deserializer.rb +55 -18
- data/lib/longleaf/services/application_config_manager.rb +16 -4
- data/lib/longleaf/services/application_config_validator.rb +1 -2
- data/lib/longleaf/services/configuration_validator.rb +6 -4
- data/lib/longleaf/services/metadata_deserializer.rb +40 -38
- data/lib/longleaf/services/metadata_persistence_manager.rb +46 -0
- data/lib/longleaf/services/metadata_serializer.rb +23 -22
- data/lib/longleaf/services/service_class_cache.rb +15 -15
- data/lib/longleaf/services/service_definition_manager.rb +5 -6
- data/lib/longleaf/services/service_definition_validator.rb +5 -6
- data/lib/longleaf/services/service_manager.rb +37 -17
- data/lib/longleaf/services/service_mapping_manager.rb +9 -9
- data/lib/longleaf/services/service_mapping_validator.rb +9 -10
- data/lib/longleaf/services/storage_location_manager.rb +22 -8
- data/lib/longleaf/services/storage_location_validator.rb +11 -8
- data/lib/longleaf/services/storage_path_validator.rb +1 -1
- data/lib/longleaf/specs/config_builder.rb +30 -17
- data/lib/longleaf/specs/custom_matchers.rb +1 -1
- data/lib/longleaf/specs/file_helpers.rb +15 -14
- data/lib/longleaf/specs/metadata_builder.rb +91 -0
- data/lib/longleaf/specs/system_config_builder.rb +27 -0
- data/lib/longleaf/version.rb +1 -1
- data/longleaf.gemspec +17 -7
- data/mkdocs.yml +20 -0
- metadata +233 -22
@@ -0,0 +1,1978 @@
|
|
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::SequelIndexDriver
|
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::SequelIndexDriver";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (S)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">SequelIndexDriver</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::SequelIndexDriver
|
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::SequelIndexDriver</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/indexing/sequel_index_driver.rb</dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<h2>Overview</h2><div class="docstring">
|
108
|
+
<div class="discussion">
|
109
|
+
|
110
|
+
<p>Driver for interacting with RDBM based metadata index using the Sequel ORM gem. Users must create the database and credentials for connecting to it in advance, if using a database application that requires creation of databases (ie, not sqlite). The default database name is 'longleaf_metadata_index' but may be overridden.</p>
|
111
|
+
|
112
|
+
<p>See the Sequel documentation for details about accepted connection parameters: <a href="https://github.com/jeremyevans/sequel/blob/master/doc/opening_databases.rdoc">github.com/jeremyevans/sequel/blob/master/doc/opening_databases.rdoc</a></p>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class="tags">
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<h2>
|
129
|
+
Instance Method Summary
|
130
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
131
|
+
</h2>
|
132
|
+
|
133
|
+
<ul class="summary">
|
134
|
+
|
135
|
+
<li class="private ">
|
136
|
+
<span class="summary_signature">
|
137
|
+
|
138
|
+
<a href="#add_path_restrictions-instance_method" title="#add_path_restrictions (instance method)">#<strong>add_path_restrictions</strong>(dataset, file_selector) ⇒ Object </a>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
</span>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
<span class="note title private">private</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
153
|
+
|
154
|
+
</li>
|
155
|
+
|
156
|
+
|
157
|
+
<li class="public ">
|
158
|
+
<span class="summary_signature">
|
159
|
+
|
160
|
+
<a href="#clear_index-instance_method" title="#clear_index (instance method)">#<strong>clear_index</strong>(older_than = nil) ⇒ 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>Remove all entries from the index.</p>
|
176
|
+
</div></span>
|
177
|
+
|
178
|
+
</li>
|
179
|
+
|
180
|
+
|
181
|
+
<li class="private ">
|
182
|
+
<span class="summary_signature">
|
183
|
+
|
184
|
+
<a href="#convert_iso8601_to_timestamp-instance_method" title="#convert_iso8601_to_timestamp (instance method)">#<strong>convert_iso8601_to_timestamp</strong>(iso8601) ⇒ Object </a>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
</span>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
<span class="note title private">private</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
|
203
|
+
<li class="private ">
|
204
|
+
<span class="summary_signature">
|
205
|
+
|
206
|
+
<a href="#db_conn-instance_method" title="#db_conn (instance method)">#<strong>db_conn</strong> ⇒ Object </a>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
</span>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<span class="note title private">private</span>
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
|
225
|
+
<li class="public ">
|
226
|
+
<span class="summary_signature">
|
227
|
+
|
228
|
+
<a href="#delay_until_timestamp-instance_method" title="#delay_until_timestamp (instance method)">#<strong>delay_until_timestamp</strong>(md_rec) ⇒ Object </a>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</span>
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
<span class="summary_desc"><div class='inline'>
|
243
|
+
<p>The first failure timestamp for any service, or nil if there were none.</p>
|
244
|
+
</div></span>
|
245
|
+
|
246
|
+
</li>
|
247
|
+
|
248
|
+
|
249
|
+
<li class="public ">
|
250
|
+
<span class="summary_signature">
|
251
|
+
|
252
|
+
<a href="#each_registered_path-instance_method" title="#each_registered_path (instance method)">#<strong>each_registered_path</strong>(file_selector, older_than: nil, &block) ⇒ Object </a>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
</span>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<span class="summary_desc"><div class='inline'>
|
267
|
+
<p>Calls the provided block once per each registered file path registered.</p>
|
268
|
+
</div></span>
|
269
|
+
|
270
|
+
</li>
|
271
|
+
|
272
|
+
|
273
|
+
<li class="public ">
|
274
|
+
<span class="summary_signature">
|
275
|
+
|
276
|
+
<a href="#first_service_execution_timestamp-instance_method" title="#first_service_execution_timestamp (instance method)">#<strong>first_service_execution_timestamp</strong>(expected_services, md_rec) ⇒ Object </a>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
</span>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
<span class="summary_desc"><div class='inline'>
|
291
|
+
<p>Find the earliest service execution time for any services expected to be run for the specified file.</p>
|
292
|
+
</div></span>
|
293
|
+
|
294
|
+
</li>
|
295
|
+
|
296
|
+
|
297
|
+
<li class="public ">
|
298
|
+
<span class="summary_signature">
|
299
|
+
|
300
|
+
<a href="#index-instance_method" title="#index (instance method)">#<strong>index</strong>(file_rec) ⇒ Object </a>
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
</span>
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
<span class="summary_desc"><div class='inline'>
|
315
|
+
<p>Index the provided file_rec and its metadata.</p>
|
316
|
+
</div></span>
|
317
|
+
|
318
|
+
</li>
|
319
|
+
|
320
|
+
|
321
|
+
<li class="public ">
|
322
|
+
<span class="summary_signature">
|
323
|
+
|
324
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(app_config, adapter, conn_details, page_size: nil) ⇒ SequelIndexDriver </a>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
</span>
|
329
|
+
|
330
|
+
|
331
|
+
<span class="note title constructor">constructor</span>
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
<span class="summary_desc"><div class='inline'>
|
341
|
+
<p>Initialize the index driver.</p>
|
342
|
+
</div></span>
|
343
|
+
|
344
|
+
</li>
|
345
|
+
|
346
|
+
|
347
|
+
<li class="public ">
|
348
|
+
<span class="summary_signature">
|
349
|
+
|
350
|
+
<a href="#is_stale%3F-instance_method" title="#is_stale? (instance method)">#<strong>is_stale?</strong> ⇒ Boolean </a>
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
</span>
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
<span class="summary_desc"><div class='inline'>
|
365
|
+
<p>Returns true if the application configuration does not match the configuration used for the last reindex.</p>
|
366
|
+
</div></span>
|
367
|
+
|
368
|
+
</li>
|
369
|
+
|
370
|
+
|
371
|
+
<li class="private ">
|
372
|
+
<span class="summary_signature">
|
373
|
+
|
374
|
+
<a href="#minimum_timestamp-instance_method" title="#minimum_timestamp (instance method)">#<strong>minimum_timestamp</strong> ⇒ Object </a>
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
</span>
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
<span class="note title private">private</span>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
389
|
+
|
390
|
+
</li>
|
391
|
+
|
392
|
+
|
393
|
+
<li class="public ">
|
394
|
+
<span class="summary_signature">
|
395
|
+
|
396
|
+
<a href="#paths_with_stale_services-instance_method" title="#paths_with_stale_services (instance method)">#<strong>paths_with_stale_services</strong>(file_selector, stale_datetime) ⇒ Array </a>
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
</span>
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
<span class="summary_desc"><div class='inline'>
|
411
|
+
<p>Retrieves page of file paths which have one or more services which need to run.</p>
|
412
|
+
</div></span>
|
413
|
+
|
414
|
+
</li>
|
415
|
+
|
416
|
+
|
417
|
+
<li class="private ">
|
418
|
+
<span class="summary_signature">
|
419
|
+
|
420
|
+
<a href="#preserve_tbl-instance_method" title="#preserve_tbl (instance method)">#<strong>preserve_tbl</strong> ⇒ Object </a>
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
</span>
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
<span class="note title private">private</span>
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
435
|
+
|
436
|
+
</li>
|
437
|
+
|
438
|
+
|
439
|
+
<li class="private ">
|
440
|
+
<span class="summary_signature">
|
441
|
+
|
442
|
+
<a href="#registered_dataset-instance_method" title="#registered_dataset (instance method)">#<strong>registered_dataset</strong> ⇒ Object </a>
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
</span>
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
<span class="note title private">private</span>
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
457
|
+
|
458
|
+
</li>
|
459
|
+
|
460
|
+
|
461
|
+
<li class="public ">
|
462
|
+
<span class="summary_signature">
|
463
|
+
|
464
|
+
<a href="#registered_paths-instance_method" title="#registered_paths (instance method)">#<strong>registered_paths</strong>(file_selector) ⇒ Array </a>
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
</span>
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
<span class="summary_desc"><div class='inline'>
|
479
|
+
<p>Retrieves a page of paths for registered files.</p>
|
480
|
+
</div></span>
|
481
|
+
|
482
|
+
</li>
|
483
|
+
|
484
|
+
|
485
|
+
<li class="public ">
|
486
|
+
<span class="summary_signature">
|
487
|
+
|
488
|
+
<a href="#remove-instance_method" title="#remove (instance method)">#<strong>remove</strong>(remove_me) ⇒ Object </a>
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
</span>
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
<span class="summary_desc"><div class='inline'>
|
503
|
+
<p>Remove an entry from the index.</p>
|
504
|
+
</div></span>
|
505
|
+
|
506
|
+
</li>
|
507
|
+
|
508
|
+
|
509
|
+
<li class="public ">
|
510
|
+
<span class="summary_signature">
|
511
|
+
|
512
|
+
<a href="#setup_index-instance_method" title="#setup_index (instance method)">#<strong>setup_index</strong> ⇒ Object </a>
|
513
|
+
|
514
|
+
|
515
|
+
|
516
|
+
</span>
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
<span class="summary_desc"><div class='inline'>
|
527
|
+
<p>Initialize the index's database using the provided configuration.</p>
|
528
|
+
</div></span>
|
529
|
+
|
530
|
+
</li>
|
531
|
+
|
532
|
+
|
533
|
+
<li class="public ">
|
534
|
+
<span class="summary_signature">
|
535
|
+
|
536
|
+
<a href="#update_index_state-instance_method" title="#update_index_state (instance method)">#<strong>update_index_state</strong> ⇒ Object </a>
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
</span>
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
<span class="summary_desc"><div class='inline'>
|
551
|
+
<p>Updates the state information for the index to indicate that the index has been refreshed or is in sync with the application's configuration.</p>
|
552
|
+
</div></span>
|
553
|
+
|
554
|
+
</li>
|
555
|
+
|
556
|
+
|
557
|
+
</ul>
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></h3>
|
570
|
+
<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>
|
571
|
+
<div id="constructor_details" class="method_details_list">
|
572
|
+
<h2>Constructor Details</h2>
|
573
|
+
|
574
|
+
<div class="method_details first">
|
575
|
+
<h3 class="signature first" id="initialize-instance_method">
|
576
|
+
|
577
|
+
#<strong>initialize</strong>(app_config, adapter, conn_details, page_size: nil) ⇒ <tt><span class='object_link'><a href="" title="Longleaf::SequelIndexDriver (class)">SequelIndexDriver</a></span></tt>
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
</h3><div class="docstring">
|
584
|
+
<div class="discussion">
|
585
|
+
|
586
|
+
<p>Initialize the index driver</p>
|
587
|
+
|
588
|
+
|
589
|
+
</div>
|
590
|
+
</div>
|
591
|
+
<div class="tags">
|
592
|
+
<p class="tag_title">Parameters:</p>
|
593
|
+
<ul class="param">
|
594
|
+
|
595
|
+
<li>
|
596
|
+
|
597
|
+
<span class='name'>app_config</span>
|
598
|
+
|
599
|
+
|
600
|
+
<span class='type'>(<tt><span class='object_link'><a href="ApplicationConfigManager.html" title="Longleaf::ApplicationConfigManager (class)">ApplicationConfigManager</a></span></tt>)</span>
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
—
|
605
|
+
<div class='inline'>
|
606
|
+
<p>the application configuration manager</p>
|
607
|
+
</div>
|
608
|
+
|
609
|
+
</li>
|
610
|
+
|
611
|
+
<li>
|
612
|
+
|
613
|
+
<span class='name'>adapter</span>
|
614
|
+
|
615
|
+
|
616
|
+
<span class='type'>(<tt>String</tt>)</span>
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
—
|
621
|
+
<div class='inline'>
|
622
|
+
<p>name of the database adapter to use.</p>
|
623
|
+
</div>
|
624
|
+
|
625
|
+
</li>
|
626
|
+
|
627
|
+
<li>
|
628
|
+
|
629
|
+
<span class='name'>conn_details</span>
|
630
|
+
|
631
|
+
|
632
|
+
<span class='type'></span>
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
—
|
637
|
+
<div class='inline'>
|
638
|
+
<p>Details about the configuration and connection to the database used for the index. If a string is provided, it will be used as the connection URL and must identify the adapter. If a hash is provided, it used as the parameters for the database connection.</p>
|
639
|
+
</div>
|
640
|
+
|
641
|
+
</li>
|
642
|
+
|
643
|
+
<li>
|
644
|
+
|
645
|
+
<span class='name'>page_size</span>
|
646
|
+
|
647
|
+
|
648
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
649
|
+
|
650
|
+
|
651
|
+
|
652
|
+
—
|
653
|
+
<div class='inline'>
|
654
|
+
<p>number of results to retrieve per query when getting candidates</p>
|
655
|
+
</div>
|
656
|
+
|
657
|
+
</li>
|
658
|
+
|
659
|
+
</ul>
|
660
|
+
|
661
|
+
|
662
|
+
</div><table class="source_code">
|
663
|
+
<tr>
|
664
|
+
<td>
|
665
|
+
<pre class="lines">
|
666
|
+
|
667
|
+
|
668
|
+
33
|
669
|
+
34
|
670
|
+
35
|
671
|
+
36
|
672
|
+
37
|
673
|
+
38
|
674
|
+
39
|
675
|
+
40
|
676
|
+
41
|
677
|
+
42
|
678
|
+
43
|
679
|
+
44
|
680
|
+
45
|
681
|
+
46
|
682
|
+
47
|
683
|
+
48</pre>
|
684
|
+
</td>
|
685
|
+
<td>
|
686
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 33</span>
|
687
|
+
|
688
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app_config'>app_config</span><span class='comma'>,</span> <span class='id identifier rubyid_adapter'>adapter</span><span class='comma'>,</span> <span class='id identifier rubyid_conn_details'>conn_details</span><span class='comma'>,</span> <span class='label'>page_size:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
689
|
+
<span class='const'>Sequel</span><span class='period'>.</span><span class='id identifier rubyid_default_timezone'>default_timezone</span> <span class='op'>=</span> <span class='symbol'>:utc</span>
|
690
|
+
<span class='ivar'>@app_config</span> <span class='op'>=</span> <span class='id identifier rubyid_app_config'>app_config</span>
|
691
|
+
<span class='ivar'>@adapter</span> <span class='op'>=</span> <span class='id identifier rubyid_adapter'>adapter</span>
|
692
|
+
<span class='ivar'>@conn_details</span> <span class='op'>=</span> <span class='id identifier rubyid_conn_details'>conn_details</span>
|
693
|
+
<span class='comment'># Digest of the app config file so we can tell if it changes
|
694
|
+
</span> <span class='ivar'>@config_md5</span> <span class='op'>=</span> <span class='id identifier rubyid_app_config'>app_config</span><span class='period'>.</span><span class='id identifier rubyid_config_md5'>config_md5</span>
|
695
|
+
<span class='ivar'>@page_size</span> <span class='op'>=</span> <span class='id identifier rubyid_page_size'>page_size</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_page_size'>page_size</span> <span class='op'><=</span> <span class='int'>0</span> <span class='op'>?</span> <span class='const'>DEFAULT_PAGE_SIZE</span> <span class='op'>:</span> <span class='id identifier rubyid_page_size'>page_size</span>
|
696
|
+
|
697
|
+
<span class='kw'>if</span> <span class='ivar'>@conn_details</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
698
|
+
<span class='comment'># Add in the adapter name
|
699
|
+
</span> <span class='ivar'>@conn_details</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>adapter</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_adapter'>adapter</span> <span class='kw'>unless</span> <span class='ivar'>@conn_details</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>adapter</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
700
|
+
<span class='comment'># Add in default database name if none was specified
|
701
|
+
</span> <span class='ivar'>@conn_details</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>database</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>INDEX_DB_NAME</span> <span class='kw'>unless</span> <span class='ivar'>@conn_details</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>database</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
702
|
+
<span class='kw'>end</span>
|
703
|
+
<span class='kw'>end</span></pre>
|
704
|
+
</td>
|
705
|
+
</tr>
|
706
|
+
</table>
|
707
|
+
</div>
|
708
|
+
|
709
|
+
</div>
|
710
|
+
|
711
|
+
|
712
|
+
<div id="instance_method_details" class="method_details_list">
|
713
|
+
<h2>Instance Method Details</h2>
|
714
|
+
|
715
|
+
|
716
|
+
<div class="method_details first">
|
717
|
+
<h3 class="signature first" id="add_path_restrictions-instance_method">
|
718
|
+
|
719
|
+
#<strong>add_path_restrictions</strong>(dataset, file_selector) ⇒ <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
|
+
292
|
732
|
+
293
|
733
|
+
294
|
734
|
+
295
|
735
|
+
296
|
736
|
+
297
|
737
|
+
298
|
738
|
+
299
|
739
|
+
300</pre>
|
740
|
+
</td>
|
741
|
+
<td>
|
742
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 292</span>
|
743
|
+
|
744
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_add_path_restrictions'>add_path_restrictions</span><span class='lparen'>(</span><span class='id identifier rubyid_dataset'>dataset</span><span class='comma'>,</span> <span class='id identifier rubyid_file_selector'>file_selector</span><span class='rparen'>)</span>
|
745
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_file_selector'>file_selector</span><span class='period'>.</span><span class='id identifier rubyid_specificity'>specificity</span> <span class='op'>==</span> <span class='const'><span class='object_link'><a href="FileSelector.html" title="Longleaf::FileSelector (class)">FileSelector</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="FileSelector.html#SPECIFICITY_STORAGE_LOCATION-constant" title="Longleaf::FileSelector::SPECIFICITY_STORAGE_LOCATION (constant)">SPECIFICITY_STORAGE_LOCATION</a></span></span>
|
746
|
+
<span class='id identifier rubyid_dataset'>dataset</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='label'>storage_location:</span> <span class='id identifier rubyid_file_selector'>file_selector</span><span class='period'>.</span><span class='id identifier rubyid_storage_locations'>storage_locations</span><span class='rparen'>)</span>
|
747
|
+
<span class='kw'>else</span>
|
748
|
+
<span class='comment'># Reformat all selected paths into LIKE partial string matches
|
749
|
+
</span> <span class='id identifier rubyid_path_conds'>path_conds</span> <span class='op'>=</span> <span class='id identifier rubyid_file_selector'>file_selector</span><span class='period'>.</span><span class='id identifier rubyid_target_paths'>target_paths</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_end_with?'>end_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%</span><span class='tstring_end'>'</span></span> <span class='op'>:</span> <span class='id identifier rubyid_path'>path</span> <span class='rbrace'>}</span>
|
750
|
+
<span class='id identifier rubyid_dataset'>dataset</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='const'>Sequel</span><span class='period'>.</span><span class='id identifier rubyid_like'>like</span><span class='lparen'>(</span><span class='symbol'>:file_path</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_path_conds'>path_conds</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
751
|
+
<span class='kw'>end</span>
|
752
|
+
<span class='kw'>end</span></pre>
|
753
|
+
</td>
|
754
|
+
</tr>
|
755
|
+
</table>
|
756
|
+
</div>
|
757
|
+
|
758
|
+
<div class="method_details ">
|
759
|
+
<h3 class="signature " id="clear_index-instance_method">
|
760
|
+
|
761
|
+
#<strong>clear_index</strong>(older_than = nil) ⇒ <tt>Object</tt>
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
</h3><div class="docstring">
|
768
|
+
<div class="discussion">
|
769
|
+
|
770
|
+
<p>Remove all entries from the index</p>
|
771
|
+
|
772
|
+
|
773
|
+
</div>
|
774
|
+
</div>
|
775
|
+
<div class="tags">
|
776
|
+
<p class="tag_title">Parameters:</p>
|
777
|
+
<ul class="param">
|
778
|
+
|
779
|
+
<li>
|
780
|
+
|
781
|
+
<span class='name'>older_than</span>
|
782
|
+
|
783
|
+
|
784
|
+
<span class='type'>(<tt>Time</tt>)</span>
|
785
|
+
|
786
|
+
|
787
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
788
|
+
|
789
|
+
|
790
|
+
—
|
791
|
+
<div class='inline'>
|
792
|
+
<p>Optional. If provided, only entries that have not been indexed since before the provided time will be deleted.</p>
|
793
|
+
</div>
|
794
|
+
|
795
|
+
</li>
|
796
|
+
|
797
|
+
</ul>
|
798
|
+
|
799
|
+
|
800
|
+
</div><table class="source_code">
|
801
|
+
<tr>
|
802
|
+
<td>
|
803
|
+
<pre class="lines">
|
804
|
+
|
805
|
+
|
806
|
+
171
|
807
|
+
172
|
808
|
+
173
|
809
|
+
174
|
810
|
+
175
|
811
|
+
176
|
812
|
+
177
|
813
|
+
178</pre>
|
814
|
+
</td>
|
815
|
+
<td>
|
816
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 171</span>
|
817
|
+
|
818
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_clear_index'>clear_index</span><span class='lparen'>(</span><span class='id identifier rubyid_older_than'>older_than</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
819
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_older_than'>older_than</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
820
|
+
<span class='id identifier rubyid_preserve_tbl'>preserve_tbl</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
|
821
|
+
<span class='kw'>else</span>
|
822
|
+
<span class='id identifier rubyid_older_than_timestamp'>older_than_timestamp</span> <span class='op'>=</span> <span class='id identifier rubyid_older_than'>older_than</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='const'>TIMESTAMP_FORMAT</span><span class='rparen'>)</span>
|
823
|
+
<span class='id identifier rubyid_preserve_tbl'>preserve_tbl</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_updated'>updated</span> <span class='op'><</span> <span class='id identifier rubyid_older_than_timestamp'>older_than_timestamp</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
|
824
|
+
<span class='kw'>end</span>
|
825
|
+
<span class='kw'>end</span></pre>
|
826
|
+
</td>
|
827
|
+
</tr>
|
828
|
+
</table>
|
829
|
+
</div>
|
830
|
+
|
831
|
+
<div class="method_details ">
|
832
|
+
<h3 class="signature " id="convert_iso8601_to_timestamp-instance_method">
|
833
|
+
|
834
|
+
#<strong>convert_iso8601_to_timestamp</strong>(iso8601) ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
835
|
+
|
836
|
+
|
837
|
+
|
838
|
+
|
839
|
+
|
840
|
+
</h3><table class="source_code">
|
841
|
+
<tr>
|
842
|
+
<td>
|
843
|
+
<pre class="lines">
|
844
|
+
|
845
|
+
|
846
|
+
302
|
847
|
+
303
|
848
|
+
304
|
849
|
+
305</pre>
|
850
|
+
</td>
|
851
|
+
<td>
|
852
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 302</span>
|
853
|
+
|
854
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_convert_iso8601_to_timestamp'>convert_iso8601_to_timestamp</span><span class='lparen'>(</span><span class='id identifier rubyid_iso8601'>iso8601</span><span class='rparen'>)</span>
|
855
|
+
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_iso8601'>iso8601</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
856
|
+
<span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_iso8601'>iso8601</span><span class='lparen'>(</span><span class='id identifier rubyid_iso8601'>iso8601</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='const'>TIMESTAMP_FORMAT</span><span class='rparen'>)</span>
|
857
|
+
<span class='kw'>end</span></pre>
|
858
|
+
</td>
|
859
|
+
</tr>
|
860
|
+
</table>
|
861
|
+
</div>
|
862
|
+
|
863
|
+
<div class="method_details ">
|
864
|
+
<h3 class="signature " id="db_conn-instance_method">
|
865
|
+
|
866
|
+
#<strong>db_conn</strong> ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
867
|
+
|
868
|
+
|
869
|
+
|
870
|
+
|
871
|
+
|
872
|
+
</h3><table class="source_code">
|
873
|
+
<tr>
|
874
|
+
<td>
|
875
|
+
<pre class="lines">
|
876
|
+
|
877
|
+
|
878
|
+
282
|
879
|
+
283
|
880
|
+
284
|
881
|
+
285</pre>
|
882
|
+
</td>
|
883
|
+
<td>
|
884
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 282</span>
|
885
|
+
|
886
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_db_conn'>db_conn</span>
|
887
|
+
<span class='ivar'>@connection</span> <span class='op'>=</span> <span class='const'>Sequel</span><span class='period'>.</span><span class='id identifier rubyid_connect'>connect</span><span class='lparen'>(</span><span class='ivar'>@conn_details</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@connection</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
888
|
+
<span class='ivar'>@connection</span>
|
889
|
+
<span class='kw'>end</span></pre>
|
890
|
+
</td>
|
891
|
+
</tr>
|
892
|
+
</table>
|
893
|
+
</div>
|
894
|
+
|
895
|
+
<div class="method_details ">
|
896
|
+
<h3 class="signature " id="delay_until_timestamp-instance_method">
|
897
|
+
|
898
|
+
#<strong>delay_until_timestamp</strong>(md_rec) ⇒ <tt>Object</tt>
|
899
|
+
|
900
|
+
|
901
|
+
|
902
|
+
|
903
|
+
|
904
|
+
</h3><div class="docstring">
|
905
|
+
<div class="discussion">
|
906
|
+
|
907
|
+
<p>Returns The first failure timestamp for any service, or nil if there were none.</p>
|
908
|
+
|
909
|
+
|
910
|
+
</div>
|
911
|
+
</div>
|
912
|
+
<div class="tags">
|
913
|
+
|
914
|
+
<p class="tag_title">Returns:</p>
|
915
|
+
<ul class="return">
|
916
|
+
|
917
|
+
<li>
|
918
|
+
|
919
|
+
|
920
|
+
<span class='type'></span>
|
921
|
+
|
922
|
+
|
923
|
+
|
924
|
+
|
925
|
+
<div class='inline'>
|
926
|
+
<p>The first failure timestamp for any service, or nil if there were none.</p>
|
927
|
+
</div>
|
928
|
+
|
929
|
+
</li>
|
930
|
+
|
931
|
+
</ul>
|
932
|
+
|
933
|
+
</div><table class="source_code">
|
934
|
+
<tr>
|
935
|
+
<td>
|
936
|
+
<pre class="lines">
|
937
|
+
|
938
|
+
|
939
|
+
144
|
940
|
+
145
|
941
|
+
146
|
942
|
+
147
|
943
|
+
148
|
944
|
+
149
|
945
|
+
150
|
946
|
+
151</pre>
|
947
|
+
</td>
|
948
|
+
<td>
|
949
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 144</span>
|
950
|
+
|
951
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_delay_until_timestamp'>delay_until_timestamp</span><span class='lparen'>(</span><span class='id identifier rubyid_md_rec'>md_rec</span><span class='rparen'>)</span>
|
952
|
+
<span class='id identifier rubyid_md_rec'>md_rec</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_service_name'>service_name</span><span class='op'>|</span>
|
953
|
+
<span class='id identifier rubyid_service_rec'>service_rec</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_service_name'>service_name</span><span class='rparen'>)</span>
|
954
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_service_rec'>service_rec</span><span class='period'>.</span><span class='id identifier rubyid_failure_timestamp'>failure_timestamp</span> <span class='kw'>unless</span> <span class='id identifier rubyid_service_rec'>service_rec</span><span class='period'>.</span><span class='id identifier rubyid_failure_timestamp'>failure_timestamp</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
955
|
+
<span class='kw'>end</span>
|
956
|
+
<span class='comment'># return lowest possible date
|
957
|
+
</span> <span class='kw'>return</span> <span class='id identifier rubyid_minimum_timestamp'>minimum_timestamp</span>
|
958
|
+
<span class='kw'>end</span></pre>
|
959
|
+
</td>
|
960
|
+
</tr>
|
961
|
+
</table>
|
962
|
+
</div>
|
963
|
+
|
964
|
+
<div class="method_details ">
|
965
|
+
<h3 class="signature " id="each_registered_path-instance_method">
|
966
|
+
|
967
|
+
#<strong>each_registered_path</strong>(file_selector, older_than: nil, &block) ⇒ <tt>Object</tt>
|
968
|
+
|
969
|
+
|
970
|
+
|
971
|
+
|
972
|
+
|
973
|
+
</h3><div class="docstring">
|
974
|
+
<div class="discussion">
|
975
|
+
|
976
|
+
<p>Calls the provided block once per each registered file path registered. Must be passed a block.</p>
|
977
|
+
|
978
|
+
|
979
|
+
</div>
|
980
|
+
</div>
|
981
|
+
<div class="tags">
|
982
|
+
<p class="tag_title">Parameters:</p>
|
983
|
+
<ul class="param">
|
984
|
+
|
985
|
+
<li>
|
986
|
+
|
987
|
+
<span class='name'>file_selector</span>
|
988
|
+
|
989
|
+
|
990
|
+
<span class='type'>(<tt><span class='object_link'><a href="FileSelector.html" title="Longleaf::FileSelector (class)">FileSelector</a></span></tt>)</span>
|
991
|
+
|
992
|
+
|
993
|
+
|
994
|
+
—
|
995
|
+
<div class='inline'>
|
996
|
+
<p>selector for what paths to search for files</p>
|
997
|
+
</div>
|
998
|
+
|
999
|
+
</li>
|
1000
|
+
|
1001
|
+
<li>
|
1002
|
+
|
1003
|
+
<span class='name'>older_than</span>
|
1004
|
+
|
1005
|
+
|
1006
|
+
<span class='type'>(<tt>Time</tt>)</span>
|
1007
|
+
|
1008
|
+
|
1009
|
+
|
1010
|
+
—
|
1011
|
+
<div class='inline'>
|
1012
|
+
<p>Optional. If provided, only files that have not been indexed since before this timestamp will be returned.</p>
|
1013
|
+
</div>
|
1014
|
+
|
1015
|
+
</li>
|
1016
|
+
|
1017
|
+
</ul>
|
1018
|
+
|
1019
|
+
|
1020
|
+
</div><table class="source_code">
|
1021
|
+
<tr>
|
1022
|
+
<td>
|
1023
|
+
<pre class="lines">
|
1024
|
+
|
1025
|
+
|
1026
|
+
268
|
1027
|
+
269
|
1028
|
+
270
|
1029
|
+
271
|
1030
|
+
272
|
1031
|
+
273
|
1032
|
+
274
|
1033
|
+
275
|
1034
|
+
276
|
1035
|
+
277
|
1036
|
+
278
|
1037
|
+
279</pre>
|
1038
|
+
</td>
|
1039
|
+
<td>
|
1040
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 268</span>
|
1041
|
+
|
1042
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each_registered_path'>each_registered_path</span><span class='lparen'>(</span><span class='id identifier rubyid_file_selector'>file_selector</span><span class='comma'>,</span> <span class='label'>older_than:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1043
|
+
<span class='id identifier rubyid_dataset'>dataset</span> <span class='op'>=</span> <span class='id identifier rubyid_add_path_restrictions'>add_path_restrictions</span><span class='lparen'>(</span><span class='id identifier rubyid_registered_dataset'>registered_dataset</span><span class='comma'>,</span> <span class='id identifier rubyid_file_selector'>file_selector</span><span class='rparen'>)</span>
|
1044
|
+
<span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='symbol'>:file_path</span><span class='rparen'>)</span>
|
1045
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_older_than'>older_than</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1046
|
+
<span class='id identifier rubyid_older_than_timestamp'>older_than_timestamp</span> <span class='op'>=</span> <span class='id identifier rubyid_older_than'>older_than</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='period'>.</span><span class='id identifier rubyid_strftime'>strftime</span><span class='lparen'>(</span><span class='const'>TIMESTAMP_FORMAT</span><span class='rparen'>)</span>
|
1047
|
+
<span class='id identifier rubyid_dataset'>dataset</span> <span class='op'>=</span> <span class='id identifier rubyid_dataset'>dataset</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_updated'>updated</span> <span class='op'><</span> <span class='id identifier rubyid_older_than_timestamp'>older_than_timestamp</span> <span class='rbrace'>}</span>
|
1048
|
+
<span class='kw'>end</span>
|
1049
|
+
<span class='comment'># Yield to the provided block once per row return
|
1050
|
+
</span> <span class='id identifier rubyid_dataset'>dataset</span><span class='period'>.</span><span class='id identifier rubyid_paged_each'>paged_each</span><span class='lparen'>(</span><span class='symbol'>:rows_per_fetch</span> <span class='op'>=></span> <span class='ivar'>@page_size</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
|
1051
|
+
<span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='lbracket'>[</span><span class='symbol'>:file_path</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1052
|
+
<span class='kw'>end</span>
|
1053
|
+
<span class='kw'>end</span></pre>
|
1054
|
+
</td>
|
1055
|
+
</tr>
|
1056
|
+
</table>
|
1057
|
+
</div>
|
1058
|
+
|
1059
|
+
<div class="method_details ">
|
1060
|
+
<h3 class="signature " id="first_service_execution_timestamp-instance_method">
|
1061
|
+
|
1062
|
+
#<strong>first_service_execution_timestamp</strong>(expected_services, md_rec) ⇒ <tt>Object</tt>
|
1063
|
+
|
1064
|
+
|
1065
|
+
|
1066
|
+
|
1067
|
+
|
1068
|
+
</h3><div class="docstring">
|
1069
|
+
<div class="discussion">
|
1070
|
+
|
1071
|
+
<p>Find the earliest service execution time for any services expected to be run for the specified file.</p>
|
1072
|
+
|
1073
|
+
|
1074
|
+
</div>
|
1075
|
+
</div>
|
1076
|
+
<div class="tags">
|
1077
|
+
<p class="tag_title">Parameters:</p>
|
1078
|
+
<ul class="param">
|
1079
|
+
|
1080
|
+
<li>
|
1081
|
+
|
1082
|
+
<span class='name'>expected_services</span>
|
1083
|
+
|
1084
|
+
|
1085
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1086
|
+
|
1087
|
+
|
1088
|
+
|
1089
|
+
—
|
1090
|
+
<div class='inline'>
|
1091
|
+
<p>list of ServiceDefinition objects expected for specified file.</p>
|
1092
|
+
</div>
|
1093
|
+
|
1094
|
+
</li>
|
1095
|
+
|
1096
|
+
<li>
|
1097
|
+
|
1098
|
+
<span class='name'>md_rec</span>
|
1099
|
+
|
1100
|
+
|
1101
|
+
<span class='type'>(<tt><span class='object_link'><a href="MetadataRecord.html" title="Longleaf::MetadataRecord (class)">MetadataRecord</a></span></tt>)</span>
|
1102
|
+
|
1103
|
+
|
1104
|
+
|
1105
|
+
—
|
1106
|
+
<div class='inline'>
|
1107
|
+
<p>metadata record for the file being evaluated</p>
|
1108
|
+
</div>
|
1109
|
+
|
1110
|
+
</li>
|
1111
|
+
|
1112
|
+
</ul>
|
1113
|
+
|
1114
|
+
<p class="tag_title">Returns:</p>
|
1115
|
+
<ul class="return">
|
1116
|
+
|
1117
|
+
<li>
|
1118
|
+
|
1119
|
+
|
1120
|
+
<span class='type'></span>
|
1121
|
+
|
1122
|
+
|
1123
|
+
|
1124
|
+
|
1125
|
+
<div class='inline'>
|
1126
|
+
<p>The timestamp of the earliest service execution time for the file described by md_rec, in iso8601 format. Returns nil if no services are expected all services have already run and do not have a next occurrence, or the file is deregistered.</p>
|
1127
|
+
</div>
|
1128
|
+
|
1129
|
+
</li>
|
1130
|
+
|
1131
|
+
</ul>
|
1132
|
+
|
1133
|
+
</div><table class="source_code">
|
1134
|
+
<tr>
|
1135
|
+
<td>
|
1136
|
+
<pre class="lines">
|
1137
|
+
|
1138
|
+
|
1139
|
+
105
|
1140
|
+
106
|
1141
|
+
107
|
1142
|
+
108
|
1143
|
+
109
|
1144
|
+
110
|
1145
|
+
111
|
1146
|
+
112
|
1147
|
+
113
|
1148
|
+
114
|
1149
|
+
115
|
1150
|
+
116
|
1151
|
+
117
|
1152
|
+
118
|
1153
|
+
119
|
1154
|
+
120
|
1155
|
+
121
|
1156
|
+
122
|
1157
|
+
123
|
1158
|
+
124
|
1159
|
+
125
|
1160
|
+
126
|
1161
|
+
127
|
1162
|
+
128
|
1163
|
+
129
|
1164
|
+
130
|
1165
|
+
131
|
1166
|
+
132
|
1167
|
+
133
|
1168
|
+
134
|
1169
|
+
135
|
1170
|
+
136
|
1171
|
+
137
|
1172
|
+
138
|
1173
|
+
139
|
1174
|
+
140
|
1175
|
+
141</pre>
|
1176
|
+
</td>
|
1177
|
+
<td>
|
1178
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 105</span>
|
1179
|
+
|
1180
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_first_service_execution_timestamp'>first_service_execution_timestamp</span><span class='lparen'>(</span><span class='id identifier rubyid_expected_services'>expected_services</span><span class='comma'>,</span> <span class='id identifier rubyid_md_rec'>md_rec</span><span class='rparen'>)</span>
|
1181
|
+
<span class='id identifier rubyid_current_time'>current_time</span> <span class='op'>=</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>
|
1182
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_md_rec'>md_rec</span><span class='period'>.</span><span class='id identifier rubyid_deregistered?'>deregistered?</span>
|
1183
|
+
<span class='kw'>return</span> <span class='kw'>nil</span>
|
1184
|
+
<span class='kw'>end</span>
|
1185
|
+
|
1186
|
+
<span class='id identifier rubyid_service_times'>service_times</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1187
|
+
|
1188
|
+
<span class='id identifier rubyid_present_services'>present_services</span> <span class='op'>=</span> <span class='id identifier rubyid_md_rec'>md_rec</span><span class='period'>.</span><span class='id identifier rubyid_list_services'>list_services</span>
|
1189
|
+
|
1190
|
+
<span class='id identifier rubyid_expected_services'>expected_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_service_def'>service_def</span><span class='op'>|</span>
|
1191
|
+
<span class='id identifier rubyid_service_name'>service_name</span> <span class='op'>=</span> <span class='id identifier rubyid_service_def'>service_def</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
|
1192
|
+
<span class='comment'># Service has never run, set execution time to now
|
1193
|
+
</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_present_services'>present_services</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_service_name'>service_name</span><span class='rparen'>)</span>
|
1194
|
+
<span class='id identifier rubyid_service_times'>service_times</span> <span class='op'><<</span> <span class='id identifier rubyid_current_time'>current_time</span>
|
1195
|
+
<span class='kw'>next</span>
|
1196
|
+
<span class='kw'>end</span>
|
1197
|
+
|
1198
|
+
<span class='id identifier rubyid_service_rec'>service_rec</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_service_name'>service_name</span><span class='rparen'>)</span>
|
1199
|
+
|
1200
|
+
<span class='comment'># Service either needs a run or has no timestamp, so execution time of now
|
1201
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_service_rec'>service_rec</span><span class='period'>.</span><span class='id identifier rubyid_run_needed'>run_needed</span> <span class='op'>||</span> <span class='id identifier rubyid_service_rec'>service_rec</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>
|
1202
|
+
<span class='id identifier rubyid_service_times'>service_times</span> <span class='op'><<</span> <span class='id identifier rubyid_current_time'>current_time</span>
|
1203
|
+
<span class='kw'>next</span>
|
1204
|
+
<span class='kw'>end</span>
|
1205
|
+
|
1206
|
+
<span class='comment'># Calculate the next time this service should run based on frequency
|
1207
|
+
</span> <span class='id identifier rubyid_frequency'>frequency</span> <span class='op'>=</span> <span class='id identifier rubyid_service_def'>service_def</span><span class='period'>.</span><span class='id identifier rubyid_frequency'>frequency</span>
|
1208
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_frequency'>frequency</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1209
|
+
<span class='id identifier rubyid_service_timestamp'>service_timestamp</span> <span class='op'>=</span> <span class='id identifier rubyid_service_rec'>service_rec</span><span class='period'>.</span><span class='id identifier rubyid_timestamp'>timestamp</span>
|
1210
|
+
<span class='id identifier rubyid_service_times'>service_times</span> <span class='op'><<</span> <span class='const'><span class='object_link'><a href="ServiceDateHelper.html" title="Longleaf::ServiceDateHelper (class)">ServiceDateHelper</a></span></span><span class='period'>.</span><span class='id identifier rubyid_add_to_timestamp'><span class='object_link'><a href="ServiceDateHelper.html#add_to_timestamp-class_method" title="Longleaf::ServiceDateHelper.add_to_timestamp (method)">add_to_timestamp</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_service_timestamp'>service_timestamp</span><span class='comma'>,</span> <span class='id identifier rubyid_frequency'>frequency</span><span class='rparen'>)</span>
|
1211
|
+
<span class='kw'>next</span>
|
1212
|
+
<span class='kw'>end</span>
|
1213
|
+
<span class='kw'>end</span>
|
1214
|
+
<span class='comment'># Return the lowest service execution time
|
1215
|
+
</span> <span class='id identifier rubyid_service_times'>service_times</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span>
|
1216
|
+
<span class='kw'>end</span></pre>
|
1217
|
+
</td>
|
1218
|
+
</tr>
|
1219
|
+
</table>
|
1220
|
+
</div>
|
1221
|
+
|
1222
|
+
<div class="method_details ">
|
1223
|
+
<h3 class="signature " id="index-instance_method">
|
1224
|
+
|
1225
|
+
#<strong>index</strong>(file_rec) ⇒ <tt>Object</tt>
|
1226
|
+
|
1227
|
+
|
1228
|
+
|
1229
|
+
|
1230
|
+
|
1231
|
+
</h3><div class="docstring">
|
1232
|
+
<div class="discussion">
|
1233
|
+
|
1234
|
+
<p>Index the provided file_rec and its metadata</p>
|
1235
|
+
|
1236
|
+
|
1237
|
+
</div>
|
1238
|
+
</div>
|
1239
|
+
<div class="tags">
|
1240
|
+
<p class="tag_title">Parameters:</p>
|
1241
|
+
<ul class="param">
|
1242
|
+
|
1243
|
+
<li>
|
1244
|
+
|
1245
|
+
<span class='name'>file_rec</span>
|
1246
|
+
|
1247
|
+
|
1248
|
+
<span class='type'>(<tt><span class='object_link'><a href="FileRecord.html" title="Longleaf::FileRecord (class)">FileRecord</a></span></tt>)</span>
|
1249
|
+
|
1250
|
+
|
1251
|
+
|
1252
|
+
—
|
1253
|
+
<div class='inline'>
|
1254
|
+
<p>file record to index</p>
|
1255
|
+
</div>
|
1256
|
+
|
1257
|
+
</li>
|
1258
|
+
|
1259
|
+
</ul>
|
1260
|
+
|
1261
|
+
|
1262
|
+
</div><table class="source_code">
|
1263
|
+
<tr>
|
1264
|
+
<td>
|
1265
|
+
<pre class="lines">
|
1266
|
+
|
1267
|
+
|
1268
|
+
59
|
1269
|
+
60
|
1270
|
+
61
|
1271
|
+
62
|
1272
|
+
63
|
1273
|
+
64
|
1274
|
+
65
|
1275
|
+
66
|
1276
|
+
67
|
1277
|
+
68
|
1278
|
+
69
|
1279
|
+
70
|
1280
|
+
71
|
1281
|
+
72
|
1282
|
+
73
|
1283
|
+
74
|
1284
|
+
75
|
1285
|
+
76
|
1286
|
+
77
|
1287
|
+
78
|
1288
|
+
79
|
1289
|
+
80
|
1290
|
+
81
|
1291
|
+
82
|
1292
|
+
83
|
1293
|
+
84
|
1294
|
+
85
|
1295
|
+
86
|
1296
|
+
87
|
1297
|
+
88
|
1298
|
+
89
|
1299
|
+
90
|
1300
|
+
91
|
1301
|
+
92
|
1302
|
+
93
|
1303
|
+
94
|
1304
|
+
95
|
1305
|
+
96</pre>
|
1306
|
+
</td>
|
1307
|
+
<td>
|
1308
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 59</span>
|
1309
|
+
|
1310
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='rparen'>)</span>
|
1311
|
+
<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>
|
1312
|
+
<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>
|
1313
|
+
<span class='id identifier rubyid_storage_loc'>storage_loc</span> <span class='op'>=</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='period'>.</span><span class='id identifier rubyid_storage_location'>storage_location</span>
|
1314
|
+
<span class='id identifier rubyid_service_manager'>service_manager</span> <span class='op'>=</span> <span class='ivar'>@app_config</span><span class='period'>.</span><span class='id identifier rubyid_service_manager'>service_manager</span>
|
1315
|
+
|
1316
|
+
<span class='comment'># Produce a list of service definitions which should apply to the file
|
1317
|
+
</span> <span class='id identifier rubyid_expected_services'>expected_services</span> <span class='op'>=</span> <span class='id identifier rubyid_service_manager'>service_manager</span><span class='period'>.</span><span class='id identifier rubyid_list_service_definitions'>list_service_definitions</span><span class='lparen'>(</span>
|
1318
|
+
<span class='label'>location:</span> <span class='id identifier rubyid_storage_loc'>storage_loc</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
1319
|
+
|
1320
|
+
<span class='id identifier rubyid_first_timestamp'>first_timestamp</span> <span class='op'>=</span> <span class='id identifier rubyid_first_service_execution_timestamp'>first_service_execution_timestamp</span><span class='lparen'>(</span><span class='id identifier rubyid_expected_services'>expected_services</span><span class='comma'>,</span> <span class='id identifier rubyid_md_rec'>md_rec</span><span class='rparen'>)</span>
|
1321
|
+
<span class='id identifier rubyid_delay_until_timestamp'>delay_until_timestamp</span> <span class='op'>=</span> <span class='id identifier rubyid_delay_until_timestamp'>delay_until_timestamp</span><span class='lparen'>(</span><span class='id identifier rubyid_md_rec'>md_rec</span><span class='rparen'>)</span>
|
1322
|
+
|
1323
|
+
<span class='id identifier rubyid_first_timestamp'>first_timestamp</span> <span class='op'>=</span> <span class='id identifier rubyid_convert_iso8601_to_timestamp'>convert_iso8601_to_timestamp</span><span class='lparen'>(</span><span class='id identifier rubyid_first_timestamp'>first_timestamp</span><span class='rparen'>)</span>
|
1324
|
+
<span class='id identifier rubyid_delay_until_timestamp'>delay_until_timestamp</span> <span class='op'>=</span> <span class='id identifier rubyid_convert_iso8601_to_timestamp'>convert_iso8601_to_timestamp</span><span class='lparen'>(</span><span class='id identifier rubyid_delay_until_timestamp'>delay_until_timestamp</span><span class='rparen'>)</span>
|
1325
|
+
<span class='id identifier rubyid_now_stamp'>now_stamp</span> <span class='op'>=</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_strftime'>strftime</span><span class='lparen'>(</span><span class='const'>TIMESTAMP_FORMAT</span><span class='rparen'>)</span>
|
1326
|
+
|
1327
|
+
<span class='kw'>if</span> <span class='ivar'>@adapter</span> <span class='op'>==</span> <span class='symbol'>:mysql</span> <span class='op'>||</span> <span class='ivar'>@adapter</span> <span class='op'>==</span> <span class='symbol'>:mysql2</span>
|
1328
|
+
<span class='id identifier rubyid_preserve_tbl'>preserve_tbl</span><span class='period'>.</span><span class='id identifier rubyid_on_duplicate_key_update'>on_duplicate_key_update</span>
|
1329
|
+
<span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='label'>file_path:</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span>
|
1330
|
+
<span class='label'>storage_location:</span> <span class='id identifier rubyid_storage_loc'>storage_loc</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
|
1331
|
+
<span class='label'>service_time:</span> <span class='id identifier rubyid_first_timestamp'>first_timestamp</span><span class='comma'>,</span>
|
1332
|
+
<span class='label'>delay_until_time:</span> <span class='id identifier rubyid_delay_until_timestamp'>delay_until_timestamp</span><span class='comma'>,</span>
|
1333
|
+
<span class='label'>updated:</span> <span class='id identifier rubyid_now_stamp'>now_stamp</span><span class='rparen'>)</span>
|
1334
|
+
<span class='kw'>else</span>
|
1335
|
+
<span class='id identifier rubyid_preserve_tbl'>preserve_tbl</span><span class='period'>.</span><span class='id identifier rubyid_insert_conflict'>insert_conflict</span><span class='lparen'>(</span><span class='label'>target:</span> <span class='symbol'>:file_path</span><span class='comma'>,</span>
|
1336
|
+
<span class='label'>update:</span> <span class='lbrace'>{</span>
|
1337
|
+
<span class='label'>storage_location:</span> <span class='id identifier rubyid_storage_loc'>storage_loc</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
|
1338
|
+
<span class='label'>service_time:</span> <span class='id identifier rubyid_first_timestamp'>first_timestamp</span><span class='comma'>,</span>
|
1339
|
+
<span class='label'>delay_until_time:</span> <span class='id identifier rubyid_delay_until_timestamp'>delay_until_timestamp</span><span class='comma'>,</span>
|
1340
|
+
<span class='label'>updated:</span> <span class='id identifier rubyid_now_stamp'>now_stamp</span> <span class='rbrace'>}</span> <span class='rparen'>)</span>
|
1341
|
+
<span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='label'>file_path:</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='comma'>,</span>
|
1342
|
+
<span class='label'>storage_location:</span> <span class='id identifier rubyid_storage_loc'>storage_loc</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
|
1343
|
+
<span class='label'>service_time:</span> <span class='id identifier rubyid_first_timestamp'>first_timestamp</span><span class='comma'>,</span>
|
1344
|
+
<span class='label'>delay_until_time:</span> <span class='id identifier rubyid_delay_until_timestamp'>delay_until_timestamp</span><span class='comma'>,</span>
|
1345
|
+
<span class='label'>updated:</span> <span class='id identifier rubyid_now_stamp'>now_stamp</span><span class='rparen'>)</span>
|
1346
|
+
<span class='kw'>end</span>
|
1347
|
+
<span class='kw'>end</span></pre>
|
1348
|
+
</td>
|
1349
|
+
</tr>
|
1350
|
+
</table>
|
1351
|
+
</div>
|
1352
|
+
|
1353
|
+
<div class="method_details ">
|
1354
|
+
<h3 class="signature " id="is_stale?-instance_method">
|
1355
|
+
|
1356
|
+
#<strong>is_stale?</strong> ⇒ <tt>Boolean</tt>
|
1357
|
+
|
1358
|
+
|
1359
|
+
|
1360
|
+
|
1361
|
+
|
1362
|
+
</h3><div class="docstring">
|
1363
|
+
<div class="discussion">
|
1364
|
+
|
1365
|
+
<p>Returns true if the application configuration does not match the configuration used for the last reindex.</p>
|
1366
|
+
|
1367
|
+
|
1368
|
+
</div>
|
1369
|
+
</div>
|
1370
|
+
<div class="tags">
|
1371
|
+
|
1372
|
+
<p class="tag_title">Returns:</p>
|
1373
|
+
<ul class="return">
|
1374
|
+
|
1375
|
+
<li>
|
1376
|
+
|
1377
|
+
|
1378
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1379
|
+
|
1380
|
+
|
1381
|
+
|
1382
|
+
</li>
|
1383
|
+
|
1384
|
+
</ul>
|
1385
|
+
|
1386
|
+
</div><table class="source_code">
|
1387
|
+
<tr>
|
1388
|
+
<td>
|
1389
|
+
<pre class="lines">
|
1390
|
+
|
1391
|
+
|
1392
|
+
52
|
1393
|
+
53
|
1394
|
+
54</pre>
|
1395
|
+
</td>
|
1396
|
+
<td>
|
1397
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 52</span>
|
1398
|
+
|
1399
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_stale?'>is_stale?</span>
|
1400
|
+
<span class='id identifier rubyid_db_conn'>db_conn</span><span class='lbracket'>[</span><span class='const'>INDEX_STATE_TBL</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='label'>config_md5:</span> <span class='ivar'>@config_md5</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>==</span> <span class='int'>0</span>
|
1401
|
+
<span class='kw'>end</span></pre>
|
1402
|
+
</td>
|
1403
|
+
</tr>
|
1404
|
+
</table>
|
1405
|
+
</div>
|
1406
|
+
|
1407
|
+
<div class="method_details ">
|
1408
|
+
<h3 class="signature " id="minimum_timestamp-instance_method">
|
1409
|
+
|
1410
|
+
#<strong>minimum_timestamp</strong> ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
1411
|
+
|
1412
|
+
|
1413
|
+
|
1414
|
+
|
1415
|
+
|
1416
|
+
</h3><table class="source_code">
|
1417
|
+
<tr>
|
1418
|
+
<td>
|
1419
|
+
<pre class="lines">
|
1420
|
+
|
1421
|
+
|
1422
|
+
307
|
1423
|
+
308
|
1424
|
+
309
|
1425
|
+
310
|
1426
|
+
311
|
1427
|
+
312</pre>
|
1428
|
+
</td>
|
1429
|
+
<td>
|
1430
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 307</span>
|
1431
|
+
|
1432
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_minimum_timestamp'>minimum_timestamp</span>
|
1433
|
+
<span class='kw'>if</span> <span class='ivar'>@min_timestamp</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1434
|
+
<span class='ivar'>@min_timestamp</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="ServiceDateHelper.html" title="Longleaf::ServiceDateHelper (class)">ServiceDateHelper</a></span></span><span class='period'>.</span><span class='id identifier rubyid_formatted_timestamp'><span class='object_link'><a href="ServiceDateHelper.html#formatted_timestamp-class_method" title="Longleaf::ServiceDateHelper.formatted_timestamp (method)">formatted_timestamp</a></span></span><span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_utc'>utc</span><span class='rparen'>)</span>
|
1435
|
+
<span class='kw'>end</span>
|
1436
|
+
<span class='ivar'>@min_timestamp</span>
|
1437
|
+
<span class='kw'>end</span></pre>
|
1438
|
+
</td>
|
1439
|
+
</tr>
|
1440
|
+
</table>
|
1441
|
+
</div>
|
1442
|
+
|
1443
|
+
<div class="method_details ">
|
1444
|
+
<h3 class="signature " id="paths_with_stale_services-instance_method">
|
1445
|
+
|
1446
|
+
#<strong>paths_with_stale_services</strong>(file_selector, stale_datetime) ⇒ <tt>Array</tt>
|
1447
|
+
|
1448
|
+
|
1449
|
+
|
1450
|
+
|
1451
|
+
|
1452
|
+
</h3><div class="docstring">
|
1453
|
+
<div class="discussion">
|
1454
|
+
|
1455
|
+
<p>Retrieves page of file paths which have one or more services which need to run.</p>
|
1456
|
+
|
1457
|
+
|
1458
|
+
</div>
|
1459
|
+
</div>
|
1460
|
+
<div class="tags">
|
1461
|
+
<p class="tag_title">Parameters:</p>
|
1462
|
+
<ul class="param">
|
1463
|
+
|
1464
|
+
<li>
|
1465
|
+
|
1466
|
+
<span class='name'>file_selector</span>
|
1467
|
+
|
1468
|
+
|
1469
|
+
<span class='type'>(<tt><span class='object_link'><a href="FileSelector.html" title="Longleaf::FileSelector (class)">FileSelector</a></span></tt>)</span>
|
1470
|
+
|
1471
|
+
|
1472
|
+
|
1473
|
+
—
|
1474
|
+
<div class='inline'>
|
1475
|
+
<p>selector for what paths to search for files</p>
|
1476
|
+
</div>
|
1477
|
+
|
1478
|
+
</li>
|
1479
|
+
|
1480
|
+
<li>
|
1481
|
+
|
1482
|
+
<span class='name'>stale_datetime</span>
|
1483
|
+
|
1484
|
+
|
1485
|
+
<span class='type'>(<tt>DateTime</tt>)</span>
|
1486
|
+
|
1487
|
+
|
1488
|
+
|
1489
|
+
—
|
1490
|
+
<div class='inline'>
|
1491
|
+
<p>find file_paths with services needing to be run before this value</p>
|
1492
|
+
</div>
|
1493
|
+
|
1494
|
+
</li>
|
1495
|
+
|
1496
|
+
</ul>
|
1497
|
+
|
1498
|
+
<p class="tag_title">Returns:</p>
|
1499
|
+
<ul class="return">
|
1500
|
+
|
1501
|
+
<li>
|
1502
|
+
|
1503
|
+
|
1504
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1505
|
+
|
1506
|
+
|
1507
|
+
|
1508
|
+
—
|
1509
|
+
<div class='inline'>
|
1510
|
+
<p>array of file paths that need one or more services run.</p>
|
1511
|
+
</div>
|
1512
|
+
|
1513
|
+
</li>
|
1514
|
+
|
1515
|
+
</ul>
|
1516
|
+
|
1517
|
+
</div><table class="source_code">
|
1518
|
+
<tr>
|
1519
|
+
<td>
|
1520
|
+
<pre class="lines">
|
1521
|
+
|
1522
|
+
|
1523
|
+
238
|
1524
|
+
239
|
1525
|
+
240
|
1526
|
+
241
|
1527
|
+
242
|
1528
|
+
243
|
1529
|
+
244
|
1530
|
+
245
|
1531
|
+
246
|
1532
|
+
247
|
1533
|
+
248
|
1534
|
+
249
|
1535
|
+
250
|
1536
|
+
251
|
1537
|
+
252</pre>
|
1538
|
+
</td>
|
1539
|
+
<td>
|
1540
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 238</span>
|
1541
|
+
|
1542
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_paths_with_stale_services'>paths_with_stale_services</span><span class='lparen'>(</span><span class='id identifier rubyid_file_selector'>file_selector</span><span class='comma'>,</span> <span class='id identifier rubyid_stale_datetime'>stale_datetime</span><span class='rparen'>)</span>
|
1543
|
+
<span class='kw'>if</span> <span class='ivar'>@preserve_dataset</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1544
|
+
<span class='ivar'>@preserve_dataset</span> <span class='op'>=</span> <span class='id identifier rubyid_db_conn'>db_conn</span>
|
1545
|
+
<span class='period'>.</span><span class='id identifier rubyid_from'>from</span><span class='lparen'>(</span><span class='const'>PRESERVE_TBL</span><span class='rparen'>)</span>
|
1546
|
+
<span class='period'>.</span><span class='id identifier rubyid_exclude'>exclude</span><span class='lparen'>(</span><span class='label'>service_time:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1547
|
+
<span class='period'>.</span><span class='id identifier rubyid_limit'>limit</span><span class='lparen'>(</span><span class='ivar'>@page_size</span><span class='rparen'>)</span>
|
1548
|
+
<span class='period'>.</span><span class='id identifier rubyid_order'>order</span><span class='lparen'>(</span><span class='const'>Sequel</span><span class='period'>.</span><span class='id identifier rubyid_asc'>asc</span><span class='lparen'>(</span><span class='symbol'>:service_time</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1549
|
+
<span class='kw'>end</span>
|
1550
|
+
|
1551
|
+
<span class='comment'># retrieve and return a page of results
|
1552
|
+
</span> <span class='id identifier rubyid_ds'>ds</span> <span class='op'>=</span> <span class='id identifier rubyid_add_path_restrictions'>add_path_restrictions</span><span class='lparen'>(</span><span class='ivar'>@preserve_dataset</span><span class='comma'>,</span> <span class='id identifier rubyid_file_selector'>file_selector</span><span class='rparen'>)</span>
|
1553
|
+
<span class='period'>.</span><span class='id identifier rubyid_where'>where</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_service_time'>service_time</span> <span class='op'><=</span> <span class='id identifier rubyid_stale_datetime'>stale_datetime</span> <span class='rbrace'>}</span>
|
1554
|
+
<span class='period'>.</span><span class='id identifier rubyid_where'>where</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_delay_until_time'>delay_until_time</span> <span class='op'><</span> <span class='id identifier rubyid_stale_datetime'>stale_datetime</span> <span class='rbrace'>}</span>
|
1555
|
+
<span class='period'>.</span><span class='id identifier rubyid_select_map'>select_map</span><span class='lparen'>(</span><span class='symbol'>:file_path</span><span class='rparen'>)</span>
|
1556
|
+
<span class='kw'>end</span></pre>
|
1557
|
+
</td>
|
1558
|
+
</tr>
|
1559
|
+
</table>
|
1560
|
+
</div>
|
1561
|
+
|
1562
|
+
<div class="method_details ">
|
1563
|
+
<h3 class="signature " id="preserve_tbl-instance_method">
|
1564
|
+
|
1565
|
+
#<strong>preserve_tbl</strong> ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
1566
|
+
|
1567
|
+
|
1568
|
+
|
1569
|
+
|
1570
|
+
|
1571
|
+
</h3><table class="source_code">
|
1572
|
+
<tr>
|
1573
|
+
<td>
|
1574
|
+
<pre class="lines">
|
1575
|
+
|
1576
|
+
|
1577
|
+
287
|
1578
|
+
288
|
1579
|
+
289
|
1580
|
+
290</pre>
|
1581
|
+
</td>
|
1582
|
+
<td>
|
1583
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 287</span>
|
1584
|
+
|
1585
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_preserve_tbl'>preserve_tbl</span>
|
1586
|
+
<span class='ivar'>@preserve_tbl</span> <span class='op'>=</span> <span class='id identifier rubyid_db_conn'>db_conn</span><span class='lbracket'>[</span><span class='const'>PRESERVE_TBL</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='ivar'>@preserve_tbl</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1587
|
+
<span class='ivar'>@preserve_tbl</span>
|
1588
|
+
<span class='kw'>end</span></pre>
|
1589
|
+
</td>
|
1590
|
+
</tr>
|
1591
|
+
</table>
|
1592
|
+
</div>
|
1593
|
+
|
1594
|
+
<div class="method_details ">
|
1595
|
+
<h3 class="signature " id="registered_dataset-instance_method">
|
1596
|
+
|
1597
|
+
#<strong>registered_dataset</strong> ⇒ <tt>Object</tt> <span class="extras">(private)</span>
|
1598
|
+
|
1599
|
+
|
1600
|
+
|
1601
|
+
|
1602
|
+
|
1603
|
+
</h3><table class="source_code">
|
1604
|
+
<tr>
|
1605
|
+
<td>
|
1606
|
+
<pre class="lines">
|
1607
|
+
|
1608
|
+
|
1609
|
+
314
|
1610
|
+
315
|
1611
|
+
316
|
1612
|
+
317
|
1613
|
+
318
|
1614
|
+
319
|
1615
|
+
320
|
1616
|
+
321
|
1617
|
+
322</pre>
|
1618
|
+
</td>
|
1619
|
+
<td>
|
1620
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 314</span>
|
1621
|
+
|
1622
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_registered_dataset'>registered_dataset</span>
|
1623
|
+
<span class='kw'>if</span> <span class='ivar'>@registered_dataset</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1624
|
+
<span class='ivar'>@registered_dataset</span> <span class='op'>=</span> <span class='id identifier rubyid_db_conn'>db_conn</span>
|
1625
|
+
<span class='period'>.</span><span class='id identifier rubyid_from'>from</span><span class='lparen'>(</span><span class='const'>PRESERVE_TBL</span><span class='rparen'>)</span>
|
1626
|
+
<span class='period'>.</span><span class='id identifier rubyid_limit'>limit</span><span class='lparen'>(</span><span class='ivar'>@page_size</span><span class='rparen'>)</span>
|
1627
|
+
<span class='period'>.</span><span class='id identifier rubyid_order'>order</span><span class='lparen'>(</span><span class='const'>Sequel</span><span class='period'>.</span><span class='id identifier rubyid_asc'>asc</span><span class='lparen'>(</span><span class='symbol'>:service_time</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1628
|
+
<span class='kw'>end</span>
|
1629
|
+
<span class='ivar'>@registered_dataset</span>
|
1630
|
+
<span class='kw'>end</span></pre>
|
1631
|
+
</td>
|
1632
|
+
</tr>
|
1633
|
+
</table>
|
1634
|
+
</div>
|
1635
|
+
|
1636
|
+
<div class="method_details ">
|
1637
|
+
<h3 class="signature " id="registered_paths-instance_method">
|
1638
|
+
|
1639
|
+
#<strong>registered_paths</strong>(file_selector) ⇒ <tt>Array</tt>
|
1640
|
+
|
1641
|
+
|
1642
|
+
|
1643
|
+
|
1644
|
+
|
1645
|
+
</h3><div class="docstring">
|
1646
|
+
<div class="discussion">
|
1647
|
+
|
1648
|
+
<p>Retrieves a page of paths for registered files.</p>
|
1649
|
+
|
1650
|
+
|
1651
|
+
</div>
|
1652
|
+
</div>
|
1653
|
+
<div class="tags">
|
1654
|
+
<p class="tag_title">Parameters:</p>
|
1655
|
+
<ul class="param">
|
1656
|
+
|
1657
|
+
<li>
|
1658
|
+
|
1659
|
+
<span class='name'>file_selector</span>
|
1660
|
+
|
1661
|
+
|
1662
|
+
<span class='type'>(<tt><span class='object_link'><a href="FileSelector.html" title="Longleaf::FileSelector (class)">FileSelector</a></span></tt>)</span>
|
1663
|
+
|
1664
|
+
|
1665
|
+
|
1666
|
+
—
|
1667
|
+
<div class='inline'>
|
1668
|
+
<p>selector for what paths to search for files</p>
|
1669
|
+
</div>
|
1670
|
+
|
1671
|
+
</li>
|
1672
|
+
|
1673
|
+
</ul>
|
1674
|
+
|
1675
|
+
<p class="tag_title">Returns:</p>
|
1676
|
+
<ul class="return">
|
1677
|
+
|
1678
|
+
<li>
|
1679
|
+
|
1680
|
+
|
1681
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1682
|
+
|
1683
|
+
|
1684
|
+
|
1685
|
+
—
|
1686
|
+
<div class='inline'>
|
1687
|
+
<p>array of file paths that are registered</p>
|
1688
|
+
</div>
|
1689
|
+
|
1690
|
+
</li>
|
1691
|
+
|
1692
|
+
</ul>
|
1693
|
+
|
1694
|
+
</div><table class="source_code">
|
1695
|
+
<tr>
|
1696
|
+
<td>
|
1697
|
+
<pre class="lines">
|
1698
|
+
|
1699
|
+
|
1700
|
+
257
|
1701
|
+
258
|
1702
|
+
259
|
1703
|
+
260
|
1704
|
+
261</pre>
|
1705
|
+
</td>
|
1706
|
+
<td>
|
1707
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 257</span>
|
1708
|
+
|
1709
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_registered_paths'>registered_paths</span><span class='lparen'>(</span><span class='id identifier rubyid_file_selector'>file_selector</span><span class='rparen'>)</span>
|
1710
|
+
<span class='comment'># retrieve and return a page of results
|
1711
|
+
</span> <span class='id identifier rubyid_add_path_restrictions'>add_path_restrictions</span><span class='lparen'>(</span><span class='id identifier rubyid_registered_dataset'>registered_dataset</span><span class='comma'>,</span> <span class='id identifier rubyid_file_selector'>file_selector</span><span class='rparen'>)</span>
|
1712
|
+
<span class='period'>.</span><span class='id identifier rubyid_select_map'>select_map</span><span class='lparen'>(</span><span class='symbol'>:file_path</span><span class='rparen'>)</span>
|
1713
|
+
<span class='kw'>end</span></pre>
|
1714
|
+
</td>
|
1715
|
+
</tr>
|
1716
|
+
</table>
|
1717
|
+
</div>
|
1718
|
+
|
1719
|
+
<div class="method_details ">
|
1720
|
+
<h3 class="signature " id="remove-instance_method">
|
1721
|
+
|
1722
|
+
#<strong>remove</strong>(remove_me) ⇒ <tt>Object</tt>
|
1723
|
+
|
1724
|
+
|
1725
|
+
|
1726
|
+
|
1727
|
+
|
1728
|
+
</h3><div class="docstring">
|
1729
|
+
<div class="discussion">
|
1730
|
+
|
1731
|
+
<p>Remove an entry from the index</p>
|
1732
|
+
|
1733
|
+
|
1734
|
+
</div>
|
1735
|
+
</div>
|
1736
|
+
<div class="tags">
|
1737
|
+
<p class="tag_title">Parameters:</p>
|
1738
|
+
<ul class="param">
|
1739
|
+
|
1740
|
+
<li>
|
1741
|
+
|
1742
|
+
<span class='name'>remove_me</span>
|
1743
|
+
|
1744
|
+
|
1745
|
+
<span class='type'></span>
|
1746
|
+
|
1747
|
+
|
1748
|
+
|
1749
|
+
—
|
1750
|
+
<div class='inline'>
|
1751
|
+
<p>The record to remove from the index. May be a FileRecord or a String.</p>
|
1752
|
+
</div>
|
1753
|
+
|
1754
|
+
</li>
|
1755
|
+
|
1756
|
+
</ul>
|
1757
|
+
|
1758
|
+
|
1759
|
+
</div><table class="source_code">
|
1760
|
+
<tr>
|
1761
|
+
<td>
|
1762
|
+
<pre class="lines">
|
1763
|
+
|
1764
|
+
|
1765
|
+
155
|
1766
|
+
156
|
1767
|
+
157
|
1768
|
+
158
|
1769
|
+
159
|
1770
|
+
160
|
1771
|
+
161
|
1772
|
+
162
|
1773
|
+
163
|
1774
|
+
164
|
1775
|
+
165
|
1776
|
+
166</pre>
|
1777
|
+
</td>
|
1778
|
+
<td>
|
1779
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 155</span>
|
1780
|
+
|
1781
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='id identifier rubyid_remove_me'>remove_me</span><span class='rparen'>)</span>
|
1782
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_remove_me'>remove_me</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>
|
1783
|
+
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_remove_me'>remove_me</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span>
|
1784
|
+
<span class='kw'>else</span>
|
1785
|
+
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='id identifier rubyid_remove_me'>remove_me</span>
|
1786
|
+
<span class='kw'>end</span>
|
1787
|
+
|
1788
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_preserve_tbl'>preserve_tbl</span><span class='period'>.</span><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='label'>file_path:</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
|
1789
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span> <span class='op'>==</span> <span class='int'>0</span>
|
1790
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_warn'>warn</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Could not remove </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'> from the index, path was not present.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1791
|
+
<span class='kw'>end</span>
|
1792
|
+
<span class='kw'>end</span></pre>
|
1793
|
+
</td>
|
1794
|
+
</tr>
|
1795
|
+
</table>
|
1796
|
+
</div>
|
1797
|
+
|
1798
|
+
<div class="method_details ">
|
1799
|
+
<h3 class="signature " id="setup_index-instance_method">
|
1800
|
+
|
1801
|
+
#<strong>setup_index</strong> ⇒ <tt>Object</tt>
|
1802
|
+
|
1803
|
+
|
1804
|
+
|
1805
|
+
|
1806
|
+
|
1807
|
+
</h3><div class="docstring">
|
1808
|
+
<div class="discussion">
|
1809
|
+
|
1810
|
+
<p>Initialize the index's database using the provided configuration</p>
|
1811
|
+
|
1812
|
+
|
1813
|
+
</div>
|
1814
|
+
</div>
|
1815
|
+
<div class="tags">
|
1816
|
+
|
1817
|
+
|
1818
|
+
</div><table class="source_code">
|
1819
|
+
<tr>
|
1820
|
+
<td>
|
1821
|
+
<pre class="lines">
|
1822
|
+
|
1823
|
+
|
1824
|
+
181
|
1825
|
+
182
|
1826
|
+
183
|
1827
|
+
184
|
1828
|
+
185
|
1829
|
+
186
|
1830
|
+
187
|
1831
|
+
188
|
1832
|
+
189
|
1833
|
+
190
|
1834
|
+
191
|
1835
|
+
192
|
1836
|
+
193
|
1837
|
+
194
|
1838
|
+
195
|
1839
|
+
196
|
1840
|
+
197
|
1841
|
+
198
|
1842
|
+
199
|
1843
|
+
200
|
1844
|
+
201
|
1845
|
+
202
|
1846
|
+
203
|
1847
|
+
204
|
1848
|
+
205
|
1849
|
+
206
|
1850
|
+
207
|
1851
|
+
208
|
1852
|
+
209
|
1853
|
+
210
|
1854
|
+
211
|
1855
|
+
212
|
1856
|
+
213
|
1857
|
+
214
|
1858
|
+
215
|
1859
|
+
216
|
1860
|
+
217
|
1861
|
+
218
|
1862
|
+
219
|
1863
|
+
220
|
1864
|
+
221</pre>
|
1865
|
+
</td>
|
1866
|
+
<td>
|
1867
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 181</span>
|
1868
|
+
|
1869
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_setup_index'>setup_index</span>
|
1870
|
+
<span class='comment'># Create the table for tracking when files will need preservation services run on them.
|
1871
|
+
</span> <span class='kw'>case</span> <span class='ivar'>@adapter</span>
|
1872
|
+
<span class='kw'>when</span> <span class='symbol'>:mysql</span><span class='comma'>,</span> <span class='symbol'>:mysql2</span>
|
1873
|
+
<span class='comment'># mysql does not support 'text' fields as primary keys
|
1874
|
+
</span> <span class='id identifier rubyid_db_conn'>db_conn</span><span class='period'>.</span><span class='id identifier rubyid_create_table!'>create_table!</span><span class='lparen'>(</span><span class='const'>PRESERVE_TBL</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
1875
|
+
<span class='const'>String</span> <span class='symbol'>:file_path</span><span class='comma'>,</span> <span class='label'>primary_key:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>size:</span> <span class='int'>768</span>
|
1876
|
+
<span class='id identifier rubyid_column'>column</span> <span class='symbol'>:storage_location</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>varchar(128)</span><span class='tstring_end'>'</span></span>
|
1877
|
+
<span class='id identifier rubyid_column'>column</span> <span class='symbol'>:service_time</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>timestamp(3)</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='lbrace'>{</span> <span class='symbol'>:null</span> <span class='op'>=></span> <span class='kw'>true</span> <span class='rbrace'>}</span>
|
1878
|
+
<span class='id identifier rubyid_column'>column</span> <span class='symbol'>:delay_until_time</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>timestamp(3)</span><span class='tstring_end'>'</span></span>
|
1879
|
+
<span class='id identifier rubyid_column'>column</span> <span class='symbol'>:updated</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>timestamp(3)</span><span class='tstring_end'>'</span></span>
|
1880
|
+
<span class='kw'>end</span>
|
1881
|
+
<span class='kw'>else</span>
|
1882
|
+
<span class='id identifier rubyid_db_conn'>db_conn</span><span class='period'>.</span><span class='id identifier rubyid_create_table!'>create_table!</span><span class='lparen'>(</span><span class='const'>PRESERVE_TBL</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
1883
|
+
<span class='const'>String</span> <span class='symbol'>:file_path</span><span class='comma'>,</span> <span class='label'>primary_key:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>text:</span> <span class='kw'>true</span>
|
1884
|
+
<span class='id identifier rubyid_column'>column</span> <span class='symbol'>:storage_location</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>varchar(128)</span><span class='tstring_end'>'</span></span>
|
1885
|
+
<span class='id identifier rubyid_column'>column</span> <span class='symbol'>:service_time</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>timestamp(3)</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='lbrace'>{</span> <span class='symbol'>:null</span> <span class='op'>=></span> <span class='kw'>true</span> <span class='rbrace'>}</span>
|
1886
|
+
<span class='id identifier rubyid_column'>column</span> <span class='symbol'>:delay_until_time</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>timestamp(3)</span><span class='tstring_end'>'</span></span>
|
1887
|
+
<span class='id identifier rubyid_column'>column</span> <span class='symbol'>:updated</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>timestamp(3)</span><span class='tstring_end'>'</span></span>
|
1888
|
+
<span class='kw'>end</span>
|
1889
|
+
<span class='kw'>end</span>
|
1890
|
+
|
1891
|
+
<span class='comment'># Setup database indexes
|
1892
|
+
</span> <span class='kw'>case</span> <span class='ivar'>@adapter</span>
|
1893
|
+
<span class='kw'>when</span> <span class='symbol'>:postgres</span>
|
1894
|
+
<span class='id identifier rubyid_db_conn'>db_conn</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>CREATE INDEX service_times_file_path_text_index ON preserve_service_times (file_path text_pattern_ops)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1895
|
+
<span class='kw'>when</span> <span class='symbol'>:sqlite</span><span class='comma'>,</span> <span class='symbol'>:amalgalite</span>
|
1896
|
+
<span class='id identifier rubyid_db_conn'>db_conn</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>CREATE INDEX service_times_file_path_text_index ON preserve_service_times (file_path collate nocase)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1897
|
+
<span class='kw'>end</span>
|
1898
|
+
<span class='id identifier rubyid_db_conn'>db_conn</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>CREATE INDEX service_times_storage_location_index ON preserve_service_times (storage_location)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1899
|
+
|
1900
|
+
<span class='comment'># Create table for tracking the state of the index
|
1901
|
+
</span> <span class='id identifier rubyid_db_conn'>db_conn</span><span class='period'>.</span><span class='id identifier rubyid_create_table!'>create_table!</span><span class='lparen'>(</span><span class='const'>INDEX_STATE_TBL</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
1902
|
+
<span class='const'>String</span> <span class='symbol'>:config_md5</span>
|
1903
|
+
<span class='const'>DateTime</span> <span class='symbol'>:last_reindexed</span>
|
1904
|
+
<span class='const'>String</span> <span class='symbol'>:longleaf_version</span>
|
1905
|
+
<span class='kw'>end</span>
|
1906
|
+
|
1907
|
+
<span class='comment'># Prepopulate the index state information
|
1908
|
+
</span> <span class='id identifier rubyid_update_index_state'>update_index_state</span>
|
1909
|
+
<span class='kw'>end</span></pre>
|
1910
|
+
</td>
|
1911
|
+
</tr>
|
1912
|
+
</table>
|
1913
|
+
</div>
|
1914
|
+
|
1915
|
+
<div class="method_details ">
|
1916
|
+
<h3 class="signature " id="update_index_state-instance_method">
|
1917
|
+
|
1918
|
+
#<strong>update_index_state</strong> ⇒ <tt>Object</tt>
|
1919
|
+
|
1920
|
+
|
1921
|
+
|
1922
|
+
|
1923
|
+
|
1924
|
+
</h3><div class="docstring">
|
1925
|
+
<div class="discussion">
|
1926
|
+
|
1927
|
+
<p>Updates the state information for the index to indicate that the index has been refreshed or is in sync with the application's configuration.</p>
|
1928
|
+
|
1929
|
+
|
1930
|
+
</div>
|
1931
|
+
</div>
|
1932
|
+
<div class="tags">
|
1933
|
+
|
1934
|
+
|
1935
|
+
</div><table class="source_code">
|
1936
|
+
<tr>
|
1937
|
+
<td>
|
1938
|
+
<pre class="lines">
|
1939
|
+
|
1940
|
+
|
1941
|
+
225
|
1942
|
+
226
|
1943
|
+
227
|
1944
|
+
228
|
1945
|
+
229
|
1946
|
+
230
|
1947
|
+
231
|
1948
|
+
232</pre>
|
1949
|
+
</td>
|
1950
|
+
<td>
|
1951
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/indexing/sequel_index_driver.rb', line 225</span>
|
1952
|
+
|
1953
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_update_index_state'>update_index_state</span>
|
1954
|
+
<span class='id identifier rubyid_index_state_tbl'>index_state_tbl</span> <span class='op'>=</span> <span class='id identifier rubyid_db_conn'>db_conn</span><span class='lbracket'>[</span><span class='const'>INDEX_STATE_TBL</span><span class='rbracket'>]</span>
|
1955
|
+
<span class='id identifier rubyid_index_state_tbl'>index_state_tbl</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span>
|
1956
|
+
<span class='id identifier rubyid_index_state_tbl'>index_state_tbl</span><span class='period'>.</span><span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span>
|
1957
|
+
<span class='label'>config_md5:</span> <span class='ivar'>@config_md5</span><span class='comma'>,</span>
|
1958
|
+
<span class='label'>last_reindexed:</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='comma'>,</span>
|
1959
|
+
<span class='label'>longleaf_version:</span> <span class='const'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Longleaf.html#VERSION-constant" title="Longleaf::VERSION (constant)">VERSION</a></span></span><span class='rparen'>)</span>
|
1960
|
+
<span class='kw'>end</span></pre>
|
1961
|
+
</td>
|
1962
|
+
</tr>
|
1963
|
+
</table>
|
1964
|
+
</div>
|
1965
|
+
|
1966
|
+
</div>
|
1967
|
+
|
1968
|
+
</div>
|
1969
|
+
|
1970
|
+
<div id="footer">
|
1971
|
+
Generated on Tue May 28 15:48:02 2019 by
|
1972
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1973
|
+
0.9.19 (ruby-2.6.3).
|
1974
|
+
</div>
|
1975
|
+
|
1976
|
+
</div>
|
1977
|
+
</body>
|
1978
|
+
</html>
|