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

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

Overview

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

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.



88
89
90
91
# File 'lib/curate/indexer/adapters.rb', line 88

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

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

Parameters:

  • pid (String)

Yields:

  • Curate::Indexer::Documents::IndexDocument



69
70
71
# File 'lib/curate/indexer/adapters.rb', line 69

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

.each_preservation_document { ... } ⇒ Object

Yields:

  • Curate::Indexer::Document::PreservationDocument



62
63
64
# File 'lib/curate/indexer/adapters.rb', line 62

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

.find_index_document_by(pid) ⇒ Object

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

Parameters:

  • pid (String)

Returns:

  • Curate::Indexer::Documents::IndexDocument



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

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

.find_preservation_document_by(pid) ⇒ Object

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

Parameters:

  • pid (String)

Returns:

  • Curate::Indexer::Document::PreservationDocument



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

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

.write_document_attributes_to_index_layer(attributes = {}) ⇒ Object

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

Returns:

  • Curate::Indexer::Documents::IndexDocument



83
84
85
# File 'lib/curate/indexer/adapters.rb', line 83

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.

Returns:

  • Curate::Indexer::Documents::PreservationDocument



77
78
79
# File 'lib/curate/indexer/adapters.rb', line 77

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