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
019package org.apache.hadoop.fs;
020
021import org.apache.hadoop.classification.InterfaceAudience;
022import org.apache.hadoop.classification.InterfaceStability;
023
024/**
025 * A storage policy specifies the placement of block replicas on specific
026 * storage types.
027 */
028@InterfaceAudience.Public
029@InterfaceStability.Stable
030public interface BlockStoragePolicySpi {
031
032  /**
033   * Return the name of the storage policy. Policies are uniquely
034   * identified by name.
035   *
036   * @return the name of the storage policy.
037   */
038  String getName();
039
040  /**
041   * Return the preferred storage types associated with this policy. These
042   * storage types are used sequentially for successive block replicas.
043   *
044   * @return preferred storage types used for placing block replicas.
045   */
046  StorageType[] getStorageTypes();
047
048  /**
049   * Get the fallback storage types for creating new block replicas. Fallback
050   * storage types are used if the preferred storage types are not available.
051   *
052   * @return fallback storage types for new block replicas..
053   */
054  StorageType[] getCreationFallbacks();
055
056  /**
057   * Get the fallback storage types for replicating existing block replicas.
058   * Fallback storage types are used if the preferred storage types are not
059   * available.
060   *
061   * @return fallback storage types for replicating existing block replicas.
062   */
063  StorageType[] getReplicationFallbacks();
064
065  /**
066   * Returns true if the policy is inherit-only and cannot be changed for
067   * an existing file.
068   *
069   * @return true if the policy is inherit-only.
070   */
071  boolean isCopyOnCreateFile();
072}