Package org.nuxeo.ecm.core.blob
Class PathStrategy
java.lang.Object
org.nuxeo.ecm.core.blob.PathStrategy
- Direct Known Subclasses:
PathStrategyFlat,PathStrategyShortened,PathStrategySubDirs
Decides at what path a given key is stored.
- Since:
- 11.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidatomicCopy(Path source, Path dest) Does an atomic copy from source to dest.static voidatomicMove(Path source, Path dest) Does an atomic move from source to dest.Creates a temporary file in a location suitable for efficient move to the final path for any key.getKeyForPath(String path) Gets the key for a given storage path.abstract PathgetPathForKey(String key) Gets the storage path for a given key.booleanisTempFile(Path path) Checks if the given file is a temporary fileprotected StringConverts a key to a safe path.protected StringsafePathInverse(String path) Inverse ofsafePath(java.lang.String).
-
Field Details
-
dir
-
SAFE
-
HEX
protected static final char[] HEX
-
-
Constructor Details
-
PathStrategy
-
-
Method Details
-
safePath
Converts a key to a safe path.Different keys always map to different safe paths (no collision).
- Parameters:
key- the key- Returns:
- the safe path
- Since:
- 11.5
-
safePathInverse
Inverse ofsafePath(java.lang.String).- Parameters:
path- the safe path- Returns:
- the key, or
nullif the safe path is invalid - Since:
- 2021.8
-
createTempFile
Creates a temporary file in a location suitable for efficient move to the final path for any key.- Returns:
- the temporary file
-
isTempFile
Checks if the given file is a temporary file- Parameters:
path- the file- Returns:
trueif the file is a temporary file- Since:
- 11.5
-
getPathForKey
Gets the storage path for a given key.- Parameters:
key- the key- Returns:
- the file for this key
-
getKeyForPath
Gets the key for a given storage path.- Parameters:
path- the path- Returns:
- the key
-
atomicMove
Does an atomic move from source to dest.- Parameters:
source- the sourcedest- the destination- Throws:
IOException
-
atomicCopy
Does an atomic copy from source to dest.- Parameters:
source- the sourcedest- the destination- Throws:
IOException- Since:
- 11.5
-