2 * Copyright (c) 2016 Cisco Systems, Inc. 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.controller.cluster.databroker.actors.dds;
10 import com.google.common.annotations.Beta;
11 import com.google.common.util.concurrent.FluentFuture;
12 import java.util.Optional;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
18 * Snapshot of the datastore state. Note this snapshot is not consistent across shards because sub-shard snapshots are
21 * @author Robert Varga
24 public class ClientSnapshot extends AbstractClientHandle<AbstractProxyTransaction> {
25 // Hidden to prevent outside instantiation
26 ClientSnapshot(final AbstractClientHistory parent, final TransactionIdentifier transactionId) {
27 super(parent, transactionId);
30 public FluentFuture<Boolean> exists(final YangInstanceIdentifier path) {
31 return ensureSnapshotProxy(path).exists(path);
34 public FluentFuture<Optional<NormalizedNode<?, ?>>> read(final YangInstanceIdentifier path) {
35 return ensureSnapshotProxy(path).read(path);
39 final AbstractProxyTransaction createProxy(final Long shard) {
40 return parent().createSnapshotProxy(getIdentifier(), shard);
43 private AbstractProxyTransaction ensureSnapshotProxy(final YangInstanceIdentifier path) {
44 return ensureProxy(path);