Module org.elasticsearch.security
Class SecurityIndexManager.IndexState
java.lang.Object
org.elasticsearch.xpack.security.support.SecurityIndexManager.IndexState
- Enclosing class:
SecurityIndexManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Stringfinal booleanfinal Instantfinal booleanfinal booleanfinal ClusterHealthStatusfinal Integerfinal IndexMetadata.Statefinal Stringfinal booleanfinal booleanfinal Integerfinal Set<NodeFeature> -
Constructor Summary
ConstructorsConstructorDescriptionIndexState(ProjectId projectId, SecurityIndexManager.ProjectStatus projectStatus, Instant creationTime, boolean isIndexUpToDate, boolean indexAvailableForSearch, boolean indexAvailableForWrite, boolean mappingUpToDate, boolean createdOnLatestVersion, SecurityIndexManager.RoleMappingsCleanupMigrationStatus roleMappingsCleanupMigrationStatus, Integer migrationsVersion, SystemIndexDescriptor.MappingsVersion minClusterMappingVersion, Integer indexMappingVersion, String concreteIndexName, ClusterHealthStatus indexHealth, IndexMetadata.State indexState, String indexUUID, Set<NodeFeature> securityFeatures) -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckIndexVersionThenExecute(Consumer<Exception> consumer, Runnable andThen) Validates that the index is up to date and does not need to be migrated.booleangetUnavailableReason(SecurityIndexManager.Availability availability) inthashCode()booleanbooleanbooleanisAvailable(SecurityIndexManager.Availability availability) Optimization to avoid making unnecessary calls when we know the underlying shard state.booleanbooleanisEligibleSecurityMigration(SecurityMigrations.SecurityMigration securityMigration) booleanReturns whether the index is on the current format if it exists.booleanbooleanisMigrationsVersionAtLeast(Integer expectedMigrationsVersion) booleanisReadyForSecurityMigration(SecurityMigrations.SecurityMigration securityMigration) voidonIndexAvailableForSearch(ActionListener<Void> listener, org.elasticsearch.core.TimeValue timeout) Waits up totimeoutfor the security index (in this project) to become available for search, based on cluster state updates.voidprepareIndexIfNeededThenExecute(Consumer<Exception> consumer, Runnable andThen) Prepares the index by creating it if it doesn't exist, then executes the runnable.toString()
-
Field Details
-
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
-
minClusterMappingVersion
-
indexMappingVersion
-
concreteIndexName
-
indexHealth
-
indexState
-
indexUUID
-
securityFeatures
-
-
Constructor Details
-
IndexState
public IndexState(ProjectId projectId, SecurityIndexManager.ProjectStatus projectStatus, Instant creationTime, boolean isIndexUpToDate, boolean indexAvailableForSearch, boolean indexAvailableForWrite, boolean mappingUpToDate, boolean createdOnLatestVersion, SecurityIndexManager.RoleMappingsCleanupMigrationStatus roleMappingsCleanupMigrationStatus, Integer migrationsVersion, SystemIndexDescriptor.MappingsVersion minClusterMappingVersion, Integer indexMappingVersion, String concreteIndexName, ClusterHealthStatus indexHealth, IndexMetadata.State indexState, String indexUUID, Set<NodeFeature> securityFeatures)
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
aliasName
-
indexExists
public boolean indexExists() -
indexIsClosed
public boolean indexIsClosed() -
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
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 theSecurityIndexManager.Availabilityparameter.- 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:
trueif all searchable shards for the security index are available when checking for primary:trueif all primary shards for the security index are available
-
isMappingUpToDate
public boolean isMappingUpToDate() -
isMigrationsVersionAtLeast
-
isCreatedOnLatestVersion
public boolean isCreatedOnLatestVersion() -
getConcreteIndexName
-
toString
-
checkIndexVersionThenExecute
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
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 executionandThen- executed if the index exists or after preparation is performed successfully
-
getRoleMappingsCleanupMigrationStatus
public SecurityIndexManager.RoleMappingsCleanupMigrationStatus getRoleMappingsCleanupMigrationStatus() -
isEligibleSecurityMigration
-
isReadyForSecurityMigration
-
onIndexAvailableForSearch
public void onIndexAvailableForSearch(ActionListener<Void> listener, org.elasticsearch.core.TimeValue timeout) Waits up totimeoutfor the security index (in this project) to become available for search, based on cluster state updates. Notifieslisteneronce the security index is available, or callsonFailureontimeout.
-