longleaf 0.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +94 -0
  3. data/.editorconfig +13 -0
  4. data/.gitignore +4 -1
  5. data/.rubocop.yml +44 -0
  6. data/.rubocop_todo.yml +834 -0
  7. data/.yardopts +1 -0
  8. data/Gemfile +16 -1
  9. data/README.md +98 -12
  10. data/Rakefile +6 -0
  11. data/bin/setup +16 -1
  12. data/docs/aboutlongleaf.md +28 -0
  13. data/docs/extra.css +32 -0
  14. data/docs/img/change-file.png +0 -0
  15. data/docs/img/ll-example-preserved.png +0 -0
  16. data/docs/index.md +19 -0
  17. data/docs/install.md +66 -0
  18. data/docs/ll-example/config-example-relative.yml +33 -0
  19. data/docs/ll-example/files-dir/LLexample-PDF.pdf +0 -0
  20. data/docs/ll-example/files-dir/LLexample-TOCHANGE.txt +15 -0
  21. data/docs/ll-example/files-dir/LLexample-tokeep.txt +10 -0
  22. data/docs/ll-example/metadata-dir/.gitkeep +0 -0
  23. data/docs/ll-example/replica-files/.gitkeep +0 -0
  24. data/docs/ll-example/replica-metadata/.gitkeep +0 -0
  25. data/docs/quickstart.md +270 -0
  26. data/docs/rdocs/Longleaf.html +135 -0
  27. data/docs/rdocs/Longleaf/AppFields.html +178 -0
  28. data/docs/rdocs/Longleaf/ApplicationConfigDeserializer.html +631 -0
  29. data/docs/rdocs/Longleaf/ApplicationConfigManager.html +610 -0
  30. data/docs/rdocs/Longleaf/ApplicationConfigValidator.html +238 -0
  31. data/docs/rdocs/Longleaf/CLI.html +909 -0
  32. data/docs/rdocs/Longleaf/ChecksumMismatchError.html +151 -0
  33. data/docs/rdocs/Longleaf/ConfigBuilder.html +1339 -0
  34. data/docs/rdocs/Longleaf/ConfigurationError.html +143 -0
  35. data/docs/rdocs/Longleaf/ConfigurationValidator.html +227 -0
  36. data/docs/rdocs/Longleaf/DeregisterCommand.html +420 -0
  37. data/docs/rdocs/Longleaf/DeregisterEvent.html +453 -0
  38. data/docs/rdocs/Longleaf/DeregistrationError.html +151 -0
  39. data/docs/rdocs/Longleaf/DigestHelper.html +419 -0
  40. data/docs/rdocs/Longleaf/EventError.html +147 -0
  41. data/docs/rdocs/Longleaf/EventNames.html +163 -0
  42. data/docs/rdocs/Longleaf/EventStatusTracking.html +656 -0
  43. data/docs/rdocs/Longleaf/FileCheckService.html +540 -0
  44. data/docs/rdocs/Longleaf/FileHelpers.html +520 -0
  45. data/docs/rdocs/Longleaf/FileRecord.html +716 -0
  46. data/docs/rdocs/Longleaf/FileSelector.html +901 -0
  47. data/docs/rdocs/Longleaf/FixityCheckService.html +691 -0
  48. data/docs/rdocs/Longleaf/IndexManager.html +1155 -0
  49. data/docs/rdocs/Longleaf/InvalidDigestAlgorithmError.html +143 -0
  50. data/docs/rdocs/Longleaf/InvalidStoragePathError.html +143 -0
  51. data/docs/rdocs/Longleaf/Logging.html +405 -0
  52. data/docs/rdocs/Longleaf/Logging/RedirectingLogger.html +1213 -0
  53. data/docs/rdocs/Longleaf/LongleafError.html +139 -0
  54. data/docs/rdocs/Longleaf/MDFields.html +193 -0
  55. data/docs/rdocs/Longleaf/MetadataBuilder.html +787 -0
  56. data/docs/rdocs/Longleaf/MetadataDeserializer.html +537 -0
  57. data/docs/rdocs/Longleaf/MetadataError.html +143 -0
  58. data/docs/rdocs/Longleaf/MetadataPersistenceManager.html +539 -0
  59. data/docs/rdocs/Longleaf/MetadataRecord.html +1411 -0
  60. data/docs/rdocs/Longleaf/MetadataSerializer.html +786 -0
  61. data/docs/rdocs/Longleaf/PreservationServiceError.html +147 -0
  62. data/docs/rdocs/Longleaf/PreserveCommand.html +410 -0
  63. data/docs/rdocs/Longleaf/PreserveEvent.html +491 -0
  64. data/docs/rdocs/Longleaf/RegisterCommand.html +428 -0
  65. data/docs/rdocs/Longleaf/RegisterEvent.html +628 -0
  66. data/docs/rdocs/Longleaf/RegisteredFileSelector.html +446 -0
  67. data/docs/rdocs/Longleaf/RegistrationError.html +151 -0
  68. data/docs/rdocs/Longleaf/ReindexCommand.html +576 -0
  69. data/docs/rdocs/Longleaf/RsyncReplicationService.html +1180 -0
  70. data/docs/rdocs/Longleaf/SequelIndexDriver.html +1978 -0
  71. data/docs/rdocs/Longleaf/ServiceCandidateFilesystemIterator.html +572 -0
  72. data/docs/rdocs/Longleaf/ServiceCandidateIndexIterator.html +532 -0
  73. data/docs/rdocs/Longleaf/ServiceCandidateLocator.html +333 -0
  74. data/docs/rdocs/Longleaf/ServiceClassCache.html +725 -0
  75. data/docs/rdocs/Longleaf/ServiceDateHelper.html +425 -0
  76. data/docs/rdocs/Longleaf/ServiceDefinition.html +683 -0
  77. data/docs/rdocs/Longleaf/ServiceDefinitionManager.html +371 -0
  78. data/docs/rdocs/Longleaf/ServiceDefinitionValidator.html +269 -0
  79. data/docs/rdocs/Longleaf/ServiceFields.html +173 -0
  80. data/docs/rdocs/Longleaf/ServiceManager.html +1229 -0
  81. data/docs/rdocs/Longleaf/ServiceMappingManager.html +410 -0
  82. data/docs/rdocs/Longleaf/ServiceMappingValidator.html +347 -0
  83. data/docs/rdocs/Longleaf/ServiceRecord.html +821 -0
  84. data/docs/rdocs/Longleaf/StorageLocation.html +985 -0
  85. data/docs/rdocs/Longleaf/StorageLocationManager.html +729 -0
  86. data/docs/rdocs/Longleaf/StorageLocationUnavailableError.html +143 -0
  87. data/docs/rdocs/Longleaf/StorageLocationValidator.html +373 -0
  88. data/docs/rdocs/Longleaf/StoragePathValidator.html +253 -0
  89. data/docs/rdocs/Longleaf/SystemConfigBuilder.html +441 -0
  90. data/docs/rdocs/Longleaf/SystemConfigFields.html +163 -0
  91. data/docs/rdocs/Longleaf/ValidateConfigCommand.html +451 -0
  92. data/docs/rdocs/Longleaf/ValidateMetadataCommand.html +408 -0
  93. data/docs/rdocs/_index.html +660 -0
  94. data/docs/rdocs/class_list.html +51 -0
  95. data/docs/rdocs/css/common.css +1 -0
  96. data/docs/rdocs/css/full_list.css +58 -0
  97. data/docs/rdocs/css/style.css +496 -0
  98. data/docs/rdocs/file.README.html +165 -0
  99. data/docs/rdocs/file_list.html +56 -0
  100. data/docs/rdocs/frames.html +17 -0
  101. data/docs/rdocs/index.html +165 -0
  102. data/docs/rdocs/js/app.js +303 -0
  103. data/docs/rdocs/js/full_list.js +216 -0
  104. data/docs/rdocs/js/jquery.js +4 -0
  105. data/docs/rdocs/method_list.html +2051 -0
  106. data/docs/rdocs/top-level-namespace.html +110 -0
  107. data/lib/longleaf/candidates/file_selector.rb +150 -0
  108. data/lib/longleaf/candidates/manifest_digest_provider.rb +17 -0
  109. data/lib/longleaf/candidates/physical_path_provider.rb +17 -0
  110. data/lib/longleaf/candidates/registered_file_selector.rb +67 -0
  111. data/lib/longleaf/candidates/service_candidate_filesystem_iterator.rb +93 -0
  112. data/lib/longleaf/candidates/service_candidate_index_iterator.rb +84 -0
  113. data/lib/longleaf/candidates/service_candidate_locator.rb +23 -0
  114. data/lib/longleaf/candidates/single_digest_provider.rb +13 -0
  115. data/lib/longleaf/cli.rb +252 -46
  116. data/lib/longleaf/commands/deregister_command.rb +51 -0
  117. data/lib/longleaf/commands/preserve_command.rb +50 -0
  118. data/lib/longleaf/commands/register_command.rb +34 -43
  119. data/lib/longleaf/commands/reindex_command.rb +92 -0
  120. data/lib/longleaf/commands/validate_config_command.rb +33 -8
  121. data/lib/longleaf/commands/validate_metadata_command.rb +51 -0
  122. data/lib/longleaf/errors.rb +26 -7
  123. data/lib/longleaf/events/deregister_event.rb +53 -0
  124. data/lib/longleaf/events/event_names.rb +9 -0
  125. data/lib/longleaf/events/event_status_tracking.rb +59 -0
  126. data/lib/longleaf/events/preserve_event.rb +82 -0
  127. data/lib/longleaf/events/register_event.rb +59 -51
  128. data/lib/longleaf/helpers/case_insensitive_hash.rb +38 -0
  129. data/lib/longleaf/helpers/digest_helper.rb +56 -0
  130. data/lib/longleaf/helpers/s3_uri_helper.rb +86 -0
  131. data/lib/longleaf/helpers/selection_options_parser.rb +215 -0
  132. data/lib/longleaf/helpers/service_date_helper.rb +78 -0
  133. data/lib/longleaf/indexing/index_manager.rb +101 -0
  134. data/lib/longleaf/indexing/sequel_index_driver.rb +306 -0
  135. data/lib/longleaf/logging.rb +5 -4
  136. data/lib/longleaf/logging/redirecting_logger.rb +30 -25
  137. data/lib/longleaf/models/app_fields.rb +7 -2
  138. data/lib/longleaf/models/file_record.rb +31 -8
  139. data/lib/longleaf/models/filesystem_metadata_location.rb +56 -0
  140. data/lib/longleaf/models/filesystem_storage_location.rb +52 -0
  141. data/lib/longleaf/models/md_fields.rb +3 -1
  142. data/lib/longleaf/models/metadata_location.rb +47 -0
  143. data/lib/longleaf/models/metadata_record.rb +43 -16
  144. data/lib/longleaf/models/s3_storage_location.rb +138 -0
  145. data/lib/longleaf/models/service_definition.rb +7 -6
  146. data/lib/longleaf/models/service_fields.rb +7 -1
  147. data/lib/longleaf/models/service_record.rb +10 -6
  148. data/lib/longleaf/models/storage_location.rb +24 -19
  149. data/lib/longleaf/models/storage_types.rb +9 -0
  150. data/lib/longleaf/models/system_config_fields.rb +9 -0
  151. data/lib/longleaf/preservation_services/file_check_service.rb +59 -0
  152. data/lib/longleaf/preservation_services/fixity_check_service.rb +124 -0
  153. data/lib/longleaf/preservation_services/rsync_replication_service.rb +198 -0
  154. data/lib/longleaf/preservation_services/s3_replication_service.rb +131 -0
  155. data/lib/longleaf/services/application_config_deserializer.rb +81 -24
  156. data/lib/longleaf/services/application_config_manager.rb +20 -6
  157. data/lib/longleaf/services/application_config_validator.rb +19 -9
  158. data/lib/longleaf/services/configuration_validator.rb +67 -4
  159. data/lib/longleaf/services/filesystem_location_validator.rb +16 -0
  160. data/lib/longleaf/services/metadata_deserializer.rb +115 -42
  161. data/lib/longleaf/services/metadata_persistence_manager.rb +47 -0
  162. data/lib/longleaf/services/metadata_serializer.rb +156 -23
  163. data/lib/longleaf/services/metadata_validator.rb +76 -0
  164. data/lib/longleaf/services/s3_location_validator.rb +19 -0
  165. data/lib/longleaf/services/service_class_cache.rb +112 -0
  166. data/lib/longleaf/services/service_definition_manager.rb +10 -7
  167. data/lib/longleaf/services/service_definition_validator.rb +25 -18
  168. data/lib/longleaf/services/service_manager.rb +86 -11
  169. data/lib/longleaf/services/service_mapping_manager.rb +13 -12
  170. data/lib/longleaf/services/service_mapping_validator.rb +36 -26
  171. data/lib/longleaf/services/storage_location_manager.rb +76 -15
  172. data/lib/longleaf/services/storage_location_validator.rb +49 -35
  173. data/lib/longleaf/specs/config_builder.rb +47 -23
  174. data/lib/longleaf/specs/config_validator_helpers.rb +16 -0
  175. data/lib/longleaf/specs/custom_matchers.rb +9 -0
  176. data/lib/longleaf/specs/file_helpers.rb +61 -0
  177. data/lib/longleaf/specs/metadata_builder.rb +98 -0
  178. data/lib/longleaf/specs/system_config_builder.rb +27 -0
  179. data/lib/longleaf/version.rb +1 -1
  180. data/longleaf.gemspec +20 -7
  181. data/mkdocs.yml +21 -0
  182. metadata +308 -24
  183. data/.travis.yml +0 -4
  184. data/lib/longleaf/commands/abstract_command.rb +0 -37
  185. data/lib/longleaf/services/storage_path_validator.rb +0 -16
