Class SecurityIndexManager.IndexState

java.lang.Object
org.elasticsearch.xpack.security.support.SecurityIndexManager.IndexState
Enclosing class:
SecurityIndexManager

public class SecurityIndexManager.IndexState extends Object
  • Field Details

    • creationTime

      public final Instant creationTime
    • isIndexUpToDate

      public final boolean isIndexUpToDate
    • indexAvailableForSearch

      public final boolean indexAvailableForSearch
    • indexAvailableForWrite

      public final boolean indexAvailableForWrite
    • mappingUpToDate

      public final boolean mappingUpToDate
    • createdOnLatestVersion

      public final boolean createdOnLatestVersion
    • roleMappingsCleanupMigrationStatus

      public final SecurityIndexManager.RoleMappingsCleanupMigrationStatus roleMappingsCleanupMigrationStatus
    • migrationsVersion

      public final Integer migrationsVersion
    • minClusterMappingVersion

      public final SystemIndexDescriptor.MappingsVersion minClusterMappingVersion
    • indexMappingVersion

      public final Integer indexMappingVersion
    • concreteIndexName

      public final String concreteIndexName
    • indexHealth

      public final ClusterHealthStatus indexHealth
    • indexState

      public final IndexMetadata.State indexState
    • indexUUID

      public final String indexUUID
    • securityFeatures

      public final Set<NodeFeature> securityFeatures
  • Constructor Details

  • Method Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • aliasName

      public String aliasName()
    • indexExists

      public boolean indexExists()
    • indexIsClosed

      public boolean indexIsClosed()
    • getCreationTime

      public Instant getCreationTime()
    • isIndexUpToDate

      public boolean isIndexUpToDate()
      Returns whether the index is on the current format if it exists. If the index does not exist we treat the index as up to date as we expect it to be created with the current format.
    • isAvailable

      public boolean isAvailable(SecurityIndexManager.Availability availability)
      Optimization to avoid making unnecessary calls when we know the underlying shard state. This call will check that the index exists, is discoverable from the alias, is not closed, and will determine if available based on the SecurityIndexManager.Availability parameter.
      Parameters:
      availability - Check availability for search or write/update/real time get workflows. Write/update/realtime get workflows should check for availability of primary shards. Search workflows should check availability of search shards (which may or may not also be the primary shards).
      Returns:
      when checking for search: true if all searchable shards for the security index are available when checking for primary: true if all primary shards for the security index are available
    • isMappingUpToDate

      public boolean isMappingUpToDate()
    • isMigrationsVersionAtLeast

      public boolean isMigrationsVersionAtLeast(Integer expectedMigrationsVersion)
    • isCreatedOnLatestVersion

      public boolean isCreatedOnLatestVersion()
    • getConcreteIndexName

      public String getConcreteIndexName()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getUnavailableReason

      public ElasticsearchException getUnavailableReason(SecurityIndexManager.Availability availability)
    • checkIndexVersionThenExecute

      public void checkIndexVersionThenExecute(Consumer<Exception> consumer, Runnable andThen)
      Validates that the index is up to date and does not need to be migrated. If it is not, the consumer is called with an exception. If the index is up to date, the runnable will be executed. NOTE: this method does not check the availability of the index; this check is left to the caller so that this condition can be handled appropriately.
    • prepareIndexIfNeededThenExecute

      public void prepareIndexIfNeededThenExecute(Consumer<Exception> consumer, Runnable andThen)
      Prepares the index by creating it if it doesn't exist, then executes the runnable.
      Parameters:
      consumer - a handler for any exceptions that are raised either during preparation or execution
      andThen - executed if the index exists or after preparation is performed successfully
    • getRoleMappingsCleanupMigrationStatus

      public SecurityIndexManager.RoleMappingsCleanupMigrationStatus getRoleMappingsCleanupMigrationStatus()
    • isEligibleSecurityMigration

      public boolean isEligibleSecurityMigration(SecurityMigrations.SecurityMigration securityMigration)
    • isReadyForSecurityMigration

      public boolean isReadyForSecurityMigration(SecurityMigrations.SecurityMigration securityMigration)
    • onIndexAvailableForSearch

      public void onIndexAvailableForSearch(ActionListener<Void> listener, org.elasticsearch.core.TimeValue timeout)
      Waits up to timeout for the security index (in this project) to become available for search, based on cluster state updates. Notifies listener once the security index is available, or calls onFailure on timeout.