samvera-nesting_indexer 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/documentation/README.md +13 -0
- data/documentation/reindex_relationship.mermaid +2 -1
- data/documentation/reindex_relationship.mermaid.png +0 -0
- data/lib/generators/samvera/nesting_indexer/install_generator.rb +1 -1
- data/lib/generators/samvera/nesting_indexer/templates/samvera-nesting_indexer_initializer.rb +1 -0
- data/lib/samvera/nesting_indexer.rb +6 -8
- data/lib/samvera/nesting_indexer/adapters/abstract_adapter.rb +2 -14
- data/lib/samvera/nesting_indexer/adapters/in_memory_adapter.rb +15 -34
- data/lib/samvera/nesting_indexer/adapters/interface_behavior_spec.rb +2 -17
- data/lib/samvera/nesting_indexer/configuration.rb +8 -0
- data/lib/samvera/nesting_indexer/documents.rb +6 -10
- data/lib/samvera/nesting_indexer/relationship_reindexer.rb +7 -5
- data/lib/samvera/nesting_indexer/repository_reindexer.rb +4 -3
- data/lib/samvera/nesting_indexer/version.rb +1 -1
- metadata +4 -4
- data/documentation/reindex_relationship.mermaid.jpg +0 -0
- data/lib/samvera/nesting_indexer/semver_assistant.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 476ac6dd12de858bd342468c294cf3eb182681fb
|
4
|
+
data.tar.gz: 248c720f7ab465acfe3c9b131e96dc34ab780938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 015ff0f42fb0b4e52d504f6382bcc8acac1db129db25f1f2f452cf5df7acec3edaca82fcfe8132714286ecaf316a46958c3d15dc07c7183881e429fad32f8d25
|
7
|
+
data.tar.gz: 683b23f760950613e746ac4fd3b2be59c2fb392acb2399245f5e8e6f9264d51704ae6599e5e613408d1d355a2321d8c429e6d40f1a4d8b318c7b7fefbfd596cf
|
data/README.md
CHANGED
@@ -109,10 +109,12 @@ end
|
|
109
109
|
|
110
110
|
The following sequence diagram documents the interactions in [Samvera::NestingIndexer::RelationshipReindexer](lib/samvera/nesting_indexer/relationship_reindexer.rb).
|
111
111
|
|
112
|
-

