-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
ProjectionReplayService
and introduce CatchUpOptions
- Loading branch information
1 parent
38385ac
commit 19af2f6
Showing
9 changed files
with
78 additions
and
26 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
55 changes: 55 additions & 0 deletions
55
Neos.ContentRepository.Core/Classes/Projection/CatchUpOptions.php
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,55 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\ContentRepository\Core\Projection; | ||
|
||
use Neos\ContentRepository\Core\ContentRepository; | ||
use Neos\EventStore\Model\Event\SequenceNumber; | ||
|
||
/** | ||
* Options for {@see ContentRepository::catchUpProjection()} | ||
* | ||
* @api *NOTE:** The signature of the {@see create()} and {@see with()} methods might be extended in the future, so they should only ever be used with named arguments | ||
*/ | ||
final class CatchUpOptions | ||
{ | ||
/** | ||
* @param SequenceNumber|null $maximumSequenceNumber If specified the catch-up will stop at the specified {@see SequenceNumber} | ||
*/ | ||
private function __construct( | ||
public readonly ?SequenceNumber $maximumSequenceNumber, | ||
) { | ||
} | ||
|
||
/** | ||
* Creates an instance for the specified options | ||
* | ||
* Note: The signature of this method might be extended in the future, so it should always be used with named arguments | ||
* @see https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments | ||
*/ | ||
public static function create( | ||
SequenceNumber|int|null $maximumSequenceNumber = null, | ||
): self | ||
{ | ||
if (is_int($maximumSequenceNumber)) { | ||
$maximumSequenceNumber = SequenceNumber::fromInteger($maximumSequenceNumber); | ||
} | ||
return new self($maximumSequenceNumber); | ||
} | ||
|
||
|
||
/** | ||
* Returns a new instance with the specified additional options | ||
* | ||
* Note: The signature of this method might be extended in the future, so it should always be used with named arguments | ||
* @see https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments | ||
*/ | ||
public function with( | ||
SequenceNumber|int|null $maximumSequenceNumber = null, | ||
): self { | ||
return self::create( | ||
$maximumSequenceNumber ?? $this->maximumSequenceNumber, | ||
); | ||
} | ||
} |
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