*/
package org.opendaylight.controller.cluster.datastore.messages;
-import org.opendaylight.controller.cluster.datastore.modification.Modification;
-import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
+import static java.util.Objects.requireNonNull;
+
+import java.util.Optional;
+import java.util.SortedSet;
+import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
+import org.opendaylight.controller.cluster.datastore.ReadWriteShardDataTreeTransaction;
/**
* Transaction ReadyTransaction message that is forwarded to the local Shard from the ShardTransaction.
* @author Thomas Pantelis
*/
public class ForwardedReadyTransaction {
- private final String transactionID;
- private final DOMStoreThreePhaseCommitCohort cohort;
- private final Modification modification;
- private final boolean returnSerialized;
-
- public ForwardedReadyTransaction(String transactionID, DOMStoreThreePhaseCommitCohort cohort,
- Modification modification, boolean returnSerialized) {
- this.transactionID = transactionID;
- this.cohort = cohort;
- this.modification = modification;
- this.returnSerialized = returnSerialized;
+ private final TransactionIdentifier transactionId;
+ private final ReadWriteShardDataTreeTransaction transaction;
+ private final boolean doImmediateCommit;
+ private final short txnClientVersion;
+ private @Nullable final SortedSet<String> participatingShardNames;
+
+ public ForwardedReadyTransaction(TransactionIdentifier transactionId, short txnClientVersion,
+ ReadWriteShardDataTreeTransaction transaction, boolean doImmediateCommit,
+ Optional<SortedSet<String>> participatingShardNames) {
+ this.transactionId = requireNonNull(transactionId);
+ this.transaction = requireNonNull(transaction);
+ this.txnClientVersion = txnClientVersion;
+ this.doImmediateCommit = doImmediateCommit;
+ this.participatingShardNames = requireNonNull(participatingShardNames).orElse(null);
+ }
+
+ public TransactionIdentifier getTransactionId() {
+ return transactionId;
+ }
+ public ReadWriteShardDataTreeTransaction getTransaction() {
+ return transaction;
}
- public String getTransactionID() {
- return transactionID;
+ public short getTxnClientVersion() {
+ return txnClientVersion;
}
- public DOMStoreThreePhaseCommitCohort getCohort() {
- return cohort;
+ public boolean isDoImmediateCommit() {
+ return doImmediateCommit;
}
- public Modification getModification() {
- return modification;
+ public Optional<SortedSet<String>> getParticipatingShardNames() {
+ return Optional.ofNullable(participatingShardNames);
}
- public boolean isReturnSerialized() {
- return returnSerialized;
+ @Override
+ public String toString() {
+ return "ForwardedReadyTransaction [transactionId=" + transactionId + ", transaction=" + transaction
+ + ", doImmediateCommit=" + doImmediateCommit + ", participatingShardNames=" + participatingShardNames
+ + ", txnClientVersion=" + txnClientVersion + "]";
}
}