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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
atomicCopy
(Path source, Path dest) Does an atomic copy from source to dest.static void
atomicMove
(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 Path
getPathForKey
(String key) Gets the storage path for a given key.boolean
isTempFile
(Path path) Checks if the given file is a temporary fileprotected String
Converts a key to a safe path.protected String
safePathInverse
(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
null
if 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:
true
if 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
-