Class HashFileProductStorage

  • All Implemented Interfaces:
    ProductStorage, Configurable

    public class HashFileProductStorage
    extends FileProductStorage
    Deprecated.
    A FileProductStorage that builds directory paths based on a SHA-1 hash of the product id. This helps overcome a limitation of the ext3 filesystem which limits the number of subdirectories any one directory may contain to 32000. This implementation should generate no more than 4096 (16 ^ 3) subdirectories of any one subdirectory. Note: no collision handling has been implemented, although hash collisions are not expected. Examples:
    Product ID: urn:usgs-product:us:shakemap:abcd1234:1304116272636
    SHA-1 hash: dde7b3986ee2fda8a793b599b6ae725ab35df58b
    Directory: shakemap/dde/7b3/986/ee2/fda/8a7/93b/599/b6a/e72/5ab/35d/f58/b

    Product ID: urn:usgs-product:us:shakemap2:efgh5678:1304116272711
    SHA-1 hash: 8174d0f8d961d48c8a94a6bd0ab2a882e01173c6
    Directory: shakemap2/817/4d0/f8d/961/d48/c8a/94a/6bd/0ab/2a8/82e/011/73c/6
    See Also:
    FileProductStorage
    • Field Detail

      • DIRECTORY_NAME_LENGTH

        public static final int DIRECTORY_NAME_LENGTH
        Deprecated.
        This is chosen because 16^3 = 4096 < 32000, which is the ext3 subdirectory limit.
        See Also:
        Constant Field Values
    • Constructor Detail

      • HashFileProductStorage

        public HashFileProductStorage()
        Deprecated.
        Basic Constructor Sets baseDirectory to FileProductsStorage' DEFAULT_DIRECTORY of 'Storage'
      • HashFileProductStorage

        public HashFileProductStorage​(java.io.File directory)
        Deprecated.
        Constructor taking in specific File directory
        Parameters:
        directory - base directory for storage path
    • Method Detail

      • getProductPath

        public java.lang.String getProductPath​(ProductId id)
        Deprecated.
        A method for subclasses to override the storage path. The returned path is appended to the base directory when storing and retrieving products.
        Overrides:
        getProductPath in class FileProductStorage
        Parameters:
        id - the product id to convert.
        Returns:
        the directory used to store id.