tkalkirill commented on code in PR #1745:
URL: https://github.com/apache/ignite-3/pull/1745#discussion_r1126830728
##########
modules/storage-api/src/main/java/org/apache/ignite/internal/storage/util/StorageOperation.java:
##########
@@ -25,16 +25,55 @@
* Storage operations.
*/
interface StorageOperation {
+ /**
+ * Returns future completion of the operation.
+ */
+ CompletableFuture<Void> operationFuture();
+
+ /**
+ * Return {@code true} if the operation is the final.
+ */
+ boolean isFinalOperation();
+
+ /**
+ * Marks the operation as final.
+ */
+ void markFinalOperation();
+
+ /**
+ * Abstract operation of the storage.
+ */
+ abstract class AbstractStorageOperation implements StorageOperation {
+ private final CompletableFuture<Void> operationFuture = new
CompletableFuture<>();
+
+ private volatile boolean finalOperation;
+
+ @Override
+ public CompletableFuture<Void> operationFuture() {
+ return operationFuture;
+ }
+
+ @Override
+ public boolean isFinalOperation() {
+ return finalOperation;
+ }
+
+ @Override
+ public void markFinalOperation() {
+ finalOperation = true;
+ }
+ }
+
/**
* Storage creation operation.
*/
- class CreateStorageOperation implements StorageOperation {
+ class CreateStorageOperation extends AbstractStorageOperation {
Review Comment:
At the moment it is used only in this package, if necessary, we will move it
to another package.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]