BUG-4202: Initial prototype of subshard aware Shard implementation
[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 javax.annotation.Nonnull;
13 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
14 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
15
16 // FIXME: this should be moved to a separate package
17 @Beta
18 public interface DOMDataTreeShardWriteTransaction {
19     /**
20      * Create a new write cursor. Any previous cursors have to be {@link DOMDataTreeWriteCursor#close()}d.
21      *
22      * @param prefix Tree identifier of the apex at which the cursor is rooted.
23      * @return A new cursor rooted at specified prefx.
24      * @throws IllegalStateException if a previous cursor has not been closed.
25      * @throws NullPointerException if prefix is null.
26      */
27     @Nonnull DOMDataTreeWriteCursor createCursor(@Nonnull DOMDataTreeIdentifier prefix);
28
29     /**
30      * Finish this transaction and submit it for processing.
31      *
32      * FIXME: this method should accept a callback which will report success/failure. Let's not use a CheckedFuture
33      *        due to overhead associated with attaching listeners to them.
34      * @throws IllegalStateException if this transaction has an unclosed cursor.
35      */
36     void ready();
37 }