Class: ElasticGraph::DatastoreCore::IndexDefinition::RolloverIndex
- Defined in:
- lib/elastic_graph/datastore_core/index_definition/rollover_index.rb
Overview
Represents a concrete index for specific time range, derived from a RolloverIndexTemplate.
Instance Attribute Summary collapse
-
#time_set ⇒ Object
readonly
Returns the value of attribute time_set.
Instance Method Summary collapse
-
#==(other) ⇒ Object
(also: #eql?)
We need to override ‘==` so that two
RolloverIndexobjects that wrap the sameIndexobject are considered equal. -
#initialize(index, time_set) ⇒ RolloverIndex
constructor
A new instance of RolloverIndex.
Methods inherited from Index
#delete_from_datastore, #index_expression_for_search, #index_name_for_writes, #mappings_in_datastore, #related_rollover_indices, #rollover_index_template?
Methods included from Base
#accessible_cluster_names_to_index_into, #accessible_from_queries?, #all_accessible_cluster_names, #cluster_to_query, #clusters_to_index_into, #flattened_env_setting_overrides, #has_custom_routing?, #ignored_values_for_routing, #known_related_query_rollover_indices, #list_counts_field_paths_for_source, #routing_value_for_prepared_record, #searches_could_hit_incomplete_docs?, #to_s, #use_updates_for_indexing?
Constructor Details
#initialize(index, time_set) ⇒ RolloverIndex
Returns a new instance of RolloverIndex.
20 21 22 23 |
# File 'lib/elastic_graph/datastore_core/index_definition/rollover_index.rb', line 20 def initialize(index, time_set) super(index) @time_set = time_set end |
Instance Attribute Details
#time_set ⇒ Object (readonly)
Returns the value of attribute time_set.
18 19 20 |
# File 'lib/elastic_graph/datastore_core/index_definition/rollover_index.rb', line 18 def time_set @time_set end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
We need to override ‘==` so that two RolloverIndex objects that wrap the same Index object are considered equal. Oddly enough, the DelegateClass implementation of `==` returns true if other is the wrapped object, but not if it’s another instance of the same DelegateClass wrapping the same instance.
github.com/ruby/ruby/blob/v3_0_3/lib/delegate.rb#L156-L159
We need this because we want two RolloverIndex instances that wrap the same underlying Index instance to be considered equal (something a test relies upon, but also generally useful and expected).
35 36 37 38 39 40 41 42 43 |
# File 'lib/elastic_graph/datastore_core/index_definition/rollover_index.rb', line 35 def ==(other) if RolloverIndex === other __getobj__ == other.__getobj__ && time_set == other.time_set else # :nocov: -- this method isn't explicitly covered by tests (not worth writing a test just to cover this line). super # :nocov: end end |