|
113
113
|
|
114
114
|
See [the text-based version of Reindex Relationship diagram](documentation/reindex_relationship.mermaid), leveraging the [Mermaid syntax](https://mermaidjs.github.io).
|
115
115
|
|
116
|
+
See [documentation/README.md](documentation/README.md) for details on updating the diagram.
|
117
|
+
|
116
118
|
## Considerations
|
117
119
|
|
118
120
|
Given a single object A, when we reindex A, we:
|
@@ -0,0 +1,13 @@
|
|
1
|
+
For generating a JPG from a mermaid file, you may use the [mermaid.cli tool](https://github.com/mermaidjs/mermaid.cli) or use the [atom-mermaid](https://atom.io/packages/atom-mermaid) plugin for the [Atom editor](https://atom.io).
|
2
|
+
|
3
|
+
## Using atom-mermaid
|
4
|
+
|
5
|
+
* From Atom, install the 'atom-mermaid' package and restart Atom.
|
6
|
+
* Then go to the corresponding `.mermaid` file
|
7
|
+
* Select the Atom menu item Packages > Mermaid Preview > Toggle Preview
|
8
|
+
* Right-Click on the opened preview and select "Save as PNG"
|
9
|
+
* Copy the saved PNG to the appropriate location (e.g. `./documentation/`)
|
10
|
+
|
11
|
+
## Using mermaid.cli
|
12
|
+
|
13
|
+
You'll need to give it a try.
|
@@ -15,8 +15,9 @@ sequenceDiagram
|
|
15
15
|
Indexer-->>Adapter: adapter.find_preservation_document_by(id:)
|
16
16
|
Adapter-->>Preservation: get preservation document
|
17
17
|
Preservation-->>Indexer: receive preservation document
|
18
|
+
Indexer-->>Indexer: build_nesting_document_for(preservation document)
|
18
19
|
Indexer-->>Indexer: guard_against_possiblity_of_self_ancestry
|
19
|
-
Indexer-->>Adapter: adapter.
|
20
|
+
Indexer-->>Adapter: adapter.write_nesting_document_to_index_layer
|
20
21
|
Adapter-->>Index: write updated application index document
|
21
22
|
Indexer-->>Indexer: enqueue children
|
22
23
|
end
|
Binary file
|
@@ -8,7 +8,7 @@ module Samvera
|
|
8
8
|
# Responsible for exposing the install generator (e.g. rails generator install amvera:nesting_indexer:install)
|
9
9
|
class InstallGenerator < Rails::Generators::Base
|
10
10
|
DEFAULT_MAXIMUM_NESTING_DEPTH = 5
|
11
|
-
source_root File.expand_path(
|
11
|
+
source_root File.expand_path('templates', __dir__)
|
12
12
|
desc "Creates a Samvera::NestingIndexer initializer."
|
13
13
|
class_option(
|
14
14
|
:adapter,
|
data/lib/generators/samvera/nesting_indexer/templates/samvera-nesting_indexer_initializer.rb
CHANGED
@@ -21,4 +21,5 @@ Samvera::NestingIndexer.configure do |config|
|
|
21
21
|
# config.solr_field_name_for_storing_parent_ids = Solrizer.solr_name('nesting_collection__parent_ids', :symbol)
|
22
22
|
# config.solr_field_name_for_storing_ancestors = Solrizer.solr_name('nesting_collection__ancestors', :symbol)
|
23
23
|
# config.solr_field_name_for_storing_pathnames = Solrizer.solr_name('nesting_collection__pathnames', :symbol)
|
24
|
+
# config.solr_field_name_for_deepest_nested_depth = Solrizer.solr_name('nesting_collection__deepest_nested_depth', :integer)
|
24
25
|
end
|
@@ -18,12 +18,13 @@ module Samvera
|
|
18
18
|
# @param id [String] - The permanent identifier of the object that will be reindexed along with its children.
|
19
19
|
# @param maximum_nesting_depth [Integer] - used to short-circuit overly deep nesting as well as prevent accidental cyclic graphs
|
20
20
|
# from creating an infinite loop.
|
21
|
+
# @param extent [String] - may be leveraged in adapter to limit the extent of the reindexing of children
|
21
22
|
# @return [Boolean] - It was successful
|
22
23
|
# @raise Samvera::Exceptions::CycleDetectionError - A possible cycle was detected
|
23
24
|
# @raise Samvera::Exceptions::ExceededMaximumNestingDepthError - We exceeded our maximum depth
|
24
25
|
# @raise Samvera::Exceptions::DocumentIsItsOwnAncestorError - A document we were about to index appeared to be its own ancestor
|
25
|
-
def self.reindex_relationships(id:, maximum_nesting_depth: configuration.maximum_nesting_depth)
|
26
|
-
RelationshipReindexer.call(id: id, maximum_nesting_depth: maximum_nesting_depth, configuration: configuration)
|
26
|
+
def self.reindex_relationships(id:, maximum_nesting_depth: configuration.maximum_nesting_depth, extent:)
|
27
|
+
RelationshipReindexer.call(id: id, maximum_nesting_depth: maximum_nesting_depth, configuration: configuration, extent: extent)
|
27
28
|
true
|
28
29
|
end
|
29
30
|
|
@@ -36,13 +37,14 @@ module Samvera
|
|
36
37
|
# @api public
|
37
38
|
# Responsible for reindexing the entire preservation layer.
|
38
39
|
# @param maximum_nesting_depth [Integer] - there to guard against cyclic graphs
|
40
|
+
# @param extent [String] - for reindex_all, should result in full reindexing... leveraged in adapter to limit the extent of the reindexing of children
|
39
41
|
# @return [Boolean] - It was successful
|
40
42
|
# @raise Samvera::Exceptions::ReindexingError - There was a problem reindexing the graph.
|
41
|
-
def self.reindex_all!(maximum_nesting_depth: configuration.maximum_nesting_depth)
|
43
|
+
def self.reindex_all!(maximum_nesting_depth: configuration.maximum_nesting_depth, extent:)
|
42
44
|
# While the RepositoryReindexer is responsible for reindexing everything, I
|
43
45
|
# want to inject the lambda that will reindex a single item.
|
44
46
|
id_reindexer = method(:reindex_relationships)
|
45
|
-
RepositoryReindexer.call(maximum_nesting_depth: maximum_nesting_depth, id_reindexer: id_reindexer, configuration: configuration)
|
47
|
+
RepositoryReindexer.call(maximum_nesting_depth: maximum_nesting_depth, id_reindexer: id_reindexer, configuration: configuration, extent: extent)
|
46
48
|
true
|
47
49
|
end
|
48
50
|
|
@@ -89,9 +91,5 @@ module Samvera
|
|
89
91
|
@configuration_block.call(configuration)
|
90
92
|
@configuration_block = nil
|
91
93
|
end
|
92
|
-
|
93
|
-
def self.semantic_version_messages
|
94
|
-
SemverAssistant.messages
|
95
|
-
end
|
96
94
|
end
|
97
95
|
end
|
@@ -37,21 +37,9 @@ module Samvera
|
|
37
37
|
|
38
38
|
# @api public
|
39
39
|
# @param document [Samvera::NestingIndexer::Documents::IndexDocument]
|
40
|
+
# @param extent [String] passed into adapter from reindex_relationships call
|
40
41
|
# @yield [Samvera::NestingIndexer::Documents::IndexDocument]
|
41
|
-
def self.each_child_document_of(document:, &block)
|
42
|
-
raise NotImplementedError
|
43
|
-
end
|
44
|
-
|
45
|
-
# @api public
|
46
|
-
# @deprecated Use .write_nesting_document_to_index_layer instead
|
47
|
-
# @see README.md
|
48
|
-
# @param id [String]
|
49
|
-
# @param parent_ids [Array<String>]
|
50
|
-
# @param ancestors [Array<String>]
|
51
|
-
# @param pathnames [Array<String>]
|
52
|
-
# @param deepest_nested_depth [Integer]
|
53
|
-
# @return Hash - the attributes written to the indexing layer
|
54
|
-
def self.write_document_attributes_to_index_layer(id:, parent_ids:, ancestors:, pathnames:, deepest_nested_depth:)
|
42
|
+
def self.each_child_document_of(document:, extent:, &block)
|
55
43
|
raise NotImplementedError
|
56
44
|
end
|
57
45
|
|
@@ -4,34 +4,30 @@ require 'samvera/nesting_indexer/documents'
|
|
4
4
|
module Samvera
|
5
5
|
module NestingIndexer
|
6
6
|
module Adapters
|
7
|
-
# @api
|
7
|
+
# @api private
|
8
8
|
#
|
9
9
|
# Defines the interface for interacting with the InMemory layer. It is a reference
|
10
10
|
# implementation that is used throughout tests.
|
11
11
|
module InMemoryAdapter
|
12
|
-
SemverAssistant.removing_from_public_api(context: self, as_of: '2.0.0')
|
13
12
|
extend AbstractAdapter
|
14
|
-
# @api
|
13
|
+
# @api private
|
15
14
|
# @param id [String]
|
16
15
|
# @return Samvera::NestingIndexer::Document::PreservationDocument
|
17
16
|
def self.find_preservation_document_by(id:)
|
18
|
-
SemverAssistant.removing_from_public_api(context: "#{self.class}##{__method__}", as_of: '2.0.0')
|
19
17
|
Preservation.find(id)
|
20
18
|
end
|
21
19
|
|
22
|
-
# @api
|
20
|
+
# @api private
|
23
21
|
# @param id [String]
|
24
22
|
# @return [Samvera::NestingIndexer::Documents::IndexDocument]
|
25
23
|
def self.find_index_document_by(id:)
|
26
|
-
SemverAssistant.removing_from_public_api(context: "#{self.class}##{__method__}", as_of: '2.0.0')
|
27
24
|
Index.find(id)
|
28
25
|
end
|
29
26
|
|
30
|
-
# @api
|
27
|
+
# @api private
|
31
28
|
# @yieldparam id [String] The `id` of the preservation document
|
32
29
|
# @yieldparam parent_ids [String] The ids of the parent objects of this presevation document
|
33
30
|
def self.each_perservation_document_id_and_parent_ids(&block)
|
34
|
-
SemverAssistant.removing_from_public_api(context: "#{self.class}##{__method__}", as_of: '2.0.0')
|
35
31
|
Preservation.find_each do |document|
|
36
32
|
block.call(document.id, document.parent_ids)
|
37
33
|
end
|
@@ -41,42 +37,29 @@ module Samvera
|
|
41
37
|
Preservation.find(id).parent_ids
|
42
38
|
end
|
43
39
|
|
44
|
-
# @api
|
40
|
+
# @api private
|
45
41
|
# @param document [Samvera::NestingIndexer::Documents::IndexDocument]
|
42
|
+
# @param extent [String] passed into adapter from reindex_relationships call
|
46
43
|
# @yield [Samvera::NestingIndexer::Documents::IndexDocument]
|
47
|
-
|
48
|
-
|
49
|
-
Index.each_child_document_of(document: document, &block)
|
44
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
45
|
+
def self.each_child_document_of(document:, extent:, &block)
|
46
|
+
Index.each_child_document_of(document: document, extent: "full", &block)
|
50
47
|
end
|
48
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
51
49
|
|
52
|
-
# @api
|
50
|
+
# @api private
|
53
51
|
# This is not something that I envision using in the production environment;
|
54
52
|
# It is hear to keep the Preservation system isolated and accessible only through interfaces.
|
55
53
|
# @param attributes [Hash]
|
56
54
|
# @return [Samvera::NestingIndexer::Documents::PreservationDocument]
|
57
55
|
def self.write_document_attributes_to_preservation_layer(attributes)
|
58
|
-
SemverAssistant.removing_from_public_api(context: "#{self.class}##{__method__}", as_of: '2.0.0')
|
59
56
|
Preservation.write_document(attributes)
|
60
57
|
end
|
61
58
|
|
62
|
-
# @api
|
63
|
-
# @see README.md
|
64
|
-
# @param id [String]
|
65
|
-
# @param parent_ids [Array<String>]
|
66
|
-
# @param ancestors [Array<String>]
|
67
|
-
# @param pathnames [Array<String>]
|
68
|
-
# @param deepest_nested_depth [Integer]
|
69
|
-
# @return [Hash] - the attributes written to the indexing layer
|
70
|
-
def self.write_document_attributes_to_index_layer(id:, parent_ids:, ancestors:, pathnames:, deepest_nested_depth:)
|
71
|
-
SemverAssistant.removing_from_public_api(context: "#{self.class}##{__method__}", as_of: '2.0.0')
|
72
|
-
Index.write_document(id: id, parent_ids: parent_ids, ancestors: ancestors, pathnames: pathnames, deepest_nested_depth: deepest_nested_depth)
|
73
|
-
end
|
74
|
-
|
75
|
-
# @api public
|
59
|
+
# @api private
|
76
60
|
# @see README.md
|
77
61
|
# @param nesting_document [Samvera::NestingIndexer::Documents::IndexDocument]
|
78
62
|
def self.write_nesting_document_to_index_layer(nesting_document:)
|
79
|
-
SemverAssistant.removing_from_public_api(context: "#{self.class}##{__method__}", as_of: '2.0.0')
|
80
63
|
Index.write_to_storage(nesting_document)
|
81
64
|
end
|
82
65
|
|
@@ -172,18 +155,16 @@ module Samvera
|
|
172
155
|
Storage.find_each(&block)
|
173
156
|
end
|
174
157
|
|
175
|
-
|
158
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
159
|
+
def self.each_child_document_of(document:, extent: nil, &block)
|
176
160
|
Storage.find_children_of_id(document.id).each(&block)
|
177
161
|
end
|
162
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
178
163
|
|
179
164
|
def self.write_to_storage(doc)
|
180
165
|
Storage.write(doc)
|
181
166
|
end
|
182
167
|
|
183
|
-
def self.write_document(attributes = {})
|
184
|
-
Documents::IndexDocument.new(attributes).tap { |doc| write_to_storage(doc) }
|
185
|
-
end
|
186
|
-
|
187
168
|
# :nodoc:
|
188
169
|
module Storage
|
189
170
|
extend StorageModule
|
@@ -68,10 +68,10 @@ if defined?(RSpec)
|
|
68
68
|
subject { described_class.method(:each_child_document_of) }
|
69
69
|
|
70
70
|
it 'requires the :document keyword (and does not require any others)' do
|
71
|
-
expect(required_keyword_parameters.call(subject)).to eq(
|
71
|
+
expect(required_keyword_parameters.call(subject)).to eq(%i(document extent))
|
72
72
|
end
|
73
73
|
|
74
|
-
it 'does not require any other parameters (besides :document)' do
|
74
|
+
it 'does not require any other parameters (besides :document, :extent)' do
|
75
75
|
expect(required_parameters.call(subject)).to eq(required_keyword_parameters.call(subject))
|
76
76
|
end
|
77
77
|
|
@@ -79,21 +79,6 @@ if defined?(RSpec)
|
|
79
79
|
expect(block_parameter_extracter.call(subject)).to eq([:block])
|
80
80
|
end
|
81
81
|
end
|
82
|
-
describe '.write_document_attributes_to_index_layer' do
|
83
|
-
subject { described_class.method(:write_document_attributes_to_index_layer) }
|
84
|
-
|
85
|
-
it 'requires the :ancestors, :deepest_nested_depth, :id, :parent_ids, and :pathnames keyword (and does not require any others)' do
|
86
|
-
expect(required_keyword_parameters.call(subject)).to eq(%i(ancestors deepest_nested_depth id parent_ids pathnames))
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'does not require any other parameters (besides :attributes)' do
|
90
|
-
expect(required_parameters.call(subject)).to eq(required_keyword_parameters.call(subject))
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'does not expect a block' do
|
94
|
-
expect(block_parameter_extracter.call(subject)).to be_empty
|
95
|
-
end
|
96
|
-
end
|
97
82
|
|
98
83
|
describe '.write_nesting_document_to_index_layer' do
|
99
84
|
subject { described_class.method(:write_nesting_document_to_index_layer) }
|
@@ -46,6 +46,14 @@ module Samvera
|
|
46
46
|
@solr_field_name_for_storing_pathnames || raise(Exceptions::SolrKeyConfigurationError.new(name: __method__, config: self))
|
47
47
|
end
|
48
48
|
|
49
|
+
def solr_field_name_for_deepest_nested_depth=(input)
|
50
|
+
@solr_field_name_for_deepest_nested_depth = input.to_s
|
51
|
+
end
|
52
|
+
|
53
|
+
def solr_field_name_for_deepest_nested_depth
|
54
|
+
@solr_field_name_for_deepest_nested_depth || raise(Exceptions::SolrKeyConfigurationError.new(name: __method__, config: self))
|
55
|
+
end
|
56
|
+
|
49
57
|
# @api public
|
50
58
|
# @return Samvera::NestingIndexer::Adapters::AbstractAdapter
|
51
59
|
def adapter
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'dry-equalizer'
|
2
|
-
require 'samvera/nesting_indexer/semver_assistant'
|
3
2
|
|
4
3
|
module Samvera
|
5
4
|
module NestingIndexer
|
@@ -7,7 +6,7 @@ module Samvera
|
|
7
6
|
module Documents
|
8
7
|
ANCESTOR_AND_PATHNAME_DELIMITER = '/'.freeze
|
9
8
|
|
10
|
-
# @api
|
9
|
+
# @api private
|
11
10
|
#
|
12
11
|
# A simplified document that reflects the necessary attributes for re-indexing
|
13
12
|
# the children of Fedora objects.
|
@@ -16,21 +15,18 @@ module Samvera
|
|
16
15
|
@id = keywords.fetch(:id).to_s
|
17
16
|
@parent_ids = Array(keywords.fetch(:parent_ids))
|
18
17
|
end
|
19
|
-
SemverAssistant.removing_from_public_api(context: self, as_of: '2.0.0')
|
20
18
|
|
21
|
-
# @api
|
19
|
+
# @api private
|
22
20
|
# @return String The Fedora object's PID
|
23
21
|
attr_reader :id
|
24
|
-
SemverAssistant.removing_from_public_api(context: "#{self}#id", as_of: '2.0.0')
|
25
22
|
|
26
|
-
# @api
|
23
|
+
# @api private
|
27
24
|
#
|
28
25
|
# All of the direct parents of the Fedora document associated with the given PID.
|
29
26
|
#
|
30
27
|
# This does not include grandparents, great-grandparents, etc.
|
31
28
|
# @return Array<String>
|
32
29
|
attr_reader :parent_ids
|
33
|
-
SemverAssistant.removing_from_public_api(context: "#{self}#parent_id", as_of: '2.0.0')
|
34
30
|
end
|
35
31
|
|
36
32
|
# @api public
|
@@ -106,18 +102,18 @@ module Samvera
|
|
106
102
|
end.max
|
107
103
|
end
|
108
104
|
|
105
|
+
# @api private
|
109
106
|
def sorted_parent_ids
|
110
|
-
SemverAssistant.removing_from_public_api(context: "#{self.class}##{__method__}", as_of: '2.0.0')
|
111
107
|
parent_ids.sort
|
112
108
|
end
|
113
109
|
|
110
|
+
# @api private
|
114
111
|
def sorted_pathnames
|
115
|
-
SemverAssistant.removing_from_public_api(context: "#{self.class}##{__method__}", as_of: '2.0.0')
|
116
112
|
pathnames.sort
|
117
113
|
end
|
118
114
|
|
115
|
+
# @api private
|
119
116
|
def sorted_ancestors
|
120
|
-
SemverAssistant.removing_from_public_api(context: "#{self.class}##{__method__}", as_of: '2.0.0')
|
121
117
|
ancestors.sort
|
122
118
|
end
|
123
119
|
end
|
@@ -22,11 +22,13 @@ module Samvera
|
|
22
22
|
# @param maximum_nesting_depth [Integer] What is the maximum allowed depth of nesting
|
23
23
|
# @param configuration [#adapter, #logger] The :adapter conforms to the Samvera::NestingIndexer::Adapters::AbstractAdapter interface
|
24
24
|
# and the :logger conforms to Logger
|
25
|
+
# @param extent [String] - may be leveraged in adapter to limit the extent of the reindexing of children
|
25
26
|
# @param queue [#shift, #push] queue
|
26
|
-
def initialize(id:, maximum_nesting_depth:, configuration:, queue: [])
|
27
|
+
def initialize(id:, maximum_nesting_depth:, configuration:, extent:, queue: [])
|
27
28
|
@id = id.to_s
|
28
29
|
@maximum_nesting_depth = maximum_nesting_depth.to_i
|
29
30
|
@configuration = configuration
|
31
|
+
@extent = extent
|
30
32
|
@queue = queue
|
31
33
|
end
|
32
34
|
attr_reader :id, :maximum_nesting_depth
|
@@ -43,13 +45,13 @@ module Samvera
|
|
43
45
|
|
44
46
|
private
|
45
47
|
|
46
|
-
attr_reader :queue, :configuration
|
48
|
+
attr_reader :queue, :configuration, :extent
|
47
49
|
|
48
50
|
def process_each_document
|
49
51
|
processing_document = dequeue
|
50
52
|
while processing_document
|
51
53
|
process_a_document(processing_document)
|
52
|
-
adapter.each_child_document_of(document: processing_document) do |child|
|
54
|
+
adapter.each_child_document_of(document: processing_document, extent: extent) do |child|
|
53
55
|
enqueue(child, processing_document.maximum_nesting_depth - 1)
|
54
56
|
end
|
55
57
|
processing_document = dequeue
|
@@ -57,7 +59,7 @@ module Samvera
|
|
57
59
|
end
|
58
60
|
|
59
61
|
def initial_index_document
|
60
|
-
adapter.find_index_document_by(id: id)
|
62
|
+
@initial_index_document ||= adapter.find_index_document_by(id: id)
|
61
63
|
end
|
62
64
|
|
63
65
|
extend Forwardable
|
@@ -127,7 +129,7 @@ module Samvera
|
|
127
129
|
|
128
130
|
private
|
129
131
|
|
130
|
-
attr_reader :adapter
|
132
|
+
attr_reader :adapter, :extent
|
131
133
|
|
132
134
|
def compile!
|
133
135
|
@preservation_document.parent_ids.each do |parent_id|
|
@@ -22,10 +22,11 @@ module Samvera
|
|
22
22
|
# @param maximum_nesting_depth [Integer] detect cycles in the graph
|
23
23
|
# @param configuration [#adapter, #logger] The :adapter conforms to the Samvera::NestingIndexer::Adapters::AbstractAdapter interface
|
24
24
|
# and the :logger conforms to Logger
|
25
|
-
def initialize(maximum_nesting_depth:, id_reindexer:, configuration:)
|
25
|
+
def initialize(maximum_nesting_depth:, id_reindexer:, configuration:, extent:)
|
26
26
|
@maximum_nesting_depth = maximum_nesting_depth.to_i
|
27
27
|
@id_reindexer = id_reindexer
|
28
28
|
@configuration = configuration
|
29
|
+
@extent = extent
|
29
30
|
@processed_ids = []
|
30
31
|
end
|
31
32
|
|
@@ -38,7 +39,7 @@ module Samvera
|
|
38
39
|
|
39
40
|
private
|
40
41
|
|
41
|
-
attr_reader :maximum_nesting_depth, :processed_ids, :id_reindexer, :configuration
|
42
|
+
attr_reader :maximum_nesting_depth, :processed_ids, :id_reindexer, :configuration, :extent
|
42
43
|
|
43
44
|
extend Forwardable
|
44
45
|
def_delegator :configuration, :adapter
|
@@ -62,7 +63,7 @@ module Samvera
|
|
62
63
|
end
|
63
64
|
|
64
65
|
def reindex_an_id(id)
|
65
|
-
id_reindexer.call(id: id)
|
66
|
+
id_reindexer.call(id: id, extent: extent)
|
66
67
|
processed_ids << id
|
67
68
|
rescue StandardError => e
|
68
69
|
logger.error(e)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: samvera-nesting_indexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -259,8 +259,9 @@ files:
|
|
259
259
|
- Rakefile
|
260
260
|
- bin/console
|
261
261
|
- bin/setup
|
262
|
+
- documentation/README.md
|
262
263
|
- documentation/reindex_relationship.mermaid
|
263
|
-
- documentation/reindex_relationship.mermaid.
|
264
|
+
- documentation/reindex_relationship.mermaid.png
|
264
265
|
- lib/generators/samvera/nesting_indexer/install_generator.rb
|
265
266
|
- lib/generators/samvera/nesting_indexer/templates/README
|
266
267
|
- lib/generators/samvera/nesting_indexer/templates/samvera-nesting_indexer_initializer.rb
|
@@ -275,7 +276,6 @@ files:
|
|
275
276
|
- lib/samvera/nesting_indexer/railtie.rb
|
276
277
|
- lib/samvera/nesting_indexer/relationship_reindexer.rb
|
277
278
|
- lib/samvera/nesting_indexer/repository_reindexer.rb
|
278
|
-
- lib/samvera/nesting_indexer/semver_assistant.rb
|
279
279
|
- lib/samvera/nesting_indexer/version.rb
|
280
280
|
- samvera-nesting_indexer.gemspec
|
281
281
|
homepage: https://github.com/samvera-labs/samvera-nesting_indexer
|
Binary file
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
module Samvera
|
3
|
-
module NestingIndexer
|
4
|
-
# @api private
|
5
|
-
# A service object responsible for coordinating declarations of interface changes
|
6
|
-
module SemverAssistant
|
7
|
-
def self.messages
|
8
|
-
@messages ||= Set.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.removing_from_public_api(context:, as_of:)
|
12
|
-
message = "As of version #{as_of}, #{context} will be removed from the public API"
|
13
|
-
messages << message
|
14
|
-
ActiveSupport::Deprecation.warn(message, caller[1..-1]) if defined?(ActiveSupport::Deprecation) && !ENV.key?('SKIP_ACTIVE_SUPPORT_DEPRECATION')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
Samvera::NestingIndexer.private_constant :SemverAssistant
|