Class Migration<TReadResult,TWriteResult,TReadInput,TWriteInput>
- java.lang.Object
-
- com.launchdarkly.sdk.server.migrations.Migration<TReadResult,TWriteResult,TReadInput,TWriteInput>
-
- Type Parameters:
TReadResult
- The result type for reads.TWriteResult
- The result type for writes.TReadInput
- The input parameter type for reads.TWriteInput
- The input type for writes.
public final class Migration<TReadResult,TWriteResult,TReadInput,TWriteInput> extends java.lang.Object
Class for performing a technology migration.This class is not intended to be instanced directly, but instead should be constructed using the
MigrationBuilder
.The thread safety model for a migration depends on the usage of thread-safe elements. Specifically the tracker, the client, and the thread pool should be thread-safe. Other elements of the migration instance itself are immutable for their thread-safety.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Migration.Method<UInput,UOutput>
static class
Migration.MigrationResult<TResult>
This class represents the result of a migration operation.static class
Migration.MigrationWriteResult<TWriteResult>
The result of a migration write.static interface
Migration.ReadConsistencyChecker<TReadResult>
This interface defines a method for checking the consistency of two reads.static interface
Migration.Reader<TReadInput,TReadResult>
This interface defines a read method.static interface
Migration.Writer<TWriteInput,TWriteResult>
This interfaces defines a write method.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Migration.MigrationResult<TReadResult>
read(java.lang.String key, LDContext context, MigrationStage defaultStage)
Execute a migration based read.Migration.MigrationResult<TReadResult>
read(java.lang.String key, LDContext context, MigrationStage defaultStage, TReadInput payload)
Execute a migration based read with a payload.Migration.MigrationWriteResult<TWriteResult>
write(java.lang.String key, LDContext context, MigrationStage defaultStage)
Execute a migration based write.Migration.MigrationWriteResult<TWriteResult>
write(java.lang.String key, LDContext context, MigrationStage defaultStage, TWriteInput payload)
Execute a migration based write with a payload.
-
-
-
Method Detail
-
read
@NotNull public Migration.MigrationResult<TReadResult> read(@NotNull java.lang.String key, @NotNull LDContext context, @NotNull MigrationStage defaultStage, @Nullable TReadInput payload)
Execute a migration based read with a payload.To execute a read without a payload use
read(String, LDContext, MigrationStage)
.- Parameters:
key
- the flag key of migration flagcontext
- the context for the migrationdefaultStage
- the default migration stagepayload
- an optional payload that will be passed to the new/old read implementations- Returns:
- the result of the read
-
read
@NotNull public Migration.MigrationResult<TReadResult> read(@NotNull java.lang.String key, @NotNull LDContext context, @NotNull MigrationStage defaultStage)
Execute a migration based read.To execute a read with a payload use
read(String, LDContext, MigrationStage, Object)
.- Parameters:
key
- the flag key of migration flagcontext
- the context for the migrationdefaultStage
- the default migration stage- Returns:
- the result of the read
-
write
@NotNull public Migration.MigrationWriteResult<TWriteResult> write(@NotNull java.lang.String key, @NotNull LDContext context, @NotNull MigrationStage defaultStage, @Nullable TWriteInput payload)
Execute a migration based write with a payload.To execute a write without a payload use
write(String, LDContext, MigrationStage)
.- Parameters:
key
- the flag key of migration flagcontext
- the context for the migrationdefaultStage
- the default migration stagepayload
- an optional payload that will be passed to the new/old write implementations- Returns:
- the result of the write
-
write
@NotNull public Migration.MigrationWriteResult<TWriteResult> write(@NotNull java.lang.String key, @NotNull LDContext context, @NotNull MigrationStage defaultStage)
Execute a migration based write.To execute a read with a payload use
write(String, LDContext, MigrationStage, Object)
.- Parameters:
key
- the flag key of migration flagcontext
- the context for the migrationdefaultStage
- the default migration stage- Returns:
- the result of the write
-
-