denis-chudov commented on code in PR #946:
URL: https://github.com/apache/ignite-3/pull/946#discussion_r924764102


##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/storage/state/TxMetaStorage.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2022 GridGain Systems, Inc. and Contributors.
+ *
+ * Licensed under the GridGain Community Edition License (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     
https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ignite.internal.tx.storage.state;
+
+import java.nio.file.Path;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+import org.apache.ignite.internal.tx.TxMeta;
+
+/**
+ * Storage for transaction meta, {@link TxMeta}.
+ */
+public interface TxMetaStorage extends AutoCloseable {
+    /**
+     * Start the storage.
+     */
+    void start();
+
+    /**
+     * Whether the storage is started.
+     *
+     * @return {@code true} if the storage is started, {@code false} otherwise.
+     */
+    boolean isStarted();
+
+    /**
+     * Stop the storage.
+     */
+    void stop() throws Exception;
+
+    /**
+     * Get tx meta by tx id.
+     *
+     * @param txId Tx id.
+     * @return Tx meta.
+     */
+    TxMeta get(UUID txId);
+
+    /**
+     * Put the tx meta into the storage.
+     *
+     * @param txId Tx id.
+     * @param txMeta Tx meta.
+     */
+    void put(UUID txId, TxMeta txMeta);
+
+    /**
+     * Atomically change the tx meta in the storage.
+     *
+     * @param txId Tx id.
+     * @param txMetaExpected Tx meta that is expected to be in the storage.
+     * @param txMeta Tx meta.
+     * @return Whether the CAS operation is successful.
+     */
+    boolean compareAndSet(UUID txId, TxMeta txMetaExpected, TxMeta txMeta);

Review Comment:
   this is based on description of TxnStateManager in design document, it has 
`CompletableFuture<Boolean> changeState(UUID txId, TxState beforeState, TxState 
afterState)` method.



-- 
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]

Reply via email to