X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=dom%2Fmdsal-dom-spi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fdom%2Fspi%2Fstore%2FDOMStoreThreePhaseCommitCohort.java;fp=dom%2Fmdsal-dom-spi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fdom%2Fspi%2Fstore%2FDOMStoreThreePhaseCommitCohort.java;h=418dfa77c9c8c3b2064e0227c807e69930379de1;hb=6a192f0eeedc302ae0b506d04f9d79b34406aef5;hp=0000000000000000000000000000000000000000;hpb=9b7b45acaefe4c28deb087cffbe36503a4e44381;p=mdsal.git diff --git a/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/store/DOMStoreThreePhaseCommitCohort.java b/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/store/DOMStoreThreePhaseCommitCohort.java new file mode 100644 index 0000000000..418dfa77c9 --- /dev/null +++ b/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/store/DOMStoreThreePhaseCommitCohort.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.mdsal.dom.spi.store; + +import com.google.common.util.concurrent.ListenableFuture; + +/** + * Interface implemented by the {@link DOMStore} and exposed for each + * {@link DOMStoreWriteTransaction} upon its transition to Ready state. The frontend (DOMStore user) + * uses this interface to drive the commit procedure across potentially multiple DOMStores using the + * Three-Phase-Commit (3PC) Protocol, as described in Three phase Commit. + */ +public interface DOMStoreThreePhaseCommitCohort { + + /** + * Sends transaction associated with this three phase commit instance to the participant, + * participant votes on the transaction, if the transaction should be committed or aborted. + * + * @return ListenableFuture with vote of the participant. Vote {@link ListenableFuture#get()} is + * following: + * + */ + ListenableFuture canCommit(); + + /** + * Initiates a pre-commit phase of associated transaction on datastore. + * + * This message is valid only and only if and only if the participant responded + * on {@link #canCommit()} call with positive response. + * + * @return ListenableFuture representing acknowledgment for participant + * that pre-commit message was received and processed. + */ + ListenableFuture preCommit(); + + /** + * Initiates a abort phase of associated transaction on data store. + * + * @return ListenableFuture representing acknowledgment for participant + * that abort message was received. + */ + ListenableFuture abort(); + + /** + * Initiates a commit phase on of associated transaction on data store. + * + * @return ListenableFuture representing acknowledgment for participant + * that commit message was received and commit of transaction was + * processed. + */ + ListenableFuture commit(); +}