Interface ReindexingRuleProvider

All Known Implementing Classes:
ComposingReindexingRuleProvider, InlineReindexingRuleProvider

public interface ReindexingRuleProvider
Provides compaction rules for different aspects of reindexing configuration.

This abstraction allows rules to be sourced from different locations: inline definitions, database storage, external services, or dynamically generated based on metrics. Each method returns rules for a specific reindexing aspect (partitioning, index spec, filters, etc.), either for all rules or filtered by interval applicability.

  • Method Details

    • getType

      String getType()
      Returns the type identifier for this provider implementation.

      This value is used in JSON serialization to identify which provider implementation to use when deserializing.

      Returns:
      the type identifier (e.g., "inline", "external")
    • isReady

      default boolean isReady()
      Returns true if this provider is ready to supply rules.

      Providers that depend on external state (HTTP services, databases) should return false until they have successfully initialized and loaded their rules. Reindexing supervisors should check this before generating tasks to avoid creating tasks with incomplete rule sets.

      The default implementation returns true, which is appropriate for providers that have their rules available immediately (such as inline providers with static configuration).

      Returns:
      true if the provider is ready to supply rules, false otherwise
    • getDeletionRules

      List<ReindexingDeletionRule> getDeletionRules(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Returns all reindexing deletion rules that apply to the given interval.

      Handling partial overlaps is the responsibility of the provider implementation and should be clearly documented.

      Parameters:
      interval - The interval to check applicability against.
      referenceTime - The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.
      Returns:
      The list of ReindexingDeletionRule rules that apply to the given interval.
    • getDeletionRules

      List<ReindexingDeletionRule> getDeletionRules()
      Returns ALL reindexing deletion rules.
    • getDataSchemaRule

      @Nullable ReindexingDataSchemaRule getDataSchemaRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Returns the matched reindexing data schema rule that applies to the given interval.

      Handling cases of multiple applicable rules and/or partial overlaps is the responsibility of the provider implementation and should be clearly documented.

      Parameters:
      interval - The interval to check applicability against.
      referenceTime - The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.
      Returns:
      ReindexingDataSchemaRule rule that applies to the given interval.
    • getDataSchemaRules

      List<ReindexingDataSchemaRule> getDataSchemaRules()
      Returns ALL reindexing data schema rules.
    • getPartitioningRule

      @Nullable ReindexingPartitioningRule getPartitioningRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Returns the matched reindexing partitioning rule that applies to the given interval.

      Handling cases of multiple applicable rules and/or partial overlaps is the responsibility of the provider implementation and should be clearly documented.

      Parameters:
      interval - The interval to check applicability against.
      referenceTime - The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.
      Returns:
      ReindexingPartitioningRule rule that applies to the given interval.
    • getPartitioningRules

      List<ReindexingPartitioningRule> getPartitioningRules()
      Returns ALL reindexing partitioning rules.
    • getIndexSpecRule

      @Nullable ReindexingIndexSpecRule getIndexSpecRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Returns the matched reindexing index spec rule that applies to the given interval.

      Handling cases of multiple applicable rules and/or partial overlaps is the responsibility of the provider implementation and should be clearly documented.

      Parameters:
      interval - The interval to check applicability against.
      referenceTime - The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.
    • getIndexSpecRules

      List<ReindexingIndexSpecRule> getIndexSpecRules()
      Returns ALL reindexing index spec rules.
    • streamAllRules

      default Stream<ReindexingRule> streamAllRules()
      Returns a stream of all reindexing rules across all types.

      This provides a flexible way to filter, map, and process rules without needing specific methods for every possible combination. For example, to get all non-partitioning rules, you can filter: streamAllRules().filter(rule -> !(rule instanceof ReindexingPartitioningRule))

      Returns:
      a stream of all rules from all rule types