59fa4b0966315a94aebec176c3e5d105d5cd84ff
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / main / java / org / opendaylight / mdsal / dom / store / inmemory / DOMDataTreeShardWriteTransaction.java
1 /*
2  * Copyright (c) 2016 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
9 package org.opendaylight.mdsal.dom.store.inmemory;
10
11 import com.google.common.annotations.Beta;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import javax.annotation.Nonnull;
14 import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorProvider;
15 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
16 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
17
18 @Beta
19 public interface DOMDataTreeShardWriteTransaction extends DOMDataTreeCursorProvider {
20     /**
21      * Create a new write cursor. Any previous cursors have to be {@link DOMDataTreeWriteCursor#close()}d.
22      *
23      * @param prefix Tree identifier of the apex at which the cursor is rooted.
24      * @return A new cursor rooted at specified prefx.
25      * @throws IllegalStateException if a previous cursor has not been closed.
26      * @throws NullPointerException if prefix is null.
27      */
28     @Override
29     @Nonnull DOMDataTreeWriteCursor createCursor(@Nonnull DOMDataTreeIdentifier prefix);
30
31     /**
32      * Finish this transaction and submit it for processing.
33      *
34      * FIXME: this method should accept a callback which will report success/failure. Let's not use a CheckedFuture
35      *        due to overhead associated with attaching listeners to them.
36      * @throws IllegalStateException if this transaction has an unclosed cursor.
37      */
38     void ready();
39
40     /**
41      * Close this transaction and all other foreign shard transactions that were opened as a part of this transaction.
42      */
43     void close();
44
45     ListenableFuture<Void> submit();
46
47     ListenableFuture<Boolean> validate();
48
49     ListenableFuture<Void> prepare();
50
51     ListenableFuture<Void> commit();
52
53 }