6f81e941c7e62add8df8f2a857f1fcc1de2f467b
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / AsyncConfigurationCommitCohort.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.md.sal.common.api.data;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.yangtools.concepts.Path;
12
13 /**
14  * Three phase Commit Cohort for subtree, which is uniquely associated with user submitted transaction.
15  *
16  * @param <P>
17  *            Type of path (subtree identifier), which represents location in
18  *            tree
19  * @param <D>
20  *            Type of data (payload), which represents data payload
21  */
22 public interface AsyncConfigurationCommitCohort<P extends Path<P>, D> {
23
24     /**
25      * Initiates a pre-commit of associated request
26      *
27      * <p>
28      * Implementation MUST NOT do any blocking calls during this callback, all
29      * pre-commit preparation SHOULD happen asynchronously and MUST result in
30      * completing returned future object.
31      *
32      * @param rebasedTransaction
33      *            Read-only view of transaction as if happened on top of actual
34      *            data store
35      * @return Future which is completed once pre-commit phase for this request
36      *         is finished.
37      */
38     ListenableFuture<Void> preCommit(AsyncReadTransaction<P, D> rebasedTransaction);
39
40     /**
41      * Initiates a commit phase of associated request
42      *
43      * <p>
44      * Implementation MUST NOT do any blocking calls during this callback, all
45      * commit finalization SHOULD happen asynchronously and MUST result in
46      * completing returned future object.
47      *
48      * @return Future which is completed once commit phase for associated
49      *         request is finished.
50      */
51     ListenableFuture<Void> commit();
52
53     /**
54      * Initiates abort phase of associated request
55      *
56      * <p>
57      * Implementation MUST NOT do any blocking calls during this callback, all
58      * commit finalization SHOULD happen asynchronously and MUST result in
59      * completing returned future object.
60      *
61      * @return Future which is completed once commit phase for associated
62      *         request is finished.
63      */
64     ListenableFuture<Void> abort();
65
66 }