2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.restconf.nb.rfc8040.rests.transactions;
10 import com.google.common.annotations.Beta;
11 import com.google.common.util.concurrent.FluentFuture;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.mdsal.common.api.CommitInfo;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 * A handle to a set of operations being executed atomically on top of some backing store.
21 // FIXME: it seems the first two operations deal with lifecycle of a transaction, while others invoke various
22 // operations. This should be handled through proper allocation indirection.
24 public abstract class RestconfTransaction {
25 RestconfTransaction() {
30 * Rollback changes and unlock the datastore.
32 // FIXME: this looks synchronous, but it should not be
33 public abstract void cancel();
36 * Confirm previous operations.
38 * @return a FluentFuture containing the result of the commit information
40 public abstract FluentFuture<? extends @NonNull CommitInfo> commit();
43 * Delete data from the datastore.
45 * @param path the data object path
47 public abstract void delete(YangInstanceIdentifier path);
50 * Remove data from the datastore.
52 * @param path the data object path
54 public abstract void remove(YangInstanceIdentifier path);
57 * Merges a piece of data with the existing data at a specified path.
59 * @param path the data object path
60 * @param data the data object to be merged to the specified path
62 public abstract void merge(YangInstanceIdentifier path, NormalizedNode data);
65 * Stores a piece of data at the specified path.
67 * @param path the data object path
68 * @param data the data object to be merged to the specified path
69 * @param schemaContext static view of compiled yang files
71 public abstract void create(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext);
74 * Replace a piece of data at the specified path.
76 * @param path the data object path
77 * @param data the data object to be merged to the specified path
78 * @param schemaContext static view of compiled yang files
80 public abstract void replace(YangInstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext);