Module: Curate::Indexer::Adapters::InMemoryAdapter

Extended by:
AbstractAdapter
Defined in:
lib/curate/indexer/adapters/in_memory_adapter.rb

Overview

Defines the interface for interacting with the InMemory layer. It is a reference implementation that is used throughout tests.

Defined Under Namespace

Modules: StorageModule

Class Method Summary collapse

Class Method Details

.clear_cache!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



55
56
57
58
# File 'lib/curate/indexer/adapters/in_memory_adapter.rb', line 55

def self.clear_cache!
  Preservation.clear_cache!
  Index.clear_cache!
end

.each_child_document_of(document) { ... } ⇒ Object

Yields:

  • Curate::Indexer::Documents::IndexDocument



36
37
38
# File 'lib/curate/indexer/adapters/in_memory_adapter.rb', line 36

def self.each_child_document_of(document, &block)
  Index.each_child_document_of(document, &block)
end

.each_preservation_document { ... } ⇒ Object

Yields:

  • Curate::Indexer::Document::PreservationDocument



29
30
31
# File 'lib/curate/indexer/adapters/in_memory_adapter.rb', line 29

def self.each_preservation_document
  Preservation.find_each { |document| yield(document) }
end

.find_index_document_by(pid) ⇒ Object

Returns Curate::Indexer::Documents::IndexDocument.



23
24
25
# File 'lib/curate/indexer/adapters/in_memory_adapter.rb', line 23

def self.find_index_document_by(pid)
  Index.find(pid)
end

.find_preservation_document_by(pid) ⇒ Object

Returns Curate::Indexer::Document::PreservationDocument.



16
17
18
# File 'lib/curate/indexer/adapters/in_memory_adapter.rb', line 16

def self.find_preservation_document_by(pid)
  Preservation.find(pid)
end

.write_document_attributes_to_index_layer(attributes = {}) ⇒ Object

Returns Hash - the attributes written to the indexing layer.



50
51
52
# File 'lib/curate/indexer/adapters/in_memory_adapter.rb', line 50

def self.write_document_attributes_to_index_layer(attributes = {})
  Index.write_document(attributes)
end

.write_document_attributes_to_preservation_layer(attributes = {}) ⇒ Object

This is not something that I envision using in the production environment; It is hear to keep the Preservation system isolated and accessible only through interfaces.



44
45
46
# File 'lib/curate/indexer/adapters/in_memory_adapter.rb', line 44

def self.write_document_attributes_to_preservation_layer(attributes = {})
  Preservation.write_document(attributes)
end