Package org.nuxeo.ecm.core.blob
Class KeyStrategyDigest
java.lang.Object
org.nuxeo.ecm.core.blob.KeyStrategyDigest
- All Implemented Interfaces:
KeyStrategy
Represents computation of blob keys based on a message digest.
When a maxSize threshold is configured, blobs strictly larger than the threshold get a UUIDv7 key instead of
a content-based digest key. This avoids unbounded digest computation for very large files (which can exceed Kafka
poll intervals when computed asynchronously).
- Since:
- 11.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWrite observer computing a digest.Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.blob.KeyStrategy
KeyStrategy.WriteObserver -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Stringfinal Patternfinal ByteSizeSize threshold.protected static final PatternUUIDv7 pattern: version digit7, variant bits10xx(hex digit in8|9|a|b).Fields inherited from interface org.nuxeo.ecm.core.blob.KeyStrategy
VER_SEP -
Constructor Summary
ConstructorsConstructorDescriptionKeyStrategyDigest(String digestAlgorithm) KeyStrategyDigest(String digestAlgorithm, ByteSize maxSize) -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBlobWriteContext(BlobContext blobContext) Gets the write context for the given blob.getDigestFromKey(String key) Gets, if possible, a digest from the key.protected static PatterngetDigestPattern(String digestAlgorithm) inthashCode()booleanprotected booleanisAboveThreshold(BlobContext blobContext) static booleanbooleanisValidDigest(String key) booleanisValidKey(String key) Does the given key have the expected pattern for this strategy.toString()booleanChecks whether this key strategy uses de-duplication.
-
Field Details
-
UUID_V7_PATTERN
UUIDv7 pattern: version digit7, variant bits10xx(hex digit in8|9|a|b).- Since:
- 2025.19
-
digestAlgorithm
-
digestPattern
-
maxSize
Size threshold. Blobs strictly larger than this size get a UUIDv7 key instead of a digest key.ByteSize.unlimited()disables the threshold (always use digest keys).- Since:
- 2025.19
-
-
Constructor Details
-
KeyStrategyDigest
-
KeyStrategyDigest
- Parameters:
digestAlgorithm- the digest algorithm (e.g.MD5)maxSize- the size threshold; blobs strictly larger than this get a UUIDv7 key.ByteSize.unlimited()disables the threshold (always use digest keys).- Since:
- 2025.19
-
-
Method Details
-
useDeDuplication
public boolean useDeDuplication()Description copied from interface:KeyStrategyChecks whether this key strategy uses de-duplication. When de-duplication is used, two blobs with identical contents have identical keys.- Specified by:
useDeDuplicationin interfaceKeyStrategy
-
getDigestFromKey
Description copied from interface:KeyStrategyGets, if possible, a digest from the key. This is not possible if the key is not derived from a digest.- Specified by:
getDigestFromKeyin interfaceKeyStrategy- Parameters:
key- the key- Returns:
- a digest, or
null
-
isValidDigest
-
getDigestPattern
-
getBlobWriteContext
Description copied from interface:KeyStrategyGets the write context for the given blob.- Specified by:
getBlobWriteContextin interfaceKeyStrategy
-
isAboveThreshold
- Returns:
trueif a threshold is configured and the blob is strictly larger than it- Since:
- 2025.19
-
hasThreshold
public boolean hasThreshold()- Returns:
trueif a finite size threshold is configured- Since:
- 2025.19
-
generateUUIDv7Key
- Since:
- 2025.19
-
isUUIDv7
- Returns:
trueif the given key matches the UUIDv7 format- Since:
- 2025.19
-
equals
-
hashCode
public int hashCode() -
toString
-
isValidKey
Description copied from interface:KeyStrategyDoes the given key have the expected pattern for this strategy.- Specified by:
isValidKeyin interfaceKeyStrategy
-