curate-indexer 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1be92053b6ce30d9e75ac935c7000861725a4c5
4
- data.tar.gz: babb5d4f0228d9210d096688d920d5c457f0f266
3
+ metadata.gz: 18c501d0580dc9320571ba6c849d2cc68ee89757
4
+ data.tar.gz: b514b51c8c01130e99f7f0ea2893a941f4f59351
5
5
  SHA512:
6
- metadata.gz: eb5f7aaecda93774887fe655bd9c9884901c65360f32575f74df1f1e15404ef5b0a3933e5992ef5a4a35b794364fddf5c0cbc63f5212214efe1d288a5f7099e3
7
- data.tar.gz: 1aaf669fc93f8f435b6d116417da0433428cb72a0ff5871c362e8815d6348cbdb012dc2d8c7bee7b9a4ba9c17cdf315d435cc08c05a45d91223db0741aa66b7d
6
+ metadata.gz: 854ea3ff16844b348da2e8292af7a0d46f3488f0962d7f7e9acece6437c08243b324b05711f196192393cebb393822232e7cd3f87f94ebb3ccf76dfc162272de
7
+ data.tar.gz: 47a2e72f2ce17741a8db05a724228a0017246cb7c63b5278a784a28f6e9b9a2b462035d96793074adfd0fc84fc4148a12ed9914190b0fbbdc885743c5027e984
@@ -0,0 +1,42 @@
1
+ module Curate
2
+ module Indexer
3
+ module Adapters
4
+ # @api public
5
+ # A module that defines the interface of methods required to interact with Curate::Indexer operations
6
+ module AbstractAdapter
7
+ # @api public
8
+ # @param pid [String]
9
+ # @return Curate::Indexer::Document::PreservationDocument
10
+ def self.find_preservation_document_by(*)
11
+ raise NotImplementedError
12
+ end
13
+
14
+ # @api public
15
+ # @param pid [String]
16
+ # @return Curate::Indexer::Documents::IndexDocument
17
+ def self.find_index_document_by(*)
18
+ raise NotImplementedError
19
+ end
20
+
21
+ # @api public
22
+ # @yield Curate::Indexer::Document::PreservationDocument
23
+ def self.each_preservation_document
24
+ raise NotImplementedError
25
+ end
26
+
27
+ # @api public
28
+ # @param pid [String]
29
+ # @yield Curate::Indexer::Documents::IndexDocument
30
+ def self.each_child_document_of(*, &_block)
31
+ raise NotImplementedError
32
+ end
33
+
34
+ # @api public
35
+ # @return Curate::Indexer::Documents::IndexDocument
36
+ def self.write_document_attributes_to_index_layer(*)
37
+ raise NotImplementedError
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,60 @@
1
+ require 'curate/indexer/adapters/abstract_adapter'
2
+ module Curate
3
+ module Indexer
4
+ module Adapters
5
+ # @api public
6
+ #
7
+ # Defines the interface for interacting with the InMemory layer. It is a reference
8
+ # implementation that is used throughout tests.
9
+ module InMemoryAdapter
10
+ extend AbstractAdapter
11
+ # @api public
12
+ # @param pid [String]
13
+ # @return Curate::Indexer::Document::PreservationDocument
14
+ def self.find_preservation_document_by(pid)
15
+ Preservation.find(pid)
16
+ end
17
+
18
+ # @api public
19
+ # @param pid [String]
20
+ # @return Curate::Indexer::Documents::IndexDocument
21
+ def self.find_index_document_by(pid)
22
+ Index.find(pid)
23
+ end
24
+
25
+ # @api public
26
+ # @yield Curate::Indexer::Document::PreservationDocument
27
+ def self.each_preservation_document
28
+ Preservation.find_each { |document| yield(document) }
29
+ end
30
+
31
+ # @api public
32
+ # @param pid [String]
33
+ # @yield Curate::Indexer::Documents::IndexDocument
34
+ def self.each_child_document_of(pid, &block)
35
+ Index.each_child_document_of(pid, &block)
36
+ end
37
+
38
+ # @api public
39
+ # This is not something that I envision using in the production environment;
40
+ # It is hear to keep the Preservation system isolated and accessible only through interfaces.
41
+ # @return Curate::Indexer::Documents::PreservationDocument
42
+ def self.write_document_attributes_to_preservation_layer(attributes = {})
43
+ Preservation.write_document(attributes)
44
+ end
45
+
46
+ # @api public
47
+ # @return Curate::Indexer::Documents::IndexDocument
48
+ def self.write_document_attributes_to_index_layer(attributes = {})
49
+ Index.write_document(attributes)
50
+ end
51
+
52
+ # @api private
53
+ def self.clear_cache!
54
+ Preservation.clear_cache!
55
+ Index.clear_cache!
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,95 +1,12 @@
1
+ require 'curate/indexer/adapters/abstract_adapter'
2
+ require 'curate/indexer/adapters/in_memory_adapter'
3
+
1
4
  module Curate
