BUG-5280: remove support for talking to pre-Boron clients
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / ReadyLocalTransaction.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.datastore.messages;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.cluster.datastore.DataStoreVersions;
12 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
13
14 /**
15  * Message notifying the shard leader to apply modifications which have been
16  * prepared locally against its DataTree. This message is not directly serializable,
17  * simply because the leader and sender need to be on the same system. When it needs
18  * to be sent out to a remote system, it needs to be intercepted by {@link ReadyLocalTransactionSerializer}
19  * and turned into {@link BatchedModifications}.
20  */
21 public final class ReadyLocalTransaction {
22     private final DataTreeModification modification;
23     private final String transactionID;
24     private final boolean doCommitOnReady;
25
26     // The version of the remote system used only when needing to convert to BatchedModifications.
27     private short remoteVersion = DataStoreVersions.CURRENT_VERSION;
28
29     public ReadyLocalTransaction(final String transactionID, final DataTreeModification modification, final boolean doCommitOnReady) {
30         this.transactionID = Preconditions.checkNotNull(transactionID);
31         this.modification = Preconditions.checkNotNull(modification);
32         this.doCommitOnReady = doCommitOnReady;
33     }
34
35     public String getTransactionID() {
36         return transactionID;
37     }
38
39     public DataTreeModification getModification() {
40         return modification;
41     }
42
43     public boolean isDoCommitOnReady() {
44         return doCommitOnReady;
45     }
46
47     public short getRemoteVersion() {
48         return remoteVersion;
49     }
50
51     public void setRemoteVersion(short remoteVersion) {
52         this.remoteVersion = remoteVersion;
53     }
54 }