neos / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
https://www.neos.io/
GNU General Public License v3.0
260 stars 221 forks source link

9.0 Feature projection status and `cr:status` command #4468

Closed mhsdesign closed 8 months ago

mhsdesign commented 1 year ago

im currently building the 9.0 neos setup, and wondering if there is a way to tell the user the cr:setup has to be rerun - there is no way currently.

See discussion https://neos-project.slack.com/archives/C3MCBK6S2/p1691245346480469

mhsdesign commented 1 year ago

As discussed we still can introduce this method to the ProjectionInterface at a later point - even in 9.1 as we consider the projection api beta for know and dont promise 100% compatibility

Also we need to better define the setupStatus it should not only be a boolean status but a dto with all important properties.

cc @bwaidelich , @skurfuerst

bwaidelich commented 8 months ago

Related: https://github.com/neos/eventstore/issues/16 Related: first draft wip implementation https://github.com/neos/neos-development-collection/pull/4474

bwaidelich commented 8 months ago

Ideas

as discussed with @mhsdesign

new classes

enum ProjectionStatusType {
  case OK;
  case ERROR;
  case REQUIRES_SETUP;
  case REQUIRES_REPLAY;
}

final readonly class ProjectionStatus {
  public function __construct(
    public ProjectionStatusType $type,
    public string $details,
  ) {
  }
}

final readonly class ProjectionStatuses implements \IteratorAggregate {

  /**
   * @var array<class-string<ProjectionInterface<ProjectionStateInterface>>, ProjectionStatus>
   */
  private array $statuses;

  // ...
}

final readonly class ContentRepositoryStatus {
  public function __construct(
    public EventStoreStatus $eventStoreStatus, // see https://github.com/neos/eventstore/issues/16
    public ProjectionStatuses $projectionStatuses,
  ) {
  }
}

and then:

in ContentRepository

Change setUp() signature:

-public function setUp(): SetupResult
+public function setUp(): void

(throw exception on failure)

And add status():

public function status(): EventStoreStatus {
  // ...
}