@@ -0,0 +1,173 @@
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::ServiceFields
8
+
9
+ &mdash; Documentation by YARD 0.9.19
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Longleaf::ServiceFields";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span>
41
+ &raquo;
42
+ <span class="title">ServiceFields</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::ServiceFields
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::ServiceFields</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/longleaf/models/service_fields.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Constants for common configuration fields for preservation service definitions</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+ <h2>
116
+ Constant Summary
117
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
118
+ </h2>
119
+
120
+ <dl class="constants">
121
+
122
+ <dt id="WORK_SCRIPT-constant" class="">WORK_SCRIPT =
123
+
124
+ </dt>
125
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>work_script</span><span class='tstring_end'>&#39;</span></span></pre></dd>
126
+
127
+ <dt id="WORK_CLASS-constant" class="">WORK_CLASS =
128
+
129
+ </dt>
130
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>work_class</span><span class='tstring_end'>&#39;</span></span></pre></dd>
131
+
132
+ <dt id="FREQUENCY-constant" class="">FREQUENCY =
133
+
134
+ </dt>
135
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>frequency</span><span class='tstring_end'>&#39;</span></span></pre></dd>
136
+
137
+ <dt id="DELAY-constant" class="">DELAY =
138
+
139
+ </dt>
140
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>delay</span><span class='tstring_end'>&#39;</span></span></pre></dd>
141
+
142
+ <dt id="REPLICATE_TO-constant" class="">REPLICATE_TO =
143
+
144
+ </dt>
145
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>to</span><span class='tstring_end'>&#39;</span></span></pre></dd>
146
+
147
+ <dt id="DIGEST_ALGORITHMS-constant" class="">DIGEST_ALGORITHMS =
148
+
149
+ </dt>
150
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>algorithms</span><span class='tstring_end'>&#39;</span></span></pre></dd>
151
+
152
+ </dl>
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+ </div>
164
+
165
+ <div id="footer">
166
+ Generated on Tue May 28 15:48:01 2019 by
167
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
168
+ 0.9.19 (ruby-2.6.3).
169
+ </div>
170
+
171
+ </div>
172
+ </body>
173
+ </html>
@@ -0,0 +1,1229 @@
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::ServiceManager
8
+
9
+ &mdash; Documentation by YARD 0.9.19
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Longleaf::ServiceManager";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span>
41
+ &raquo;
42
+ <span class="title">ServiceManager</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::ServiceManager
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::ServiceManager</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ <dl>
96
+ <dt>Defined in:</dt>
97
+ <dd>lib/longleaf/services/service_manager.rb</dd>
98
+ </dl>
99
+
100
+ </div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>Manager which provides preservation service definitions based on their mappings</p>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div>
114
+
115
+
116
+
117
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
118
+ <ul class="summary">
119
+
120
+ <li class="public ">
121
+ <span class="summary_signature">
122
+
123
+ <a href="#definition_manager-instance_method" title="#definition_manager (instance method)">#<strong>definition_manager</strong> &#x21d2; Object </a>
124
+
125
+
126
+
127
+ </span>
128
+
129
+
130
+
131
+
132
+ <span class="note title readonly">readonly</span>
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+ <span class="summary_desc"><div class='inline'>
143
+ <p>Returns the value of attribute definition_manager.</p>
144
+ </div></span>
145
+
146
+ </li>
147
+
148
+
149
+ <li class="public ">
150
+ <span class="summary_signature">
151
+
152
+ <a href="#mapping_manager-instance_method" title="#mapping_manager (instance method)">#<strong>mapping_manager</strong> &#x21d2; Object </a>
153
+
154
+
155
+
156
+ </span>
157
+
158
+
159
+
160
+
161
+ <span class="note title readonly">readonly</span>
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+ <span class="summary_desc"><div class='inline'>
172
+ <p>Returns the value of attribute mapping_manager.</p>
173
+ </div></span>
174
+
175
+ </li>
176
+
177
+
178
+ </ul>
179
+
180
+
181
+
182
+
183
+
184
+ <h2>
185
+ Instance Method Summary
186
+ <small><a href="#" class="summary_toggle">collapse</a></small>
187
+ </h2>
188
+
189
+ <ul class="summary">
190
+
191
+ <li class="public ">
192
+ <span class="summary_signature">
193
+
194
+ <a href="#applicable_for_event%3F-instance_method" title="#applicable_for_event? (instance method)">#<strong>applicable_for_event?</strong>(service_name, event) &#x21d2; Boolean </a>
195
+
196
+
197
+
198
+ </span>
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+ <span class="summary_desc"><div class='inline'>
209
+ <p>Determines if a service is applicable for a specific preservation event.</p>
210
+ </div></span>
211
+
212
+ </li>
213
+
214
+
215
+ <li class="public ">
216
+ <span class="summary_signature">
217
+
218
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(definition_manager:, mapping_manager:, app_manager:) &#x21d2; ServiceManager </a>
219
+
220
+
221
+
222
+ </span>
223
+
224
+
225
+ <span class="note title constructor">constructor</span>
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+ <span class="summary_desc"><div class='inline'>
235
+ <p>A new instance of ServiceManager.</p>
236
+ </div></span>
237
+
238
+ </li>
239
+
240
+
241
+ <li class="public ">
242
+ <span class="summary_signature">
243
+
244
+ <a href="#list_service_definitions-instance_method" title="#list_service_definitions (instance method)">#<strong>list_service_definitions</strong>(location: nil, event: nil) &#x21d2; Array </a>
245
+
246
+
247
+
248
+ </span>
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+ <span class="summary_desc"><div class='inline'>
259
+ <p>List definitions for services which are applicable to the given criteria.</p>
260
+ </div></span>
261
+
262
+ </li>
263
+
264
+
265
+ <li class="public ">
266
+ <span class="summary_signature">
267
+
268
+ <a href="#list_services-instance_method" title="#list_services (instance method)">#<strong>list_services</strong>(location: nil, event: nil) &#x21d2; Array </a>
269
+
270
+
271
+
272
+ </span>
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+ <span class="summary_desc"><div class='inline'>
283
+ <p>List the names of services which are applicable to the given criteria.</p>
284
+ </div></span>
285
+
286
+ </li>
287
+
288
+
289
+ <li class="public ">
290
+ <span class="summary_signature">
291
+
292
+ <a href="#perform_service-instance_method" title="#perform_service (instance method)">#<strong>perform_service</strong>(service_name, file_rec, event) &#x21d2; Object </a>
293
+
294
+
295
+
296
+ </span>
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+ <span class="summary_desc"><div class='inline'>
307
+ <p>Perform the specified service on the file record, in the context of the specified event.</p>
308
+ </div></span>
309
+
310
+ </li>
311
+
312
+
313
+ <li class="public ">
314
+ <span class="summary_signature">
315
+
316
+ <a href="#service-instance_method" title="#service (instance method)">#<strong>service</strong>(service_name) &#x21d2; Object </a>
317
+
318
+
319
+
320
+ </span>
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+ <span class="summary_desc"><div class='inline'>
331
+ <p>Return a service instance instance for provided service name.</p>
332
+ </div></span>
333
+
334
+ </li>
335
+
336
+
337
+ <li class="public ">
338
+ <span class="summary_signature">
339
+
340
+ <a href="#service_needed%3F-instance_method" title="#service_needed? (instance method)">#<strong>service_needed?</strong>(service_name, md_rec) &#x21d2; Boolean </a>
341
+
342
+
343
+
344
+ </span>
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+ <span class="summary_desc"><div class='inline'>
355
+ <p>Determine if a service should run for a particular file based on the service&#39;s definition and the file&#39;s service related metadata.</p>
356
+ </div></span>
357
+
358
+ </li>
359
+
360
+
361
+ </ul>
362
+
363
+
364
+ <div id="constructor_details" class="method_details_list">
365
+ <h2>Constructor Details</h2>
366
+
367
+ <div class="method_details first">
368
+ <h3 class="signature first" id="initialize-instance_method">
369
+
370
+ #<strong>initialize</strong>(definition_manager:, mapping_manager:, app_manager:) &#x21d2; <tt><span class='object_link'><a href="" title="Longleaf::ServiceManager (class)">ServiceManager</a></span></tt>
371
+
372
+
373
+
374
+
375
+
376
+ </h3><div class="docstring">
377
+ <div class="discussion">
378
+
379
+ <p>Returns a new instance of ServiceManager</p>
380
+
381
+
382
+ </div>
383
+ </div>
384
+ <div class="tags">
385
+ <p class="tag_title">Parameters:</p>
386
+ <ul class="param">
387
+
388
+ <li>
389
+
390
+ <span class='name'>definition_manager</span>
391
+
392
+
393
+ <span class='type'>(<tt><span class='object_link'><a href="ServiceDefinitionManager.html" title="Longleaf::ServiceDefinitionManager (class)">ServiceDefinitionManager</a></span></tt>)</span>
394
+
395
+
396
+
397
+ &mdash;
398
+ <div class='inline'>
399
+ <p>the service definition manager</p>
400
+ </div>
401
+
402
+ </li>
403
+
404
+ <li>
405
+
406
+ <span class='name'>mapping_manager</span>
407
+
408
+
409
+ <span class='type'>(<tt><span class='object_link'><a href="ServiceMappingManager.html" title="Longleaf::ServiceMappingManager (class)">ServiceMappingManager</a></span></tt>)</span>
410
+
411
+
412
+
413
+ &mdash;
414
+ <div class='inline'>
415
+ <p>the mapping of services to locations</p>
416
+ </div>
417
+
418
+ </li>
419
+
420
+ <li>
421
+
422
+ <span class='name'>app_manager</span>
423
+
424
+
425
+ <span class='type'>(<tt><span class='object_link'><a href="ApplicationConfigManager.html" title="Longleaf::ApplicationConfigManager (class)">ApplicationConfigManager</a></span></tt>)</span>
426
+
427
+
428
+
429
+ &mdash;
430
+ <div class='inline'>
431
+ <p>manager for storage locations</p>
432
+ </div>
433
+
434
+ </li>
435
+
436
+ </ul>
437
+
438
+ <p class="tag_title">Raises:</p>
439
+ <ul class="raise">
440
+
441
+ <li>
442
+
443
+
444
+ <span class='type'>(<tt>ArgumentError</tt>)</span>
445
+
446
+
447
+
448
+ </li>
449
+
450
+ </ul>
451
+
452
+ </div><table class="source_code">
453
+ <tr>
454
+ <td>
455
+ <pre class="lines">
456
+
457
+
458
+ 13
459
+ 14
460
+ 15
461
+ 16
462
+ 17
463
+ 18
464
+ 19
465
+ 20
466
+ 21</pre>
467
+ </td>
468
+ <td>
469
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/service_manager.rb', line 13</span>
470
+
471
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>definition_manager:</span><span class='comma'>,</span> <span class='label'>mapping_manager:</span><span class='comma'>,</span> <span class='label'>app_manager:</span><span class='rparen'>)</span>
472
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Service definition manager required</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_definition_manager'>definition_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
473
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Service mappings manager required</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_mapping_manager'>mapping_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
474
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Storage location manager required</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_app_manager'>app_manager</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
475
+ <span class='ivar'>@definition_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_definition_manager'>definition_manager</span>
476
+ <span class='ivar'>@mapping_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_mapping_manager'>mapping_manager</span>
477
+ <span class='ivar'>@app_manager</span> <span class='op'>=</span> <span class='id identifier rubyid_app_manager'>app_manager</span>
478
+ <span class='ivar'>@service_class_cache</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="ServiceClassCache.html" title="Longleaf::ServiceClassCache (class)">ServiceClassCache</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="ServiceClassCache.html#initialize-instance_method" title="Longleaf::ServiceClassCache#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_app_manager'>app_manager</span><span class='rparen'>)</span>
479
+ <span class='kw'>end</span></pre>
480
+ </td>
481
+ </tr>
482
+ </table>
483
+ </div>
484
+
485
+ </div>
486
+
487
+ <div id="instance_attr_details" class="attr_details">
488
+ <h2>Instance Attribute Details</h2>
489
+
490
+
491
+ <span id=""></span>
492
+ <div class="method_details first">
493
+ <h3 class="signature first" id="definition_manager-instance_method">
494
+
495
+ #<strong>definition_manager</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
496
+
497
+
498
+
499
+
500
+
501
+ </h3><div class="docstring">
502
+ <div class="discussion">
503
+
504
+ <p>Returns the value of attribute definition_manager</p>
505
+
506
+
507
+ </div>
508
+ </div>
509
+ <div class="tags">
510
+
511
+
512
+ </div><table class="source_code">
513
+ <tr>
514
+ <td>
515
+ <pre class="lines">
516
+
517
+
518
+ 7
519
+ 8
520
+ 9</pre>
521
+ </td>
522
+ <td>
523
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/service_manager.rb', line 7</span>
524
+
525
+ <span class='kw'>def</span> <span class='id identifier rubyid_definition_manager'>definition_manager</span>
526
+ <span class='ivar'>@definition_manager</span>
527
+ <span class='kw'>end</span></pre>
528
+ </td>
529
+ </tr>
530
+ </table>
531
+ </div>
532
+
533
+
534
+ <span id=""></span>
535
+ <div class="method_details ">
536
+ <h3 class="signature " id="mapping_manager-instance_method">
537
+
538
+ #<strong>mapping_manager</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
539
+
540
+
541
+
542
+
543
+
544
+ </h3><div class="docstring">
545
+ <div class="discussion">
546
+
547
+ <p>Returns the value of attribute mapping_manager</p>
548
+
549
+
550
+ </div>
551
+ </div>
552
+ <div class="tags">
553
+
554
+
555
+ </div><table class="source_code">
556
+ <tr>
557
+ <td>
558
+ <pre class="lines">
559
+
560
+
561
+ 8
562
+ 9
563
+ 10</pre>
564
+ </td>
565
+ <td>
566
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/service_manager.rb', line 8</span>
567
+
568
+ <span class='kw'>def</span> <span class='id identifier rubyid_mapping_manager'>mapping_manager</span>
569
+ <span class='ivar'>@mapping_manager</span>
570
+ <span class='kw'>end</span></pre>
571
+ </td>
572
+ </tr>
573
+ </table>
574
+ </div>
575
+
576
+ </div>
577
+
578
+
579
+ <div id="instance_method_details" class="method_details_list">
580
+ <h2>Instance Method Details</h2>
581
+
582
+
583
+ <div class="method_details first">
584
+ <h3 class="signature first" id="applicable_for_event?-instance_method">
585
+
586
+ #<strong>applicable_for_event?</strong>(service_name, event) &#x21d2; <tt>Boolean</tt>
587
+
588
+
589
+
590
+
591
+
592
+ </h3><div class="docstring">
593
+ <div class="discussion">
594
+
595
+ <p>Determines if a service is applicable for a specific preservation event</p>
596
+
597
+
598
+ </div>
599
+ </div>
600
+ <div class="tags">
601
+ <p class="tag_title">Parameters:</p>
602
+ <ul class="param">
603
+
604
+ <li>
605
+
606
+ <span class='name'>service_name</span>
607
+
608
+
609
+ <span class='type'>(<tt>String</tt>)</span>
610
+
611
+
612
+
613
+ &mdash;
614
+ <div class='inline'>
615
+ <p>name of the service being evaluated</p>
616
+ </div>
617
+
618
+ </li>
619
+
620
+ <li>
621
+
622
+ <span class='name'>event</span>
623
+
624
+
625
+ <span class='type'>(<tt>String</tt>)</span>
626
+
627
+
628
+
629
+ &mdash;
630
+ <div class='inline'>
631
+ <p>name of the event to check against</p>
632
+ </div>
633
+
634
+ </li>
635
+
636
+ </ul>
637
+
638
+ <p class="tag_title">Returns:</p>
639
+ <ul class="return">
640
+
641
+ <li>
642
+
643
+
644
+ <span class='type'>(<tt>Boolean</tt>)</span>
645
+
646
+
647
+
648
+ &mdash;
649
+ <div class='inline'>
650
+ <p>true if the service is applicable for the event</p>
651
+ </div>
652
+
653
+ </li>
654
+
655
+ </ul>
656
+
657
+ </div><table class="source_code">
658
+ <tr>
659
+ <td>
660
+ <pre class="lines">
661
+
662
+
663
+ 61
664
+ 62
665
+ 63</pre>
666
+ </td>
667
+ <td>
668
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/service_manager.rb', line 61</span>
669
+
670
+ <span class='kw'>def</span> <span class='id identifier rubyid_applicable_for_event?'>applicable_for_event?</span><span class='lparen'>(</span><span class='id identifier rubyid_service_name'>service_name</span><span class='comma'>,</span> <span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
671
+ <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><span class='period'>.</span><span class='id identifier rubyid_is_applicable?'>is_applicable?</span><span class='lparen'>(</span><span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
672
+ <span class='kw'>end</span></pre>
673
+ </td>
674
+ </tr>
675
+ </table>
676
+ </div>
677
+
678
+ <div class="method_details ">
679
+ <h3 class="signature " id="list_service_definitions-instance_method">
680
+
681
+ #<strong>list_service_definitions</strong>(location: nil, event: nil) &#x21d2; <tt>Array</tt>
682
+
683
+
684
+
685
+
686
+
687
+ </h3><div class="docstring">
688
+ <div class="discussion">
689
+
690
+ <p>List definitions for services which are applicable to the given criteria</p>
691
+
692
+
693
+ </div>
694
+ </div>
695
+ <div class="tags">
696
+ <p class="tag_title">Parameters:</p>
697
+ <ul class="param">
698
+
699
+ <li>
700
+
701
+ <span class='name'>location</span>
702
+
703
+
704
+ <span class='type'>(<tt>String</tt>)</span>
705
+
706
+
707
+
708
+ &mdash;
709
+ <div class='inline'>
710
+ <p>name of the locations to lookup</p>
711
+ </div>
712
+
713
+ </li>
714
+
715
+ <li>
716
+
717
+ <span class='name'>event</span>
718
+
719
+
720
+ <span class='type'>(<tt>String</tt>)</span>
721
+
722
+
723
+
724
+ &mdash;
725
+ <div class='inline'>
726
+ <p>name of the preservation event taking place</p>
727
+ </div>
728
+
729
+ </li>
730
+
731
+ </ul>
732
+
733
+ <p class="tag_title">Returns:</p>
734
+ <ul class="return">
735
+
736
+ <li>
737
+
738
+
739
+ <span class='type'>(<tt>Array</tt>)</span>
740
+
741
+
742
+
743
+ &mdash;
744
+ <div class='inline'>
745
+ <p>List of service definitions which match the provided criteria</p>
746
+ </div>
747
+
748
+ </li>
749
+
750
+ </ul>
751
+
752
+ </div><table class="source_code">
753
+ <tr>
754
+ <td>
755
+ <pre class="lines">
756
+
757
+
758
+ 52
759
+ 53
760
+ 54
761
+ 55</pre>
762
+ </td>
763
+ <td>
764
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/service_manager.rb', line 52</span>
765
+
766
+ <span class='kw'>def</span> <span class='id identifier rubyid_list_service_definitions'>list_service_definitions</span><span class='lparen'>(</span><span class='label'>location:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>event:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
767
+ <span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_list_services'>list_services</span><span class='lparen'>(</span><span class='label'>location:</span> <span class='id identifier rubyid_location'>location</span><span class='comma'>,</span> <span class='label'>event:</span> <span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
768
+ <span class='id identifier rubyid_names'>names</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_name'>name</span><span class='op'>|</span> <span class='ivar'>@definition_manager</span><span class='period'>.</span><span class='id identifier rubyid_services'>services</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='rbrace'>}</span>
769
+ <span class='kw'>end</span></pre>
770
+ </td>
771
+ </tr>
772
+ </table>
773
+ </div>
774
+
775
+ <div class="method_details ">
776
+ <h3 class="signature " id="list_services-instance_method">
777
+
778
+ #<strong>list_services</strong>(location: nil, event: nil) &#x21d2; <tt>Array</tt>
779
+
780
+
781
+
782
+
783
+
784
+ </h3><div class="docstring">
785
+ <div class="discussion">
786
+
787
+ <p>List the names of services which are applicable to the given criteria</p>
788
+
789
+
790
+ </div>
791
+ </div>
792
+ <div class="tags">
793
+ <p class="tag_title">Parameters:</p>
794
+ <ul class="param">
795
+
796
+ <li>
797
+
798
+ <span class='name'>location</span>
799
+
800
+
801
+ <span class='type'>(<tt>String</tt>)</span>
802
+
803
+
804
+
805
+ &mdash;
806
+ <div class='inline'>
807
+ <p>name of the locations to lookup</p>
808
+ </div>
809
+
810
+ </li>
811
+
812
+ <li>
813
+
814
+ <span class='name'>event</span>
815
+
816
+
817
+ <span class='type'>(<tt>String</tt>)</span>
818
+
819
+
820
+
821
+ &mdash;
822
+ <div class='inline'>
823
+ <p>name of the preservation event taking place</p>
824
+ </div>
825
+
826
+ </li>
827
+
828
+ </ul>
829
+
830
+ <p class="tag_title">Returns:</p>
831
+ <ul class="return">
832
+
833
+ <li>
834
+
835
+
836
+ <span class='type'>(<tt>Array</tt>)</span>
837
+
838
+
839
+
840
+ &mdash;
841
+ <div class='inline'>
842
+ <p>a list of service names which match the provided criteria</p>
843
+ </div>
844
+
845
+ </li>
846
+
847
+ </ul>
848
+
849
+ </div><table class="source_code">
850
+ <tr>
851
+ <td>
852
+ <pre class="lines">
853
+
854
+
855
+ 38
856
+ 39
857
+ 40
858
+ 41
859
+ 42
860
+ 43
861
+ 44
862
+ 45
863
+ 46</pre>
864
+ </td>
865
+ <td>
866
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/service_manager.rb', line 38</span>
867
+
868
+ <span class='kw'>def</span> <span class='id identifier rubyid_list_services'>list_services</span><span class='lparen'>(</span><span class='label'>location:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>event:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
869
+ <span class='id identifier rubyid_service_names'>service_names</span> <span class='op'>=</span> <span class='ivar'>@mapping_manager</span><span class='period'>.</span><span class='id identifier rubyid_list_services'>list_services</span><span class='lparen'>(</span><span class='id identifier rubyid_location'>location</span><span class='rparen'>)</span>
870
+ <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_event'>event</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
871
+ <span class='comment'># Filter service names down by event
872
+ </span> <span class='id identifier rubyid_service_names'>service_names</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='op'>|</span> <span class='id identifier rubyid_applicable_for_event?'>applicable_for_event?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
873
+ <span class='kw'>else</span>
874
+ <span class='id identifier rubyid_service_names'>service_names</span>
875
+ <span class='kw'>end</span>
876
+ <span class='kw'>end</span></pre>
877
+ </td>
878
+ </tr>
879
+ </table>
880
+ </div>
881
+
882
+ <div class="method_details ">
883
+ <h3 class="signature " id="perform_service-instance_method">
884
+
885
+ #<strong>perform_service</strong>(service_name, file_rec, event) &#x21d2; <tt>Object</tt>
886
+
887
+
888
+
889
+
890
+
891
+ </h3><div class="docstring">
892
+ <div class="discussion">
893
+
894
+ <p>Perform the specified service on the file record, in the context of the specified event</p>
895
+
896
+
897
+ </div>
898
+ </div>
899
+ <div class="tags">
900
+ <p class="tag_title">Parameters:</p>
901
+ <ul class="param">
902
+
903
+ <li>
904
+
905
+ <span class='name'>service_name</span>
906
+
907
+
908
+ <span class='type'>(<tt>String</tt>)</span>
909
+
910
+
911
+
912
+ &mdash;
913
+ <div class='inline'>
914
+ <p>name of the service</p>
915
+ </div>
916
+
917
+ </li>
918
+
919
+ <li>
920
+
921
+ <span class='name'>file_rec</span>
922
+
923
+
924
+ <span class='type'>(<tt><span class='object_link'><a href="FileRecord.html" title="Longleaf::FileRecord (class)">FileRecord</a></span></tt>)</span>
925
+
926
+
927
+
928
+ &mdash;
929
+ <div class='inline'>
930
+ <p>file record to perform service upon</p>
931
+ </div>
932
+
933
+ </li>
934
+
935
+ <li>
936
+
937
+ <span class='name'>event</span>
938
+
939
+
940
+ <span class='type'>(<tt>String</tt>)</span>
941
+
942
+
943
+
944
+ &mdash;
945
+ <div class='inline'>
946
+ <p>name of the event service is being performed within.</p>
947
+ </div>
948
+
949
+ </li>
950
+
951
+ </ul>
952
+
953
+
954
+ </div><table class="source_code">
955
+ <tr>
956
+ <td>
957
+ <pre class="lines">
958
+
959
+
960
+ 97
961
+ 98
962
+ 99
963
+ 100
964
+ 101
965
+ 102</pre>
966
+ </td>
967
+ <td>
968
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/service_manager.rb', line 97</span>
969
+
970
+ <span class='kw'>def</span> <span class='id identifier rubyid_perform_service'>perform_service</span><span class='lparen'>(</span><span class='id identifier rubyid_service_name'>service_name</span><span class='comma'>,</span> <span class='id identifier rubyid_file_rec'>file_rec</span><span class='comma'>,</span> <span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
971
+ <span class='id identifier rubyid_definition'>definition</span> <span class='op'>=</span> <span class='ivar'>@definition_manager</span><span class='period'>.</span><span class='id identifier rubyid_services'>services</span><span class='lbracket'>[</span><span class='id identifier rubyid_service_name'>service_name</span><span class='rbracket'>]</span>
972
+
973
+ <span class='id identifier rubyid_service'>service</span> <span class='op'>=</span> <span class='ivar'>@service_class_cache</span><span class='period'>.</span><span class='id identifier rubyid_service_instance'>service_instance</span><span class='lparen'>(</span><span class='id identifier rubyid_definition'>definition</span><span class='rparen'>)</span>
974
+ <span class='id identifier rubyid_service'>service</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='id identifier rubyid_file_rec'>file_rec</span><span class='comma'>,</span> <span class='id identifier rubyid_event'>event</span><span class='rparen'>)</span>
975
+ <span class='kw'>end</span></pre>
976
+ </td>
977
+ </tr>
978
+ </table>
979
+ </div>
980
+
981
+ <div class="method_details ">
982
+ <h3 class="signature " id="service-instance_method">
983
+
984
+ #<strong>service</strong>(service_name) &#x21d2; <tt>Object</tt>
985
+
986
+
987
+
988
+
989
+
990
+ </h3><div class="docstring">
991
+ <div class="discussion">
992
+
993
+ <p>Return a service instance instance for provided service name.</p>
994
+
995
+
996
+ </div>
997
+ </div>
998
+ <div class="tags">
999
+ <p class="tag_title">Parameters:</p>
1000
+ <ul class="param">
1001
+
1002
+ <li>
1003
+
1004
+ <span class='name'>service_name</span>
1005
+
1006
+
1007
+ <span class='type'>(<tt>String</tt>)</span>
1008
+
1009
+
1010
+
1011
+ &mdash;
1012
+ <div class='inline'>
1013
+ <p>name of the service</p>
1014
+ </div>
1015
+
1016
+ </li>
1017
+
1018
+ </ul>
1019
+
1020
+ <p class="tag_title">Returns:</p>
1021
+ <ul class="return">
1022
+
1023
+ <li>
1024
+
1025
+
1026
+ <span class='type'></span>
1027
+
1028
+
1029
+
1030
+
1031
+ <div class='inline'>
1032
+ <p>Preservation service class for the provided name</p>
1033
+ </div>
1034
+
1035
+ </li>
1036
+
1037
+ </ul>
1038
+ <p class="tag_title">Raises:</p>
1039
+ <ul class="raise">
1040
+
1041
+ <li>
1042
+
1043
+
1044
+ <span class='type'></span>
1045
+
1046
+
1047
+
1048
+
1049
+ <div class='inline'>
1050
+ <p>ArgumentError if service_name does not reference an existing service</p>
1051
+ </div>
1052
+
1053
+ </li>
1054
+
1055
+ </ul>
1056
+
1057
+ </div><table class="source_code">
1058
+ <tr>
1059
+ <td>
1060
+ <pre class="lines">
1061
+
1062
+
1063
+ 27
1064
+ 28
1065
+ 29
1066
+ 30
1067
+ 31
1068
+ 32</pre>
1069
+ </td>
1070
+ <td>
1071
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/service_manager.rb', line 27</span>
1072
+
1073
+ <span class='kw'>def</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>
1074
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Service name is required</span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_service_name'>service_name</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_service_name'>service_name</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
1075
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No service with name </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_service_name'>service_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='ivar'>@definition_manager</span><span class='period'>.</span><span class='id identifier rubyid_services'>services</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_service_name'>service_name</span><span class='rparen'>)</span>
1076
+ <span class='id identifier rubyid_definition'>definition</span> <span class='op'>=</span> <span class='ivar'>@definition_manager</span><span class='period'>.</span><span class='id identifier rubyid_services'>services</span><span class='lbracket'>[</span><span class='id identifier rubyid_service_name'>service_name</span><span class='rbracket'>]</span>
1077
+ <span class='ivar'>@service_class_cache</span><span class='period'>.</span><span class='id identifier rubyid_service_instance'>service_instance</span><span class='lparen'>(</span><span class='id identifier rubyid_definition'>definition</span><span class='rparen'>)</span>
1078
+ <span class='kw'>end</span></pre>
1079
+ </td>
1080
+ </tr>
1081
+ </table>
1082
+ </div>
1083
+
1084
+ <div class="method_details ">
1085
+ <h3 class="signature " id="service_needed?-instance_method">
1086
+
1087
+ #<strong>service_needed?</strong>(service_name, md_rec) &#x21d2; <tt>Boolean</tt>
1088
+
1089
+
1090
+
1091
+
1092
+
1093
+ </h3><div class="docstring">
1094
+ <div class="discussion">
1095
+
1096
+ <p>Determine if a service should run for a particular file based on the service&#39;s definition and the file&#39;s service related metadata.</p>
1097
+
1098
+
1099
+ </div>
1100
+ </div>
1101
+ <div class="tags">
1102
+ <p class="tag_title">Parameters:</p>
1103
+ <ul class="param">
1104
+
1105
+ <li>
1106
+
1107
+ <span class='name'>service_name</span>
1108
+
1109
+
1110
+ <span class='type'>(<tt>String</tt>)</span>
1111
+
1112
+
1113
+
1114
+ &mdash;
1115
+ <div class='inline'>
1116
+ <p>name of the service being evaluated</p>
1117
+ </div>
1118
+
1119
+ </li>
1120
+
1121
+ <li>
1122
+
1123
+ <span class='name'>md_rec</span>
1124
+
1125
+
1126
+ <span class='type'>(<tt><span class='object_link'><a href="MetadataRecord.html" title="Longleaf::MetadataRecord (class)">MetadataRecord</a></span></tt>)</span>
1127
+
1128
+
1129
+
1130
+ &mdash;
1131
+ <div class='inline'>
1132
+ <p>metadata record for the file being evaluated</p>
1133
+ </div>
1134
+
1135
+ </li>
1136
+
1137
+ </ul>
1138
+
1139
+ <p class="tag_title">Returns:</p>
1140
+ <ul class="return">
1141
+
1142
+ <li>
1143
+
1144
+
1145
+ <span class='type'>(<tt>Boolean</tt>)</span>
1146
+
1147
+
1148
+
1149
+ &mdash;
1150
+ <div class='inline'>
1151
+ <p>true if the service should be run.</p>
1152
+ </div>
1153
+
1154
+ </li>
1155
+
1156
+ </ul>
1157
+
1158
+ </div><table class="source_code">
1159
+ <tr>
1160
+ <td>
1161
+ <pre class="lines">
1162
+
1163
+
1164
+ 70
1165
+ 71
1166
+ 72
1167
+ 73
1168
+ 74
1169
+ 75
1170
+ 76
1171
+ 77
1172
+ 78
1173
+ 79
1174
+ 80
1175
+ 81
1176
+ 82
1177
+ 83
1178
+ 84
1179
+ 85
1180
+ 86
1181
+ 87
1182
+ 88
1183
+ 89
1184
+ 90
1185
+ 91</pre>
1186
+ </td>
1187
+ <td>
1188
+ <pre class="code"><span class="info file"># File 'lib/longleaf/services/service_manager.rb', line 70</span>
1189
+
1190
+ <span class='kw'>def</span> <span class='id identifier rubyid_service_needed?'>service_needed?</span><span class='lparen'>(</span><span class='id identifier rubyid_service_name'>service_name</span><span class='comma'>,</span> <span class='id identifier rubyid_md_rec'>md_rec</span><span class='rparen'>)</span>
1191
+ <span class='comment'># If service not recorded for file, then it is needed
1192
+ </span> <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>
1193
+ <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>unless</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
+
1195
+ <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>
1196
+
1197
+ <span class='kw'>return</span> <span class='kw'>true</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>
1198
+ <span class='kw'>return</span> <span class='kw'>true</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_timestamp'>timestamp</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
1199
+
1200
+ <span class='id identifier rubyid_definition'>definition</span> <span class='op'>=</span> <span class='ivar'>@definition_manager</span><span class='period'>.</span><span class='id identifier rubyid_services'>services</span><span class='lbracket'>[</span><span class='id identifier rubyid_service_name'>service_name</span><span class='rbracket'>]</span>
1201
+
1202
+ <span class='comment'># Check if the amount of time defined in frequency has passed since the service timestamp
1203
+ </span> <span class='id identifier rubyid_frequency'>frequency</span> <span class='op'>=</span> <span class='id identifier rubyid_definition'>definition</span><span class='period'>.</span><span class='id identifier rubyid_frequency'>frequency</span>
1204
+ <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>
1205
+ <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>
1206
+ <span class='id identifier rubyid_now'>now</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>
1207
+
1208
+ <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_now'>now</span> <span class='op'>&gt;</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>
1209
+ <span class='kw'>end</span>
1210
+ <span class='kw'>false</span>
1211
+ <span class='kw'>end</span></pre>
1212
+ </td>
1213
+ </tr>
1214
+ </table>
1215
+ </div>
1216
+
1217
+ </div>
1218
+
1219
+ </div>
1220
+
1221
+ <div id="footer">
1222
+ Generated on Tue May 28 15:48:01 2019 by
1223
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1224
+ 0.9.19 (ruby-2.6.3).
1225
+ </div>
1226
+
1227
+ </div>
1228
+ </body>
1229
+ </html>