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.controller.sal.core.spi.data;
10 import com.google.common.util.concurrent.ListenableFuture;
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 {@link https://en.wikipedia.org/wiki/Three-phase_commit}.
18 public interface DOMStoreThreePhaseCommitCohort {
21 * Sends transaction associated with this three phase commit instance to the
22 * participant, participant votes on the transaction, if the transaction
23 * should be committed or aborted.
25 * @return ListenableFuture with vote of the participant. Vote
26 * {@link ListenableFuture#get()} is following:
29 * true if transaction is approved by data store.
30 * <li>false if the transaction is not approved by data store and
33 ListenableFuture<Boolean> canCommit();
36 * Initiates a pre-commit phase of associated transaction on datastore.
38 * This message is valid only and only if and only if the participant responded
39 * on {@link #canCommit()} call with positive response.
41 * @return ListenableFuture representing acknowledgment for participant
42 * that pre-commit message was received and processed.
44 ListenableFuture<Void> preCommit();
47 * Initiates a abort phase of associated transaction on data store.
49 * @return ListenableFuture representing acknowledgment for participant
50 * that abort message was received.
52 ListenableFuture<Void> abort();
55 * Initiates a commit phase on of associated transaction on data store.
57 * @return ListenableFuture representing acknowledgment for participant
58 * that commit message was received and commit of transaction was
61 ListenableFuture<Void> commit();