59
59
use Neos \ContentRepository \Core \Feature \WorkspacePublication \Event \WorkspaceWasPublished ;
60
60
use Neos \ContentRepository \Core \Feature \WorkspaceRebase \Event \WorkspaceRebaseFailed ;
61
61
use Neos \ContentRepository \Core \Feature \WorkspaceRebase \Event \WorkspaceWasRebased ;
62
- use Neos \ContentRepository \Core \Infrastructure \DbalCheckpointStorage ;
63
62
use Neos \ContentRepository \Core \Infrastructure \DbalSchemaDiff ;
64
63
use Neos \ContentRepository \Core \NodeType \NodeTypeName ;
65
- use Neos \ContentRepository \Core \Projection \CheckpointStorageStatusType ;
66
64
use Neos \ContentRepository \Core \Projection \ContentGraph \ContentGraphProjectionInterface ;
67
65
use Neos \ContentRepository \Core \Projection \ContentGraph \ContentGraphReadModelInterface ;
68
66
use Neos \ContentRepository \Core \Projection \ContentGraph \NodeTags ;
73
71
use Neos \ContentRepository \Core \SharedModel \Node \NodeName ;
74
72
use Neos \ContentRepository \Core \SharedModel \Node \ReferenceName ;
75
73
use Neos \ContentRepository \Core \SharedModel \Workspace \ContentStreamId ;
76
- use Neos \EventStore \Model \Event \SequenceNumber ;
77
74
use Neos \EventStore \Model \EventEnvelope ;
78
75
79
76
/**
@@ -91,20 +88,13 @@ final class DoctrineDbalContentGraphProjection implements ContentGraphProjection
91
88
92
89
public const RELATION_DEFAULT_OFFSET = 128 ;
93
90
94
- private DbalCheckpointStorage $ checkpointStorage ;
95
-
96
91
public function __construct (
97
92
private readonly Connection $ dbal ,
98
93
private readonly ProjectionContentGraph $ projectionContentGraph ,
99
94
private readonly ContentGraphTableNames $ tableNames ,
100
95
private readonly DimensionSpacePointsRepository $ dimensionSpacePointsRepository ,
101
96
private readonly ContentGraphReadModelInterface $ contentGraphReadModel
102
97
) {
103
- $ this ->checkpointStorage = new DbalCheckpointStorage (
104
- $ this ->dbal ,
105
- $ this ->tableNames ->checkpoint (),
106
- self ::class
107
- );
108
98
}
109
99
110
100
public function setUp (): void
@@ -118,18 +108,10 @@ public function setUp(): void
118
108
throw new \RuntimeException (sprintf ('Failed to setup projection %s: %s ' , self ::class, $ e ->getMessage ()), 1716478255 , $ e );
119
109
}
120
110
}
121
- $ this ->checkpointStorage ->setUp ();
122
111
}
123
112
124
113
public function status (): ProjectionStatus
125
114
{
126
- $ checkpointStorageStatus = $ this ->checkpointStorage ->status ();
127
- if ($ checkpointStorageStatus ->type === CheckpointStorageStatusType::ERROR ) {
128
- return ProjectionStatus::error ($ checkpointStorageStatus ->details );
129
- }
130
- if ($ checkpointStorageStatus ->type === CheckpointStorageStatusType::SETUP_REQUIRED ) {
131
- return ProjectionStatus::setupRequired ($ checkpointStorageStatus ->details );
132
- }
133
115
try {
134
116
$ this ->dbal ->connect ();
135
117
} catch (\Throwable $ e ) {
@@ -147,59 +129,16 @@ public function status(): ProjectionStatus
147
129
return ProjectionStatus::ok ();
148
130
}
149
131
150
- public function reset (): void
132
+ public function resetState (): void
151
133
{
152
134
$ this ->truncateDatabaseTables ();
153
-
154
- $ this ->checkpointStorage ->acquireLock ();
155
- $ this ->checkpointStorage ->updateAndReleaseLock (SequenceNumber::none ());
156
- }
157
-
158
- public function getCheckpointStorage (): DbalCheckpointStorage
159
- {
160
- return $ this ->checkpointStorage ;
161
135
}
162
136
163
137
public function getState (): ContentGraphReadModelInterface
164
138
{
165
139
return $ this ->contentGraphReadModel ;
166
140
}
167
141
168
- public function canHandle (EventInterface $ event ): bool
169
- {
170
- return in_array ($ event ::class, [
171
- ContentStreamWasClosed::class,
172
- ContentStreamWasCreated::class,
173
- ContentStreamWasForked::class,
174
- ContentStreamWasRemoved::class,
175
- ContentStreamWasReopened::class,
176
- DimensionShineThroughWasAdded::class,
177
- DimensionSpacePointWasMoved::class,
178
- NodeAggregateNameWasChanged::class,
179
- NodeAggregateTypeWasChanged::class,
180
- NodeAggregateWasMoved::class,
181
- NodeAggregateWasRemoved::class,
182
- NodeAggregateWithNodeWasCreated::class,
183
- NodeGeneralizationVariantWasCreated::class,
184
- NodePeerVariantWasCreated::class,
185
- NodePropertiesWereSet::class,
186
- NodeReferencesWereSet::class,
187
- NodeSpecializationVariantWasCreated::class,
188
- RootNodeAggregateDimensionsWereUpdated::class,
189
- RootNodeAggregateWithNodeWasCreated::class,
190
- RootWorkspaceWasCreated::class,
191
- SubtreeWasTagged::class,
192
- SubtreeWasUntagged::class,
193
- WorkspaceBaseWorkspaceWasChanged::class,
194
- WorkspaceRebaseFailed::class,
195
- WorkspaceWasCreated::class,
196
- WorkspaceWasDiscarded::class,
197
- WorkspaceWasPublished::class,
198
- WorkspaceWasRebased::class,
199
- WorkspaceWasRemoved::class,
200
- ]) || $ event instanceof EmbedsContentStreamId;
201
- }
202
-
203
142
public function apply (EventInterface $ event , EventEnvelope $ eventEnvelope ): void
204
143
{
205
144
match ($ event ::class) {
@@ -232,7 +171,7 @@ public function apply(EventInterface $event, EventEnvelope $eventEnvelope): void
232
171
WorkspaceWasPublished::class => $ this ->whenWorkspaceWasPublished ($ event ),
233
172
WorkspaceWasRebased::class => $ this ->whenWorkspaceWasRebased ($ event ),
234
173
WorkspaceWasRemoved::class => $ this ->whenWorkspaceWasRemoved ($ event ),
235
- default => $ event instanceof EmbedsContentStreamId || throw new \ InvalidArgumentException ( sprintf ( ' Unsupported event %s ' , get_debug_type ( $ event ))) ,
174
+ default => null ,
236
175
};
237
176
if (
238
177
$ event instanceof EmbedsContentStreamId
0 commit comments