Deprecate all MD-SAL APIs
[controller.git] / opendaylight / md-sal / sal-dom-spi / src / main / java / org / opendaylight / controller / sal / core / spi / data / DOMStoreThreePhaseCommitCohort.java
1 /*
2  * Copyright (c) 2014 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.sal.core.spi.data;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11
12 /**
13  * Interface implemented by the {@link DOMStore} and exposed for each {@link DOMStoreWriteTransaction}
14  * upon its transition to Ready state. The frontend (DOMStore user) uses this interface to drive the
15  * commit procedure across potentially multiple DOMStores using the Three-Phase-Commit (3PC) Protocol,
16  * as described in <a href="https://en.wikipedia.org/wiki/Three-phase_commit">Three-Phase-Commit Protocol</a>.
17  *
18  * @deprecated Use {@link org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort} instead.
19  */
20 @Deprecated
21 public interface DOMStoreThreePhaseCommitCohort {
22
23     /**
24      * Sends transaction associated with this three phase commit instance to the
25      * participant, participant votes on the transaction, if the transaction
26      * should be committed or aborted.
27      *
28      * @return ListenableFuture with vote of the participant. Vote
29      *         {@link ListenableFuture#get()} is following:
30      *         <ul>
31      *         <li>
32      *         true if transaction is approved by data store.
33      *         <li>false if the transaction is not approved by data store and
34      *         should be aborted.
35      *         </ul>
36      */
37     ListenableFuture<Boolean> canCommit();
38
39     /**
40      * Initiates a pre-commit phase of associated transaction on datastore.
41      *
42      * <p>
43      * This message is valid only and only if and only if the participant responded
44      * on {@link #canCommit()} call with positive response.
45      *
46      * @return ListenableFuture representing acknowledgment for participant
47      *        that pre-commit message was received and processed.
48      */
49     ListenableFuture<Void> preCommit();
50
51     /**
52      * Initiates a abort phase of associated transaction on data store.
53      *
54      * @return ListenableFuture representing acknowledgment for participant
55      *        that abort message was received.
56      */
57     ListenableFuture<Void> abort();
58
59     /**
60      * Initiates a commit phase on of associated transaction on data store.
61      *
62      * @return ListenableFuture representing acknowledgment for participant
63      *        that commit message was received and commit of transaction was
64      *        processed.
65      */
66     ListenableFuture<Void> commit();
67 }