001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package org.apache.hadoop.hdfs.server.datanode.fsdataset;
019
020 import java.io.File;
021 import java.io.IOException;
022
023 import org.apache.hadoop.hdfs.StorageType;
024
025 /**
026 * This is an interface for the underlying volume.
027 */
028 public interface FsVolumeSpi {
029 /** @return the StorageUuid of the volume */
030 public String getStorageID();
031
032 /** @return a list of block pools. */
033 public String[] getBlockPoolList();
034
035 /** @return the available storage space in bytes. */
036 public long getAvailable() throws IOException;
037
038 /** @return the base path to the volume */
039 public String getBasePath();
040
041 /** @return the path to the volume */
042 public String getPath(String bpid) throws IOException;
043
044 /** @return the directory for the finalized blocks in the block pool. */
045 public File getFinalizedDir(String bpid) throws IOException;
046
047 public StorageType getStorageType();
048
049 /**
050 * Reserve disk space for an RBW block so a writer does not run out of
051 * space before the block is full.
052 */
053 public void reserveSpaceForRbw(long bytesToReserve);
054
055 /**
056 * Release disk space previously reserved for RBW block.
057 */
058 public void releaseReservedSpace(long bytesToRelease);
059
060 /** Returns true if the volume is NOT backed by persistent storage. */
061 public boolean isTransientStorage();
062 }