-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## [6.0.0] - 2023-10-23 The latest version of this SDK supports the ability to manage migrations or modernizations, using migration flags. You might use this functionality if you are optimizing queries, upgrading to new tech stacks, migrating from one database to another, or other similar technology changes. Migration flags are part of LaunchDarkly's Early Access Program. This feature is available to all LaunchDarkly customers but may undergo additional changes before it is finalized. For detailed information about this version, refer to the list below. For information on how to upgrade from the previous version, read the [migration guide](https://docs.launchdarkly.com/sdk/server-side/php/migration-5-to-6). ### Added: - A new `Migrator` type which provides an out-of-the-box configurable migration framework. - For more advanced use cases, added new `migrationVariation` and `trackMigrationOperation` methods on `LDClient`. ### Removed: - PHP 8.0 support was removed. - The legacy user format for contexts is no longer supported. To learn more, read the [Contexts documentation](https://docs.launchdarkly.com/guides/flags/intro-contexts). - Methods which originally took an `LDContext` or an `LDUser` now only accept an `LDContext`. - Previously deprecated test data flag builder methods `variationForAllUsers`, `valueForAllUsers`, and `clearUserTargets` have been removed. --------- Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: elliot <elliot@debian.elliot> Co-authored-by: Elliot Haisley <35050275+Apache-HB@users.noreply.github.com> Co-authored-by: Harpo Roeder <hroeder@launchdarkly.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com> Co-authored-by: Matthew M. Keeler <keelerm84@gmail.com> Co-authored-by: charukiewicz <charukiewicz@protonmail.com> Co-authored-by: Joey Malinowski <joemalin95@gmail.com> Co-authored-by: Christian Charukiewicz <christian@foxhound.systems> Co-authored-by: Matthew M. Keeler <mkeeler@launchdarkly.com> Co-authored-by: Colin Henwood <aretenz@users.noreply.github.com> Co-authored-by: Colin Henwood <colin.henwood@xero.com> Co-authored-by: Eli Bishop <35503443+eli-darkly@users.noreply.github.com> Co-authored-by: hroederld <46500128+hroederld@users.noreply.github.com> Co-authored-by: Louis Chan <lchan@launchdarkly.com> Co-authored-by: ld-repository-standards[bot] <113625520+ld-repository-standards[bot]@users.noreply.github.com> Co-authored-by: Kane Parkinson <93555788+kparkinson-ld@users.noreply.github.com> Co-authored-by: Michiel Devriese <michieldevriese@gmail.com>
- Loading branch information
1 parent
fa74322
commit cb0deb8
Showing
47 changed files
with
2,460 additions
and
1,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaunchDarkly\Impl\Migrations; | ||
|
||
use Closure; | ||
use Exception; | ||
use LaunchDarkly\Impl\Util; | ||
use LaunchDarkly\Migrations\OperationResult; | ||
use LaunchDarkly\Migrations\OpTracker; | ||
use LaunchDarkly\Migrations\Origin; | ||
use LaunchDarkly\Types\Result; | ||
|
||
/** | ||
* Utility class for executing migration operations while also tracking our | ||
* built-in migration measurements. | ||
*/ | ||
class Executor | ||
{ | ||
/** | ||
* @param Closure(mixed): Result $fn | ||
*/ | ||
public function __construct( | ||
public readonly Origin $origin, | ||
private Closure $fn, | ||
private OpTracker $tracker, | ||
private bool $trackLatency, | ||
private bool $trackErrors, | ||
private mixed $payload, | ||
) { | ||
} | ||
|
||
public function run(): OperationResult | ||
{ | ||
$start = Util::currentTimeUnixMillis(); | ||
|
||
try { | ||
$result = ($this->fn)($this->payload); | ||
} catch (Exception $e) { | ||
$result = Result::error($e->getMessage(), $e); | ||
} | ||
|
||
if ($this->trackLatency) { | ||
$this->tracker->latency($this->origin, Util::currentTimeUnixMillis() - $start); | ||
} | ||
|
||
if ($this->trackErrors && !$result->isSuccessful()) { | ||
$this->tracker->error($this->origin); | ||
} | ||
|
||
$this->tracker->invoked($this->origin); | ||
|
||
return new OperationResult($this->origin, $result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaunchDarkly\Impl\Model; | ||
|
||
/** | ||
* Internal data model class that describes a feature flag's migration settings. | ||
* | ||
* Application code should never need to reference the data model directly. | ||
* | ||
* @ignore | ||
* @internal | ||
*/ | ||
class MigrationSettings | ||
{ | ||
public function __construct(private readonly ?int $checkRatio = null) | ||
{ | ||
} | ||
|
||
public function getCheckRatio(): int | ||
{ | ||
return $this->checkRatio ?? 1; | ||
} | ||
|
||
public static function getDecoder(): \Closure | ||
{ | ||
return fn (array $v) => new MigrationSettings($v['checkRatio'] ?? null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.