d982343fa322ef3d7fdf9d25254f8038721ca69a
[mdsal.git] / dom / mdsal-dom-spi / src / main / java / org / opendaylight / mdsal / dom / spi / store / SnapshotBackedTransaction.java
1 /*
2  * Copyright (c) 2018 Pantheon Technologies, s.r.o. 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.store;
9
10 import com.google.common.annotations.Beta;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNullByDefault;
13 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
14
15 /**
16  * Interface implemented by {@link DOMStoreTransaction}s which are backed by a {@link DataTreeSnapshot}.
17  *
18  * @author Robert Varga
19  */
20 @Beta
21 @NonNullByDefault
22 public interface SnapshotBackedTransaction extends DOMStoreTransaction {
23     /**
24      * Returns the {@link DataTreeSnapshot} underlying this transaction. If this transaction is no longer open,
25      * {@link Optional#empty()} is returned.
26      *
27      * @return DataTreeSnapshot attached to this transaction if this transaction is still open.
28      */
29     Optional<DataTreeSnapshot> getSnapshot();
30 }