Class MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput>
- java.lang.Object
-
- com.launchdarkly.sdk.server.migrations.MigrationBuilder<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 class MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MigrationBuilder(LDClientInterface client)
Construct a new builder.
-
Method Summary
-
-
-
Constructor Detail
-
MigrationBuilder
public MigrationBuilder(LDClientInterface client)
Construct a new builder.- Parameters:
client
- this client will be used forMigration
s built from this builder
-
-
Method Detail
-
trackLatency
@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> trackLatency(boolean track)
Enable or disable latency tracking. Tracking is enabled by default.- Parameters:
track
- true to enable tracking, false to disable it- Returns:
- a reference to this builder
-
trackErrors
@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> trackErrors(boolean track)
Enable or disable error tracking. Tracking is enabled by default.- Parameters:
track
- true to enable error tracking, false to disable it- Returns:
- a reference to this builder
-
readExecution
@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> readExecution(MigrationExecution execution)
Influences the level of concurrency when the migration stage calls for multiple execution reads.The default read execution is
MigrationExecution.Parallel()
.Setting the execution to randomized serial order.
builder.readExecution(MigrationExecution.Serial(MigrationSerialOrder.RANDOM));
- Parameters:
execution
- the execution configuration- Returns:
- a reference to this builder
-
read
@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> read(@NotNull Migration.Reader<TReadInput,TReadResult> oldImpl, @NotNull Migration.Reader<TReadInput,TReadResult> newImpl, @NotNull Migration.ReadConsistencyChecker<TReadResult> checker)
Configure the read methods of the migration.Users are required to provide two different read methods -- one to read from the old migration source, and one to read from the new source. This method allows specifying a check method for consistency tracking.
If you do not want consistency tracking, then use
read(Migration.Reader, Migration.Reader)
.- Parameters:
oldImpl
- method for reading from the "old" migration sourcenewImpl
- method for reading from the "new" migration sourcechecker
- method which checks the consistency of the "old" and "new" source- Returns:
- a reference to this builder
-
read
@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> read(@NotNull Migration.Reader<TReadInput,TReadResult> oldImpl, @NotNull Migration.Reader<TReadInput,TReadResult> newImpl)
Configure the read methods of the migration.Users are required to provide two different read methods -- one to read from the old migration source, and one to read from the new source. This method does not enable consistency tracking.
If you do want consistency tracking, then use
read(Migration.Reader, Migration.Reader, Migration.ReadConsistencyChecker)
.- Parameters:
oldImpl
- method for reading from the "old" migration sourcenewImpl
- method for reading from the "new" migration source- Returns:
- a reference to this builder
-
write
@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> write(@NotNull Migration.Writer<TWriteInput,TWriteResult> oldImpl, @NotNull Migration.Writer<TWriteInput,TWriteResult> newImpl)
Configure the write methods of the migration.Users are required to provide two different write methods -- one to write to the old migration source, and one to write to the new source. Not every stage requires
- Parameters:
oldImpl
- method which writes to the "old" sourcenewImpl
- method which writes to the "new" source- Returns:
- a reference to this builder
-
build
@NotNull public java.util.Optional<Migration<TReadResult,TWriteResult,TReadInput,TWriteInput>> build()
Build aMigration
.A migration requires that both the read and write methods are defined. If they have not been defined, then a migration cannot be constructed. In this case an empty optional will be returned.
- Returns:
- Either an empty optional or an optional containing a
Migration
.
-
-