MigratorBuilder
in package
The migration builder is used to configure and construct an instance of a {@see Migrator}. This migrator can be used to perform LaunchDarkly assisted technology migrations through the use of migration-based feature flags.
Table of Contents
- __construct() : mixed
- build() : Result
- Build constructs a Migrator instance to support migration-based reads and writes.
- read() : MigratorBuilder
- Read can be used to configure the migration-read behavior of the resulting migrator instance.
- readExecutionOrder() : MigratorBuilder
- The read execution order influences the parallelism and execution order for read operations involving multiple origins.
- trackErrors() : MigratorBuilder
- Enable or disable error tracking for migration operations. This error information can be sent upstream to LaunchDarkly to enhance migration visibility.
- trackLatency() : MigratorBuilder
- Enable or disable latency tracking for migration operations. This latency information can be sent upstream to LaunchDarkly to enhance migration visibility.
- write() : MigratorBuilder
- Write can be used to configure the migration-write behavior of the resulting :class:`Migrator` instance.
Methods
__construct()
public
__construct(LDClient $client) : mixed
Parameters
- $client : LDClient
Return values
mixed —build()
Build constructs a Migrator instance to support migration-based reads and writes.
public
build() : Result
Return values
Result —read()
Read can be used to configure the migration-read behavior of the resulting migrator instance.
public
read(Closure $old, Closure $new[, Closure|null $comparison = null ]) : MigratorBuilder
Users are required to provide two different read methods -- one to read from the old migration origin, and one to read from the new origin. Additionally, customers can opt-in to consistency tracking by providing a comparison function.
Depending on the migration stage, one or both of these read methods may be called.
The read methods should accept a single nullable parameter. This parameter is a payload passed through the Migrator.read() method. This method should return a Result instance.
The consistency method should accept 2 parameters of any type. These parameters are the results of executing the read operation against the old and new origins. If both operations were successful, the consistency method will be invoked. This method should return true if the two parameters are equal, or false otherwise.
Parameters
- $old : Closure
- $new : Closure
- $comparison : Closure|null = null
Return values
MigratorBuilder —readExecutionOrder()
The read execution order influences the parallelism and execution order for read operations involving multiple origins.
public
readExecutionOrder(ExecutionOrder $order) : MigratorBuilder
Parameters
- $order : ExecutionOrder
Return values
MigratorBuilder —trackErrors()
Enable or disable error tracking for migration operations. This error information can be sent upstream to LaunchDarkly to enhance migration visibility.
public
trackErrors(bool $track) : MigratorBuilder
Parameters
- $track : bool
Return values
MigratorBuilder —trackLatency()
Enable or disable latency tracking for migration operations. This latency information can be sent upstream to LaunchDarkly to enhance migration visibility.
public
trackLatency(bool $track) : MigratorBuilder
Parameters
- $track : bool
Return values
MigratorBuilder —write()
Write can be used to configure the migration-write behavior of the resulting :class:`Migrator` instance.
public
write(Closure $old, Closure $new) : MigratorBuilder
Users are required to provide two different write methods -- one to write to the old migration origin, and one to write to the new origin.
Depending on the migration stage, one or both of these write methods may be called.
The write methods should accept a single nullable parameter. This parameter is a payload passed through the Migrator.write() method. This method should return a Result instance.
Parameters
- $old : Closure
- $new : Closure