CDS: Implement front-end support for local transactions
[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.yangtools.yang.data.api.schema.tree.DataTreeModification;
12
13 /**
14  * Message notifying the shard leader to apply modifications which have been
15  * prepared locally against its DataTree. This message is not directly serializable,
16  * simply because the leader and sender need to be on the same system. When it needs
17  * to be sent out to a remote system, it needs to be intercepted by {@link ReadyLocalTransactionSerializer}
18  * and turned into {@link BatchedModifications}.
19  */
20 public final class ReadyLocalTransaction {
21     private final DataTreeModification modification;
22     private final String transactionID;
23     private final boolean doCommitOnReady;
24
25     public ReadyLocalTransaction(final String transactionID, final DataTreeModification modification, final boolean doCommitOnReady) {
26         this.transactionID = Preconditions.checkNotNull(transactionID);
27         this.modification = Preconditions.checkNotNull(modification);
28         this.doCommitOnReady = doCommitOnReady;
29     }
30
31     public String getTransactionID() {
32         return transactionID;
33     }
34
35     public DataTreeModification getModification() {
36         return modification;
37     }
38
39     public boolean isDoCommitOnReady() {
40         return doCommitOnReady;
41     }
42 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.