Class SchemaEvolutionHandler
- Namespace
- Excalibur.Data.ElasticSearch.Projections
- Assembly
- Excalibur.Data.ElasticSearch.dll
Handles schema evolution and migrations for Elasticsearch projections.
public sealed class SchemaEvolutionHandler : ISchemaEvolutionHandler, ISchemaEvolutionHandlerAdmin, IDisposable
- Inheritance
-
SchemaEvolutionHandler
- Implements
- Inherited Members
Constructors
SchemaEvolutionHandler(ElasticsearchClient, IIndexAliasManager, IOptions<ElasticSearchProjectionManagementOptions>, ILogger<SchemaEvolutionHandler>)
Initializes a new instance of the SchemaEvolutionHandler class.
public SchemaEvolutionHandler(ElasticsearchClient client, IIndexAliasManager aliasManager, IOptions<ElasticSearchProjectionManagementOptions> options, ILogger<SchemaEvolutionHandler> logger)
Parameters
clientElasticsearchClientThe Elasticsearch client.
aliasManagerIIndexAliasManagerThe alias manager for zero-downtime swaps.
optionsIOptions<ElasticSearchProjectionManagementOptions>Projection settings.
loggerILogger<SchemaEvolutionHandler>Logger instance.
Methods
CompareSchemaAsync(string, string, CancellationToken)
Analyzes schema differences between source and target indices.
public Task<SchemaComparisonResult> CompareSchemaAsync(string sourceIndex, string targetIndex, CancellationToken cancellationToken)
Parameters
sourceIndexstringThe source index name.
targetIndexstringThe target index name or mapping.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<SchemaComparisonResult>
A schema comparison result detailing the differences.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
DryRunMigrationAsync(SchemaMigrationPlan, int, CancellationToken)
Performs a dry run of a schema migration without applying changes.
public Task<SchemaMigrationDryRunResult> DryRunMigrationAsync(SchemaMigrationPlan plan, int sampleSize, CancellationToken cancellationToken)
Parameters
planSchemaMigrationPlanThe migration plan to test.
sampleSizeintThe number of documents to test with.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<SchemaMigrationDryRunResult>
The dry run results.
ExecuteMigrationAsync(SchemaMigrationPlan, CancellationToken)
Executes a schema migration plan.
public Task<SchemaMigrationResult> ExecuteMigrationAsync(SchemaMigrationPlan plan, CancellationToken cancellationToken)
Parameters
planSchemaMigrationPlanThe migration plan to execute.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<SchemaMigrationResult>
The result of the migration execution.
GetSchemaHistoryAsync(string, CancellationToken)
Gets the schema version history for a projection type.
public Task<SchemaVersionHistory> GetSchemaHistoryAsync(string projectionType, CancellationToken cancellationToken)
Parameters
projectionTypestringThe projection type.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<SchemaVersionHistory>
The version history of the schema.
PlanMigrationAsync(SchemaMigrationRequest, CancellationToken)
Plans a schema migration from one version to another.
public Task<SchemaMigrationPlan> PlanMigrationAsync(SchemaMigrationRequest request, CancellationToken cancellationToken)
Parameters
requestSchemaMigrationRequestThe migration planning request.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<SchemaMigrationPlan>
A migration plan detailing the steps required.
RegisterSchemaVersionAsync(SchemaVersionRegistration, CancellationToken)
Registers a schema version for tracking.
public Task RegisterSchemaVersionAsync(SchemaVersionRegistration registration, CancellationToken cancellationToken)
Parameters
registrationSchemaVersionRegistrationThe schema version registration details.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task
A task representing the asynchronous registration operation.
ValidateBackwardsCompatibilityAsync(object, object, CancellationToken)
Validates that a schema change is backwards compatible.
public Task<SchemaCompatibilityResult> ValidateBackwardsCompatibilityAsync(object currentSchema, object newSchema, CancellationToken cancellationToken)
Parameters
currentSchemaobjectThe current schema definition.
newSchemaobjectThe proposed new schema definition.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<SchemaCompatibilityResult>
A validation result indicating compatibility.