2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.dom.spi.store;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.mdsal.common.api.CommitInfo;
12 import org.opendaylight.yangtools.yang.common.Empty;
15 * Interface implemented by the {@link DOMStore} and exposed for each
16 * {@link DOMStoreWriteTransaction} upon its transition to Ready state. The frontend (DOMStore user)
17 * uses this interface to drive the commit procedure across potentially multiple DOMStores using the
18 * Three-Phase-Commit (3PC) Protocol, as described in <a
19 * href="https://en.wikipedia.org/wiki/Three-phase_commit">Three phase Commit</a>.
21 public interface DOMStoreThreePhaseCommitCohort {
24 * Sends transaction associated with this three phase commit instance to the participant,
25 * participant votes on the transaction, if the transaction should be committed or aborted.
27 * @return ListenableFuture with vote of the participant. Vote {@link ListenableFuture#get()} is
31 * true if transaction is approved by data store.
32 * <li>false if the transaction is not approved by data store and should be aborted.
35 ListenableFuture<Boolean> canCommit();
38 * Initiates a pre-commit phase of associated transaction on datastore.
41 * This message is valid only and only if the participant responded
42 * on {@link #canCommit()} call with positive response.
44 * @return ListenableFuture representing acknowledgment for participant
45 * that pre-commit message was received and processed.
47 ListenableFuture<Empty> preCommit();
50 * Initiates a abort phase of associated transaction on data store.
52 * @return ListenableFuture representing acknowledgment for participant
53 * that abort message was received.
55 ListenableFuture<Empty> abort();
58 * Initiates a commit phase on of associated transaction on data store.
60 * @return ListenableFuture representing acknowledgment for participant
61 * that commit message was received and commit of transaction was
64 ListenableFuture<? extends CommitInfo> commit();