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 and Description |
---|
MigrationBuilder(LDClientInterface client)
Construct a new builder.
|
public MigrationBuilder(LDClientInterface client)
client
- this client will be used for Migration
s built from
this builder@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> trackLatency(boolean track)
track
- true to enable tracking, false to disable it@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> trackErrors(boolean track)
track
- true to enable error tracking, false to disable it@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> readExecution(MigrationExecution execution)
The default read execution is MigrationExecution.Parallel()
.
Setting the execution to randomized serial order.
builder.readExecution(MigrationExecution.Serial(MigrationSerialOrder.RANDOM));
execution
- the execution configuration@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)
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)
.
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@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> read(@NotNull Migration.Reader<TReadInput,TReadResult> oldImpl, @NotNull Migration.Reader<TReadInput,TReadResult> newImpl)
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)
.
oldImpl
- method for reading from the "old" migration sourcenewImpl
- method for reading from the "new" migration source@NotNull public MigrationBuilder<TReadResult,TWriteResult,TReadInput,TWriteInput> write(@NotNull Migration.Writer<TWriteInput,TWriteResult> oldImpl, @NotNull Migration.Writer<TWriteInput,TWriteResult> newImpl)
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
oldImpl
- method which writes to the "old" sourcenewImpl
- method which writes to the "new" source@NotNull public java.util.Optional<Migration<TReadResult,TWriteResult,TReadInput,TWriteInput>> build()
Migration
.
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.
Migration
.