Class MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput>
This builder is used to construct Migration<TReadResult, TWriteResult, TReadInput, TWriteInput> instances.
Inherited Members
Namespace: LaunchDarkly.Sdk.Server.Migrations
Assembly: LaunchDarkly.ServerSdk.dll
Syntax
public sealed class MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> where TReadResult : class where TWriteResult : class
Type Parameters
Name | Description |
---|---|
TReadResult | the result type for reads |
TWriteResult | the result type for writes |
TReadInput | the input types for reads |
TWriteInput | the input type for writes |
Remarks
This class is not thread-safe. The builder should be used on one thread and then the built Migration<TReadResult, TWriteResult, TReadInput, TWriteInput> is thread safe.
Constructors
| Edit this page View SourceMigrationBuilder(ILdClient)
Construct a migration builder.
Declaration
public MigrationBuilder(ILdClient client)
Parameters
Type | Name | Description |
---|---|---|
ILdClient | client | the client to use for migrations |
Methods
| Edit this page View SourceBuild()
Declaration
public IMigration<TReadResult, TWriteResult, TReadInput, TWriteInput> Build()
Returns
Type | Description |
---|---|
IMigration<TReadResult, TWriteResult, TReadInput, TWriteInput> | a build migration or null if a migration could not be built |
Remarks
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.
Read(Func<TReadInput, Result<TReadResult>>, Func<TReadInput, Result<TReadResult>>)
Configure the read methods of the migration.
Declaration
public MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> Read(Func<TReadInput, MigrationMethod.Result<TReadResult>> readOld, Func<TReadInput, MigrationMethod.Result<TReadResult>> readNew)
Parameters
Type | Name | Description |
---|---|---|
Func<TReadInput, MigrationMethod.Result<TReadResult>> | readOld | method for reading from the "old" migration source |
Func<TReadInput, MigrationMethod.Result<TReadResult>> | readNew | method for reading from the "new" migration source |
Returns
Type | Description |
---|---|
MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> | a reference to this builder |
Remarks
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(Func<TReadInput, Result<TReadResult>>, Func<TReadInput, Result<TReadResult>>, Func<TReadResult, TReadResult, bool>).
Read(Func<TReadInput, Result<TReadResult>>, Func<TReadInput, Result<TReadResult>>, Func<TReadResult, TReadResult, bool>)
Configure the read methods of the migration.
Declaration
public MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> Read(Func<TReadInput, MigrationMethod.Result<TReadResult>> readOld, Func<TReadInput, MigrationMethod.Result<TReadResult>> readNew, Func<TReadResult, TReadResult, bool> check)
Parameters
Type | Name | Description |
---|---|---|
Func<TReadInput, MigrationMethod.Result<TReadResult>> | readOld | method for reading from the "old" migration source |
Func<TReadInput, MigrationMethod.Result<TReadResult>> | readNew | method for reading from the "new" migration source |
Func<TReadResult, TReadResult, bool> | check | method which checks the consistency of the "old" and "new" source |
Returns
Type | Description |
---|---|
MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> | a reference to this builder |
Remarks
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(Func<TReadInput, Result<TReadResult>>, Func<TReadInput, Result<TReadResult>>).
ReadExecution(MigrationExecution)
Influences the level of concurrency when the migration stage calls for multiple execution reads.
Declaration
public MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> ReadExecution(MigrationExecution execution)
Parameters
Type | Name | Description |
---|---|---|
MigrationExecution | execution | the execution configuration |
Returns
Type | Description |
---|---|
MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> | a reference to this builder |
Remarks
The default read execution is Parallel().
Setting the execution to randomized serial order.
var builder = new MigrationBuilder<string, string, string, string>()
.ReadExecution(MigrationExecution.Serial(MigrationSerialOrder.Random))
TrackErrors(bool)
Enable or disable error tracking. Tracking is enabled by default.
Declaration
public MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> TrackErrors(bool trackErrors)
Parameters
Type | Name | Description |
---|---|---|
bool | trackErrors | true to enable error tracking, false to disable it |
Returns
Type | Description |
---|---|
MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> | a reference to this builder |
TrackLatency(bool)
Enable or disable latency tracking. Tracking is enabled by default.
Declaration
public MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> TrackLatency(bool trackLatency)
Parameters
Type | Name | Description |
---|---|---|
bool | trackLatency | true to enable tracking, false to disable it |
Returns
Type | Description |
---|---|
MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> | a reference to this builder |
Write(Func<TWriteInput, Result<TWriteResult>>, Func<TWriteInput, Result<TWriteResult>>)
Configure the write methods of the migration.
Declaration
public MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> Write(Func<TWriteInput, MigrationMethod.Result<TWriteResult>> writeOld, Func<TWriteInput, MigrationMethod.Result<TWriteResult>> writeNew)
Parameters
Type | Name | Description |
---|---|---|
Func<TWriteInput, MigrationMethod.Result<TWriteResult>> | writeOld | method which writes to the "old" source |
Func<TWriteInput, MigrationMethod.Result<TWriteResult>> | writeNew | method which writes to the "new" source |
Returns
Type | Description |
---|---|
MigrationBuilder<TReadResult, TWriteResult, TReadInput, TWriteInput> | a reference to this builder |
Remarks
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