2 * Copyright (c) 2015 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
9 package org.opendaylight.controller.cluster.datastore;
11 import com.google.common.base.Optional;
14 import org.opendaylight.controller.cluster.datastore.utils.PruningDataTreeModification;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
18 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
20 class ShardDataTreeSnapshot implements DataTreeSnapshot {
22 private final DataTreeSnapshot dataTreeSnapshot;
23 private final Set<URI> validNamespaces;
25 public ShardDataTreeSnapshot(DataTreeSnapshot dataTreeSnapshot, Set<URI> validNamespaces) {
26 this.dataTreeSnapshot = dataTreeSnapshot;
27 this.validNamespaces = validNamespaces;
31 public Optional<NormalizedNode<?, ?>> readNode(YangInstanceIdentifier yangInstanceIdentifier) {
32 return this.dataTreeSnapshot.readNode(yangInstanceIdentifier);
36 public DataTreeModification newModification() {
37 return new PruningDataTreeModification(this.dataTreeSnapshot.newModification(), validNamespaces);