From a2d837b0e99965aa9e1dab4d8a89fb1a93d075a5 Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Sat, 20 Oct 2012 00:31:57 +0000 Subject: [PATCH] HDFS-4077. Adding a file missed in the commit r1400318. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2802@1400350 13f79535-47bb-0310-9956-ffa450edef68 --- .../snapshot/INodeDirectorySnapshottable.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/INodeDirectorySnapshottable.java diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/INodeDirectorySnapshottable.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/INodeDirectorySnapshottable.java new file mode 100644 index 0000000000..abbc9fceec --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/INodeDirectorySnapshottable.java @@ -0,0 +1,48 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hdfs.server.namenode.snapshot; + +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.hdfs.server.namenode.INodeDirectory; +import org.apache.hadoop.hdfs.server.namenode.INodeDirectoryWithQuota; + +/** Directories where taking snapshots is allowed. */ +@InterfaceAudience.Private +public class INodeDirectorySnapshottable extends INodeDirectoryWithQuota { + static public INodeDirectorySnapshottable newInstance(final INodeDirectory dir) { + long nsq = -1L; + long dsq = -1L; + + if (dir instanceof INodeDirectoryWithQuota) { + final INodeDirectoryWithQuota q = (INodeDirectoryWithQuota)dir; + nsq = q.getNsQuota(); + dsq = q.getDsQuota(); + } + return new INodeDirectorySnapshottable(nsq, dsq, dir); + } + + private INodeDirectorySnapshottable(long nsQuota, long dsQuota, + INodeDirectory dir) { + super(nsQuota, dsQuota, dir); + } + + @Override + public boolean isSnapshottable() { + return true; + } +}