-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
9735: 9725 engine abstraction part 1 r=pihme a=pihme ## Description - adds a new package into which the platform classes will be moved temporarily (with the idea to later move them into a new Maven module) - adds a test that warns about unwanted dependencies to that new package - moves some relevant classes into the new package - adds skeleton interfaces for the engine abstraction - implements replay functionality in new `Engine` class and calls the replay from the existing classes ## Related issues related to #9725 Co-authored-by: pihme <pihme@users.noreply.github.com>
- Loading branch information
Showing
52 changed files
with
323 additions
and
66 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 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
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
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
61 changes: 61 additions & 0 deletions
61
engine/src/main/java/io/camunda/zeebe/engine/EngineImpl.java
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,61 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.engine; | ||
|
||
import io.camunda.zeebe.db.TransactionContext; | ||
import io.camunda.zeebe.db.ZeebeDb; | ||
import io.camunda.zeebe.engine.api.Engine; | ||
import io.camunda.zeebe.engine.api.EngineContext; | ||
import io.camunda.zeebe.engine.api.ErrorHandlingContext; | ||
import io.camunda.zeebe.engine.api.ProcessingContext; | ||
import io.camunda.zeebe.engine.api.ProcessingResult; | ||
import io.camunda.zeebe.engine.processing.streamprocessor.TypedRecord; | ||
import io.camunda.zeebe.engine.state.EventApplier; | ||
import io.camunda.zeebe.engine.state.ZeebeDbState; | ||
import io.camunda.zeebe.engine.state.mutable.MutableZeebeState; | ||
import java.util.function.Function; | ||
|
||
public class EngineImpl implements Engine { | ||
|
||
private final EventApplier eventApplier; | ||
|
||
public EngineImpl( | ||
final int partitionId, | ||
final ZeebeDb zeebeDb, | ||
final Function<MutableZeebeState, EventApplier> eventApplierFactory) { | ||
|
||
final TransactionContext transactionContext = zeebeDb.createContext(); | ||
final var zeebeState = new ZeebeDbState(partitionId, zeebeDb, transactionContext); | ||
eventApplier = eventApplierFactory.apply(zeebeState); | ||
} | ||
|
||
@Override | ||
public void init(final EngineContext engineContext) { | ||
throw new IllegalStateException("Not yet implemented"); | ||
} | ||
|
||
@Override | ||
public void replay(final TypedRecord event) { | ||
eventApplier.applyState(event.getKey(), event.getIntent(), event.getValue()); | ||
} | ||
|
||
@Override | ||
public ProcessingResult process( | ||
final TypedRecord record, final ProcessingContext processingContext) { | ||
throw new IllegalStateException("Not yet implemented"); | ||
} | ||
|
||
@Override | ||
public ProcessingResult onProcessingError( | ||
final Throwable processingException, | ||
final TypedRecord record, | ||
final long position, | ||
final ErrorHandlingContext errorHandlingContext) { | ||
throw new IllegalStateException("Not yet implemented"); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
engine/src/main/java/io/camunda/zeebe/engine/api/Engine.java
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,25 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.engine.api; | ||
|
||
import io.camunda.zeebe.engine.processing.streamprocessor.TypedRecord; | ||
|
||
public interface Engine { | ||
|
||
void init(EngineContext engineContext); | ||
|
||
void replay(TypedRecord record); | ||
|
||
ProcessingResult process(TypedRecord record, ProcessingContext processingContext); | ||
|
||
ProcessingResult onProcessingError( | ||
Throwable processingException, | ||
TypedRecord record, | ||
long position, | ||
ErrorHandlingContext errorHandlingContext); | ||
} |
10 changes: 10 additions & 0 deletions
10
engine/src/main/java/io/camunda/zeebe/engine/api/EngineContext.java
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,10 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.engine.api; | ||
|
||
public interface EngineContext {} |
13 changes: 13 additions & 0 deletions
13
engine/src/main/java/io/camunda/zeebe/engine/api/ErrorHandlingContext.java
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,13 @@ | ||
/* | ||
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under | ||
* one or more contributor license agreements. See the NOTICE file distributed | ||
* with this work for additional information regarding copyright ownership. | ||
* Licensed under the Zeebe Community License 1.1. You may not use this file | ||
* except in compliance with the Zeebe Community License 1.1. | ||
*/ | ||
package io.camunda.zeebe.engine.api; | ||
|
||
// TODO check after refactoring, whether this is the same as ProcessingContext | ||
public interface ErrorHandlingContext { | ||
ProcessingResultBuilder getProcessingResultBuilder(); | ||
} |
Oops, something went wrong.