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.protocol;
019
020/**
021 * Summarizes information about data volume failures on a DataNode.
022 */
023public class VolumeFailureSummary {
024  private final String[] failedStorageLocations;
025  private final long lastVolumeFailureDate;
026  private final long estimatedCapacityLostTotal;
027
028  /**
029   * Creates a new VolumeFailureSummary.
030   *
031   * @param failedStorageLocations storage locations that have failed
032   * @param lastVolumeFailureDate date/time of last volume failure in
033   *     milliseconds since epoch
034   * @param estimatedCapacityLostTotal estimate of capacity lost in bytes
035   */
036  public VolumeFailureSummary(String[] failedStorageLocations,
037      long lastVolumeFailureDate, long estimatedCapacityLostTotal) {
038    this.failedStorageLocations = failedStorageLocations;
039    this.lastVolumeFailureDate = lastVolumeFailureDate;
040    this.estimatedCapacityLostTotal = estimatedCapacityLostTotal;
041  }
042
043  /**
044   * Returns each storage location that has failed, sorted.
045   *
046   * @return each storage location that has failed, sorted
047   */
048  public String[] getFailedStorageLocations() {
049    return this.failedStorageLocations;
050  }
051
052  /**
053   * Returns the date/time of the last volume failure in milliseconds since
054   * epoch.
055   *
056   * @return date/time of last volume failure in milliseconds since epoch
057   */
058  public long getLastVolumeFailureDate() {
059    return this.lastVolumeFailureDate;
060  }
061
062  /**
063   * Returns estimate of capacity lost.  This is said to be an estimate, because
064   * in some cases it's impossible to know the capacity of the volume, such as if
065   * we never had a chance to query its capacity before the failure occurred.
066   *
067   * @return estimate of capacity lost in bytes
068   */
069  public long getEstimatedCapacityLostTotal() {
070    return this.estimatedCapacityLostTotal;
071  }
072}