Class: Longleaf::IndexManager
- Inherits:
-
Object
- Object
- Longleaf::IndexManager
- Defined in:
- lib/longleaf/indexing/index_manager.rb
Overview
Manager configures and provides access to a metadata index if one is specified
Instance Method Summary collapse
- #clear_index(older_than = nil) ⇒ Object
- #each_registered_path(file_selector, older_than: nil, &block) ⇒ Object
-
#index(file_rec) ⇒ Object
Index the provided file_rec and its metadata.
-
#index_stale? ⇒ Boolean
True if the index should be reindexed.
-
#initialize(config, app_config_manager) ⇒ IndexManager
constructor
A new instance of IndexManager.
-
#paths_with_stale_services(file_selector, stale_datetime) ⇒ Array
Retrieves a set of which have one or more services which need to run.
-
#registered_paths(file_selector) ⇒ Array
Retrieves a page of paths for registered files.
-
#remove(remove_me) ⇒ Object
Remove an entry from the index.
-
#setup_index ⇒ Object
Setup initial structure of index implementation.
- #update_index_state ⇒ Object
-
#using_index? ⇒ Boolean
True if the system is configured to use a metadata index.
Constructor Details
#initialize(config, app_config_manager) ⇒ IndexManager
Returns a new instance of IndexManager.
12 13 14 15 16 |
# File 'lib/longleaf/indexing/index_manager.rb', line 12 def initialize(config, app_config_manager) @config = config @app_config_manager = app_config_manager init_index_driver if @config&.key?(SYS_FIELDS::MD_INDEX) end |
Instance Method Details
#clear_index(older_than = nil) ⇒ Object
36 37 38 |
# File 'lib/longleaf/indexing/index_manager.rb', line 36 def clear_index(older_than = nil) @index_driver.clear_index(older_than) end |
#each_registered_path(file_selector, older_than: nil, &block) ⇒ Object
71 72 73 |
# File 'lib/longleaf/indexing/index_manager.rb', line 71 def each_registered_path(file_selector, older_than: nil, &block) @index_driver.each_registered_path(file_selector, older_than: older_than, &block) end |
#index(file_rec) ⇒ Object
Index the provided file_rec and its metadata
26 27 28 |
# File 'lib/longleaf/indexing/index_manager.rb', line 26 def index(file_rec) @index_driver.index(file_rec) end |
#index_stale? ⇒ Boolean
Returns true if the index should be reindexed.
41 42 43 |
# File 'lib/longleaf/indexing/index_manager.rb', line 41 def index_stale? @index_driver.is_stale? end |
#paths_with_stale_services(file_selector, stale_datetime) ⇒ Array
Retrieves a set of which have one or more services which need to run.
60 61 62 |
# File 'lib/longleaf/indexing/index_manager.rb', line 60 def paths_with_stale_services(file_selector, stale_datetime) @index_driver.paths_with_stale_services(file_selector, stale_datetime) end |
#registered_paths(file_selector) ⇒ Array
Retrieves a page of paths for registered files.
67 68 69 |
# File 'lib/longleaf/indexing/index_manager.rb', line 67 def registered_paths(file_selector) @index_driver.registered_paths(file_selector) end |
#remove(remove_me) ⇒ Object
Remove an entry from the index
32 33 34 |
# File 'lib/longleaf/indexing/index_manager.rb', line 32 def remove(remove_me) @index_driver.remove(remove_me) end |
#setup_index ⇒ Object
Setup initial structure of index implementation
46 47 48 |
# File 'lib/longleaf/indexing/index_manager.rb', line 46 def setup_index @index_driver.setup_index end |
#update_index_state ⇒ Object
50 51 52 |
# File 'lib/longleaf/indexing/index_manager.rb', line 50 def update_index_state @index_driver.update_index_state end |
#using_index? ⇒ Boolean
Returns true if the system is configured to use a metadata index.
19 20 21 |
# File 'lib/longleaf/indexing/index_manager.rb', line 19 def using_index? !@index_driver.nil? end |