0ae5876c673431b720fd1dd6fbdac6c55ea928de
[mdsal.git] / dom / mdsal-dom-spi / src / main / java / org / opendaylight / mdsal / dom / spi / shard / DOMDataTreeShardProducer.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 package org.opendaylight.mdsal.dom.spi.shard;
9
10 import com.google.common.annotations.Beta;
11 import java.util.Collection;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
14 import org.opendaylight.yangtools.concepts.Registration;
15
16 @Beta
17 public interface DOMDataTreeShardProducer extends Registration {
18     /**
19      * Return the collection of tree identifiers to which this producer is bound. This collection
20      * is constant during the lifetime of a producer.
21      *
22      * @return Collection of data tree identifiers.
23      */
24     @NonNull Collection<DOMDataTreeIdentifier> getPrefixes();
25
26     /**
27      * Create a new write transaction for this producer. Any previous transactions need to be closed either via
28      * {@link DOMDataTreeShardWriteTransaction#ready()} or cancelled.
29      *
30      * @return A new write transaction
31      * @throws IllegalStateException if a previous transaction has not been closed
32      */
33     @NonNull DOMDataTreeShardWriteTransaction createTransaction();
34
35     /**
36      * Close this producer, releasing all resources. Default implementation does nothing, implementations should provide
37      * an implementation.
38      */
39     // FIXME: 4.0.0: make this method non-default
40     @Override
41     default void close() {
42
43     }
44 }