Class: ElasticGraph::Admin
- Inherits:
-
Object
- Object
- ElasticGraph::Admin
- Extended by:
- Support::FromYamlFile
- Defined in:
- lib/elastic_graph/admin.rb,
lib/elastic_graph/admin/rake_tasks.rb,
lib/elastic_graph/admin/cluster_configurator.rb,
lib/elastic_graph/admin/index_definition_configurator.rb,
lib/elastic_graph/admin/datastore_client_dry_run_decorator.rb,
lib/elastic_graph/admin/cluster_configurator/action_reporter.rb,
lib/elastic_graph/admin/index_definition_configurator/for_index.rb,
lib/elastic_graph/admin/cluster_configurator/script_configurator.rb,
lib/elastic_graph/admin/cluster_configurator/cluster_settings_manager.rb,
lib/elastic_graph/admin/index_definition_configurator/for_index_template.rb
Overview
The entry point into this library. Create an instance of this class to get access to the public interfaces provided by this library.
Defined Under Namespace
Modules: IndexDefinitionConfigurator Classes: ClusterConfigurator, DatastoreClientDryRunDecorator, RakeTasks
Instance Attribute Summary collapse
-
#datastore_core ⇒ Object
readonly
Returns the value of attribute datastore_core.
-
#schema_artifacts ⇒ Object
readonly
Returns the value of attribute schema_artifacts.
Class Method Summary collapse
-
.from_parsed_yaml(parsed_yaml, &datastore_client_customization_block) ⇒ Object
A factory method that builds an Admin instance from the given parsed YAML config.
Instance Method Summary collapse
- #cluster_configurator ⇒ Object
- #cluster_settings_manager ⇒ Object
- #datastore_indexing_router ⇒ Object
-
#initialize(datastore_core:, monotonic_clock: nil, clock: ::Time) ⇒ Admin
constructor
A new instance of Admin.
- #monotonic_clock ⇒ Object
-
#with_dry_run_datastore_clients ⇒ Object
Returns an alternate ‘Admin` instance with the datastore clients replaced with alternate implementations that turn all write operations into no-ops.
Constructor Details
#initialize(datastore_core:, monotonic_clock: nil, clock: ::Time) ⇒ Admin
Returns a new instance of Admin.
28 29 30 31 32 33 |
# File 'lib/elastic_graph/admin.rb', line 28 def initialize(datastore_core:, monotonic_clock: nil, clock: ::Time) @datastore_core = datastore_core @monotonic_clock = monotonic_clock @clock = clock @schema_artifacts = @datastore_core.schema_artifacts end |
Instance Attribute Details
#datastore_core ⇒ Object (readonly)
Returns the value of attribute datastore_core.
20 21 22 |
# File 'lib/elastic_graph/admin.rb', line 20 def datastore_core @datastore_core end |
#schema_artifacts ⇒ Object (readonly)
Returns the value of attribute schema_artifacts.
20 21 22 |
# File 'lib/elastic_graph/admin.rb', line 20 def schema_artifacts @schema_artifacts end |
Class Method Details
.from_parsed_yaml(parsed_yaml, &datastore_client_customization_block) ⇒ Object
A factory method that builds an Admin instance from the given parsed YAML config. ‘from_yaml_file(file_name, &block)` is also available (via `Support::FromYamlFile`).
24 25 26 |
# File 'lib/elastic_graph/admin.rb', line 24 def self.from_parsed_yaml(parsed_yaml, &datastore_client_customization_block) new(datastore_core: DatastoreCore.from_parsed_yaml(parsed_yaml, &datastore_client_customization_block)) end |
Instance Method Details
#cluster_configurator ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elastic_graph/admin.rb', line 35 def cluster_configurator @cluster_configurator ||= begin require "elastic_graph/admin/cluster_configurator" ClusterConfigurator.new( datastore_clients_by_name: @datastore_core.clients_by_name, index_defs: @datastore_core.index_definitions_by_name.values, index_configurations_by_name: schema_artifacts.indices, index_template_configurations_by_name: schema_artifacts.index_templates, scripts: schema_artifacts.datastore_scripts, cluster_settings_manager: cluster_settings_manager, clock: @clock ) end end |
#cluster_settings_manager ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/elastic_graph/admin.rb', line 50 def cluster_settings_manager @cluster_settings_manager ||= begin require "elastic_graph/admin/cluster_configurator/cluster_settings_manager" ClusterConfigurator::ClusterSettingsManager.new( datastore_clients_by_name: @datastore_core.clients_by_name, datastore_config: @datastore_core.config, logger: @datastore_core.logger ) end end |
#datastore_indexing_router ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/elastic_graph/admin.rb', line 61 def datastore_indexing_router @datastore_indexing_router ||= begin require "elastic_graph/indexer/datastore_indexing_router" Indexer::DatastoreIndexingRouter.new( datastore_clients_by_name: datastore_core.clients_by_name, mappings_by_index_def_name: schema_artifacts.index_mappings_by_index_def_name, monotonic_clock: monotonic_clock, logger: datastore_core.logger ) end end |
#monotonic_clock ⇒ Object
73 74 75 76 77 78 |
# File 'lib/elastic_graph/admin.rb', line 73 def monotonic_clock @monotonic_clock ||= begin require "elastic_graph/support/monotonic_clock" Support::MonotonicClock.new end end |
#with_dry_run_datastore_clients ⇒ Object
Returns an alternate ‘Admin` instance with the datastore clients replaced with alternate implementations that turn all write operations into no-ops.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/elastic_graph/admin.rb', line 82 def with_dry_run_datastore_clients require "elastic_graph/admin/datastore_client_dry_run_decorator" dry_run_clients_by_name = @datastore_core.clients_by_name.transform_values do |client| DatastoreClientDryRunDecorator.new(client) end Admin.new(datastore_core: DatastoreCore.new( config: datastore_core.config, logger: datastore_core.logger, schema_artifacts: datastore_core.schema_artifacts, clients_by_name: dry_run_clients_by_name, client_customization_block: datastore_core.client_customization_block )) end |