Package gov.usgs.earthquake.distribution
Class HashFileProductStorage
java.lang.Object
gov.usgs.util.DefaultConfigurable
gov.usgs.earthquake.distribution.FileProductStorage
gov.usgs.earthquake.distribution.HashFileProductStorage
- All Implemented Interfaces:
ProductStorage
,Configurable
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
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Deprecated.This is chosen because 16^3 = 4096 < 32000, which is the ext3 subdirectory limit.Fields inherited from class gov.usgs.earthquake.distribution.FileProductStorage
DEFAULT_DIRECTORY, DIRECTORY_PROPERTY_NAME, LEGACY_STORAGES_PROPERTY, STORAGE_LISTENER_PROPERTY, USE_HASH_PATHS_DEFAULT, USE_HASH_PATHS_PROPERTY
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Basic Constructor Sets baseDirectory to FileProductsStorage' DEFAULT_DIRECTORY of 'Storage'HashFileProductStorage
(File directory) Deprecated.Constructor taking in specific File directory -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.A method for subclasses to override the storage path.Methods inherited from class gov.usgs.earthquake.distribution.FileProductStorage
addStorageListener, configure, getBaseDirectory, getHashedProductPath, getInMemoryProduct, getKeychain, getLegacyStorages, getNormalProductPath, getProduct, getProductFile, getProductHandlerFormat, getProductSource, getProductSourceFormat, getStorageLocks, hasProduct, isRejectInvalidSignatures, isTestSignatures, notifyListeners, removeProduct, removeStorageListener, setBaseDirectory, setKeychain, setRejectInvalidSignatures, setTestSignatures, shutdown, startup, storeProduct, storeProductSource
Methods inherited from class gov.usgs.util.DefaultConfigurable
getName, setName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface gov.usgs.util.Configurable
getName, setName
-
Field Details
-
DIRECTORY_NAME_LENGTH
public static final int DIRECTORY_NAME_LENGTHDeprecated.This is chosen because 16^3 = 4096 < 32000, which is the ext3 subdirectory limit.- See Also:
-
-
Constructor Details
-
HashFileProductStorage
public HashFileProductStorage()Deprecated.Basic Constructor Sets baseDirectory to FileProductsStorage' DEFAULT_DIRECTORY of 'Storage' -
HashFileProductStorage
Deprecated.Constructor taking in specific File directory- Parameters:
directory
- base directory for storage path
-
-
Method Details
-
getProductPath
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 classFileProductStorage
- Parameters:
id
- the product id to convert.- Returns:
- the directory used to store id.
-