Skip to content

Commit

Permalink
Merge branch 'feature/4289-overhaul-catchup' into feature/4200-replay…
Browse files Browse the repository at this point in the history
…-progress-bar
  • Loading branch information
bwaidelich committed Aug 26, 2023
2 parents 530248c + 0c97437 commit b5f4f8a
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@
use Neos\EventStore\Model\EventEnvelope;
use Neos\EventStore\Model\EventStore\SetupResult;

use function get_debug_type;

/**
* @implements ProjectionInterface<ContentGraph>
* @internal but the graph projection is api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
use Neos\EventStore\Model\EventEnvelope;
use Neos\EventStore\Model\EventStore\SetupResult;

use function sprintf;

/**
* The alternate reality-aware hypergraph projector for the PostgreSQL backend via Doctrine DBAL
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ public static function fromProjectionsAndEventsAndSequenceNumber(
$pendingProjectionsArray = [];
$sequenceNumberPerProjection = [];
foreach ($events as $event) {
if ($event instanceof DecoratedEvent) {
$event = $event->innerEvent;
}
foreach ($allProjections as $projection) {
if ($event instanceof DecoratedEvent) {
$event = $event->innerEvent;
}
if ($projection->canHandle($event)) {
$sequenceNumberPerProjection[$projection::class] = $sequenceNumberInteger;
if (!in_array($projection, $pendingProjectionsArray, true)) {
Expand Down
2 changes: 1 addition & 1 deletion Neos.ContentRepository.Core/Classes/ContentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function projectionState(string $projectionStateClassName): ProjectionSta
return $projectionState;
}
}
throw new \InvalidArgumentException(sprintf('a projection state of type "%s" is not registered in this content repository instance.', $projectionStateClassName), 1662033650);
throw new \InvalidArgumentException(sprintf('A projection state of type "%s" is not registered in this content repository instance.', $projectionStateClassName), 1662033650);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
use Neos\EventStore\Model\Event\SequenceNumber;
use Neos\EventStore\Model\EventEnvelope;

use function sprintf;

/**
* See {@see ContentStreamFinder} for explanation.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
use Neos\EventStore\Model\Event\SequenceNumber;
use Neos\EventStore\Model\EventEnvelope;

use function sprintf;

/**
* TODO: this class needs proper testing
* @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
use Neos\EventStore\Model\Event\SequenceNumber;
use Neos\EventStore\Model\EventEnvelope;

use function sprintf;

/**
* @internal
* @implements ProjectionInterface<WorkspaceFinder>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,103 +15,6 @@ class ContentStreamCommandController extends CommandController
*/
protected $contentRepositoryRegistry;

/**
* @throws \Neos\Flow\Cli\Exception\StopCommandException
*/
public function exportCommand(string $contentStream, string $contentRepository = 'default', int $startSequenceNumber = 0): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepository);
throw new \RuntimeException('TODO IMPL??');
// TODO??$events = $this->contentRepositoryEventStore->load(
// StreamName::fromString($contentStream),
// $startSequenceNumber
//);
}

/**
* Imports events to a content stream from the given file.
* Note that the events in the file need to come from the same content stream you import to for now!
*
* @throws \Neos\ContentRepository\Core\SharedModel\Exception\ContentStreamAlreadyExists
* @throws \Neos\ContentRepository\Core\Feature\WorkspaceCreation\Exception\WorkspaceAlreadyExists
* @throws \Neos\EventSourcing\EventListener\Exception\EventCouldNotBeAppliedException
* @throws \Symfony\Component\Serializer\Exception\ExceptionInterface
*/
public function importCommand(string $contentStream, string $file = null): void
{
throw new \RuntimeException('TODO IMPL??');
// TODO
// if ($file !== null) {
// $fileStream = fopen($file, 'r');
// $this->outputLine('Reading from file: "%s"', [$file]);
// } else {
// $fileStream = fopen('php://stdin', 'r');
// $this->outputLine('Reading import data from standard in.');
// }
// if (!$fileStream) {
// throw new \InvalidArgumentException('Failed to open file ' . $file);
// }
// $normalizer = new EventNormalizer(new EventTypeResolver());
//
// $contentStreamToImportTo = ContentStreamId::fromString($contentStream);
// $eventStreamName = ContentStreamEventStreamName::fromContentStreamId($contentStreamToImportTo)
// ->getEventStreamName();
//
// $this->outputLine('Clearing workspace projection to create the workspace to import to.');
// $workspaceProjection = $this->projectionManager->getProjection('workspace');
// $this->projectionManager->replay($workspaceProjection->getIdentifier());
//
// $commandResult = $this->workspaceCommandHandler->handleCreateRootWorkspace(
// new CreateRootWorkspace(
// WorkspaceName::forLive(),
// WorkspaceTitle::fromString('Live'),
// WorkspaceDescription::fromString(''),
// UserIdentifier::forSystemUser(),
// $contentStreamToImportTo
// )
// );
//
// $this->outputLine('Created workspace "Live" for the given content stream identifier');
//
// $i = 0;
// $domainEvents = DomainEvents::createEmpty();
//
// $this->outputLine('starting import');
// $this->output->progressStart();
// for ($line = fgets($fileStream); $line !== false; $line = fgets($fileStream)) {
// $this->output->progressAdvance();
// $i++;
// if ($line === '[' || $line === ']') {
// continue;
// }
//
// $rawEventLine = ltrim($line, ',');
// $rawEventProperties = json_decode($rawEventLine, true);
// if (!is_array($rawEventProperties)) {
// continue;
// }
//
// $domainEvent = $normalizer->denormalize($rawEventProperties['payload'], $rawEventProperties['type']);
// $domainEvent = DecoratedEvent::addMetadata($domainEvent, $rawEventProperties['metadata']);
//
// $domainEvents = $domainEvents->appendEvent($domainEvent);
//
// if ($i === 10) {
// $this->contentRepositoryEventStore->commit($eventStreamName, $domainEvents);
// $domainEvents = DomainEvents::createEmpty();
// $i = 0;
// }
// }
// $this->output->progressFinish();
//
// $this->contentRepositoryEventStore->commit($eventStreamName, $domainEvents);
// fclose($fileStream);
// $this->outputLine('');
// $this->outputLine('Finished importing events.');
// $this->outputLine('Your events and projections are probably out of sync now,'
// . ' <error>make sure you replay all projections via "./flow projection:replayall"</error>.');
}

/**
* Remove all content streams which are not needed anymore from the projections.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
use Neos\Utility\Exception\InvalidTypeException;
use Neos\Utility\TypeHandling;

use function sprintf;

/**
* @implements ProjectionInterface<AssetUsageFinder>
* @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<body>
<trans-unit id="ui.label" xml:space="preserve">
<source>Content Collection</source>
<target state="translated">Recopilación de los contenidos</target>
<target state="translated">Colección de contenidos</target>
</trans-unit>
</body>
</file>
Expand Down

0 comments on commit b5f4f8a

Please sign in to comment.