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;
21 * The PruningShardDataTreeSnapshot returns a PruningDataTreeModification when a newModification is created
23 class PruningShardDataTreeSnapshot implements DataTreeSnapshot {
25 private final DataTreeSnapshot dataTreeSnapshot;
26 private final Set<URI> validNamespaces;
28 public PruningShardDataTreeSnapshot(DataTreeSnapshot dataTreeSnapshot, Set<URI> validNamespaces) {
29 this.dataTreeSnapshot = dataTreeSnapshot;
30 this.validNamespaces = validNamespaces;
34 public Optional<NormalizedNode<?, ?>> readNode(YangInstanceIdentifier yangInstanceIdentifier) {
35 return this.dataTreeSnapshot.readNode(yangInstanceIdentifier);
39 public DataTreeModification newModification() {
40 return new PruningDataTreeModification(this.dataTreeSnapshot.newModification(), validNamespaces);