2
5
  module Indexer
6
+ # A container for the various adapter implementations.
7
+ # @see Curate::Indexer::Adapters::AbstractAdapter
8
+ # @see Curate::Indexer::Adapters::InMemoryAdapter
3
9
  module Adapters
4
- # @api public
5
- # A module that defines the interface of methods required to interact with Curate::Indexer operations
6
- module AbstractAdapter
7
- # @api public
8
- # @param pid [String]
9
- # @return Curate::Indexer::Document::PreservationDocument
10
- def self.find_preservation_document_by(*)
11
- raise NotImplementedError
12
- end
13
-
14
- # @api public
15
- # @param pid [String]
16
- # @return Curate::Indexer::Documents::IndexDocument
17
- def self.find_index_document_by(*)
18
- raise NotImplementedError
19
- end
20
-
21
- # @api public
22
- # @yield Curate::Indexer::Document::PreservationDocument
23
- def self.each_preservation_document
24
- raise NotImplementedError
25
- end
26
-
27
- # @api public
28
- # @param pid [String]
29
- # @yield Curate::Indexer::Documents::IndexDocument
30
- def self.each_child_document_of(*, &_block)
31
- raise NotImplementedError
32
- end
33
-
34
- # @api public
35
- # @return Curate::Indexer::Documents::IndexDocument
36
- def self.write_document_attributes_to_index_layer(*)
37
- raise NotImplementedError
38
- end
39
- end
40
- # @api public
41
- #
42
- # Defines the interface for interacting with the InMemory layer. It is a reference
43
- # implementation that is used throughout tests.
44
- module InMemoryAdapter
45
- extend AbstractAdapter
46
- # @api public
47
- # @param pid [String]
48
- # @return Curate::Indexer::Document::PreservationDocument
49
- def self.find_preservation_document_by(pid)
50
- Preservation.find(pid)
51
- end
52
-
53
- # @api public
54
- # @param pid [String]
55
- # @return Curate::Indexer::Documents::IndexDocument
56
- def self.find_index_document_by(pid)
57
- Index.find(pid)
58
- end
59
-
60
- # @api public
61
- # @yield Curate::Indexer::Document::PreservationDocument
62
- def self.each_preservation_document
63
- Preservation.find_each { |document| yield(document) }
64
- end
65
-
66
- # @api public
67
- # @param pid [String]
68
- # @yield Curate::Indexer::Documents::IndexDocument
69
- def self.each_child_document_of(pid, &block)
70
- Index.each_child_document_of(pid, &block)
71
- end
72
-
73
- # @api public
74
- # This is not something that I envision using in the production environment;
75
- # It is hear to keep the Preservation system isolated and accessible only through interfaces.
76
- # @return Curate::Indexer::Documents::PreservationDocument
77
- def self.write_document_attributes_to_preservation_layer(attributes = {})
78
- Preservation.write_document(attributes)
79
- end
80
-
81
- # @api public
82
- # @return Curate::Indexer::Documents::IndexDocument
83
- def self.write_document_attributes_to_index_layer(attributes = {})
84
- Index.write_document(attributes)
85
- end
86
-
87
- # @api private
88
- def self.clear_cache!
89
- Preservation.clear_cache!
90
- Index.clear_cache!
91
- end
92
- end
93
10
  end
94
11
  end
95
12
  end
@@ -12,7 +12,7 @@ module Curate
12
12
  private
13
13
 
14
14
  def default_adapter
15
- require 'curate/indexer/adapters'
15
+ require 'curate/indexer/adapters/in_memory_adapter'
16
16
  Adapters::InMemoryAdapter
17
17
  end
18
18
  end
@@ -1,5 +1,5 @@
1
1
  module Curate
2
2
  module Indexer
3
- VERSION = "0.1.0".freeze
3
+ VERSION = "0.1.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curate-indexer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-16 00:00:00.000000000 Z
11
+ date: 2016-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -256,6 +256,8 @@ files:
256
256
  - curate-indexer.gemspec
257
257
  - lib/curate/indexer.rb
258
258
  - lib/curate/indexer/adapters.rb
259
+ - lib/curate/indexer/adapters/abstract_adapter.rb
260
+ - lib/curate/indexer/adapters/in_memory_adapter.rb
259
261
  - lib/curate/indexer/configuration.rb
260
262
  - lib/curate/indexer/documents.rb
261
263
  - lib/curate/indexer/exceptions.rb