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 */
018package org.apache.hadoop.hdfs.server.blockmanagement;
019
020import java.util.Map;
021
022import org.apache.hadoop.fs.StorageType;
023import org.apache.hadoop.hdfs.protocol.ClientProtocol;
024
025/** Datanode statistics */
026public interface DatanodeStatistics {
027
028  /** @return the total capacity */
029  public long getCapacityTotal();
030
031  /** @return the used capacity */
032  public long getCapacityUsed();
033
034  /** @return the percentage of the used capacity over the total capacity. */
035  public float getCapacityUsedPercent();
036
037  /** @return the remaining capacity */
038  public long getCapacityRemaining();
039
040  /** @return the percentage of the remaining capacity over the total capacity. */
041  public float getCapacityRemainingPercent();
042
043  /** @return the block pool used. */
044  public long getBlockPoolUsed();
045
046  /** @return the percentage of the block pool used space over the total capacity. */
047  public float getPercentBlockPoolUsed();
048  
049  /** @return the total cache capacity of all DataNodes */
050  public long getCacheCapacity();
051
052  /** @return the total cache used by all DataNodes */
053  public long getCacheUsed();
054
055  /** @return the xceiver count */
056  public int getXceiverCount();
057
058  /** @return average xceiver count for non-decommission(ing|ed) nodes */
059  public int getInServiceXceiverCount();
060  
061  /** @return number of non-decommission(ing|ed) nodes */
062  public int getNumDatanodesInService();
063  
064  /**
065   * @return the total used space by data nodes for non-DFS purposes
066   * such as storing temporary files on the local file system
067   */
068  public long getCapacityUsedNonDFS();
069
070  /** The same as {@link ClientProtocol#getStats()}.
071   * The block related entries are set to -1.
072   */
073  public long[] getStats();
074
075  /** @return the expired heartbeats */
076  public int getExpiredHeartbeats();
077
078  /** @return Storage Tier statistics*/
079  Map<StorageType, StorageTypeStats> getStorageTypeStats();
080}