Class DataStoreBlobStore
java.lang.Object
org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore
- All Implemented Interfaces:
AutoCloseable,DataStore,org.apache.jackrabbit.oak.api.blob.BlobAccessProvider,BlobTrackingStore,TypedDataStore,SharedDataStore,BlobStore,GarbageCollectableBlobStore
@Deprecated(since="2024-09-23")
public class DataStoreBlobStore
extends Object
implements DataStore, BlobStore, GarbageCollectableBlobStore, BlobTrackingStore, TypedDataStore, org.apache.jackrabbit.oak.api.blob.BlobAccessProvider
Deprecated.
The Jackrabbit Oak Blob Plugins library is designed for Oak-internal use only and thus deprecated. It will not be part of the AEM SDK after April 2025.
BlobStore wrapper for DataStore. Wraps Jackrabbit 2 DataStore and expose them as BlobStores
It also handles inlining binaries if there size is smaller than
DataStore.getMinRecordLength()-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.jackrabbit.oak.plugins.blob.SharedDataStore
SharedDataStore.Type -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDataStoreBlobStore(DataStore delegate) Deprecated.DataStoreBlobStore(DataStore delegate, boolean encodeLengthInId) Deprecated.DataStoreBlobStore(DataStore delegate, boolean encodeLengthInId, int cacheSizeInMB) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetadataRecord(File f, String name) Deprecated.Adds the root record.voidaddMetadataRecord(InputStream stream, String name) Deprecated.Adds the root record.addRecord(InputStream stream) Deprecated.Creates a new data record.addRecord(InputStream input, BlobOptions options) Deprecated.Add a record with specified options.voidaddTracker(BlobTracker tracker) Deprecated.Registers a tracker in the data store.voidDeprecated.Clear the cache.voidDeprecated.Clear the in-use list.voidclose()Deprecated.Close the data store@Nullable BlobcompleteBlobUpload(@NotNull String uploadToken) Deprecated.longcountDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) Deprecated.Deletes the blobs with the given ids.voiddeleteAllMetadataRecords(String prefix) Deprecated.Deletes all records matching the given prefix.intdeleteAllOlderThan(long min) Deprecated.Delete objects that have a modified date older than the specified date.booleandeleteChunks(List<String> chunkIds, long maxLastModifiedTime) Deprecated.Deletes the blobs with the given ids.booleandeleteMetadataRecord(String name) Deprecated.Deletes the root record represented by the given parameters.getAllChunkIds(long maxLastModifiedTime) Deprecated.Gets all the identifiers.Deprecated.Get all identifiers.getAllMetadataRecords(String prefix) Deprecated.Gets the all root records.Deprecated.Retrieved an iterator over all DataRecords.Deprecated.Returns the blobId that referred by the given binary reference.longgetBlobLength(String encodedBlobId) Deprecated.Get the length of the blob.longDeprecated.Get the minimum block size (if there is any).Deprecated.Deprecated.@Nullable URIgetDownloadURI(@NotNull Blob blob, @NotNull org.apache.jackrabbit.oak.api.blob.BlobDownloadOptions downloadOptions) Deprecated.getInputStream(String encodedBlobId) Deprecated.Returns a new stream for given blobId.getMetadataRecord(String name) Deprecated.Retrieves the metadata record with the given nameintDeprecated.Get the minimum size of an object that should be stored in this data store.getRecord(DataIdentifier identifier) Deprecated.Returns the identified data record.getRecordForId(DataIdentifier identifier) Deprecated.Retrieves the record for the given identifiergetRecordFromReference(String reference) Deprecated.Returns the record that matches the given binary reference.getRecordIfStored(DataIdentifier identifier) Deprecated.Check if a record for the given identifier exists, and return it if yes.getReference(@NotNull String encodedBlobId) Deprecated.Returns a secure reference to blob referred by blobid, ornullif no such reference is available.Deprecated.Returns the repository id (identifier for the repository in the DataStore)@Nullable BlobTrackerDeprecated.Gets the traker registered in the data store.getType()Deprecated.Gets the type.voidDeprecated.Initialized the data store@Nullable org.apache.jackrabbit.oak.api.blob.BlobUploadinitiateBlobUpload(long maxUploadSizeInBytes, int maxNumberOfURIs) Deprecated.@Nullable org.apache.jackrabbit.oak.api.blob.BlobUploadinitiateBlobUpload(long maxUploadSizeInBytes, int maxNumberOfURIs, @NotNull org.apache.jackrabbit.oak.api.blob.BlobUploadOptions options) Deprecated.booleanmetadataRecordExists(String name) Deprecated.Checks if the metadata record with the name existsintDeprecated.Read a number of bytes from a blob.resolveChunks(String blobId) Deprecated.Resolve chunks stored in the blob store from the given Id.voidDeprecated.voidsetBlockSize(int x) Deprecated.Set the block size used by this blob store, if the blob store splits binaries into blocks.voidsetMaxCachedBinarySize(int maxCachedBinarySize) Deprecated.voidsetRepositoryId(String repositoryId) Deprecated.Sets the repository id to identify repository in the DataStorevoidDeprecated.Start the mark phase.intsweep()Deprecated.Remove all unused blocks.toString()Deprecated.voidupdateModifiedDateOnAccess(long before) Deprecated.From now on, update the modified date of an object even when accessing it.writeBlob(InputStream stream) Deprecated.Write a blob from an input stream.writeBlob(InputStream stream, BlobOptions options) Deprecated.Write a blob from an input stream with specified options.Deprecated.Write a blob from a temporary file.
-
Field Details
-
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZEDeprecated.- See Also:
-
MEM_CACHE_NAME
Deprecated.- See Also:
-
-
Constructor Details
-
DataStoreBlobStore
Deprecated. -
DataStoreBlobStore
Deprecated. -
DataStoreBlobStore
Deprecated.
-
-
Method Details
-
getRecordIfStored
Deprecated.Description copied from interface:DataStoreCheck if a record for the given identifier exists, and return it if yes. If no record exists, this method returns null.- Specified by:
getRecordIfStoredin interfaceDataStore- Parameters:
identifier- data identifier- Returns:
- the record if found, and null if not
- Throws:
DataStoreException- if the data store could not be accessed
-
getRecord
Deprecated.Description copied from interface:DataStoreReturns the identified data record. The given identifier should be the identifier of a previously saved data record. Since records are never removed, there should never be cases where the identified record is not found. Abnormal cases like that are treated as errors and handled by throwing an exception.- Specified by:
getRecordin interfaceDataStore- Parameters:
identifier- data identifier- Returns:
- identified data record
- Throws:
DataStoreException- if the data store could not be accessed, or if the given identifier is invalid
-
getRecordFromReference
Deprecated.Description copied from interface:DataStoreReturns the record that matches the given binary reference. Returnsnullif the reference is invalid, for example if it points to a record that does not exist.- Specified by:
getRecordFromReferencein interfaceDataStore- Parameters:
reference- binary reference- Returns:
- matching record, or
null - Throws:
DataStoreException- if the data store could not be accessed
-
addRecord
Deprecated.Description copied from interface:DataStoreCreates a new data record. The given binary stream is consumed and a binary record containing the consumed stream is created and returned. If the same stream already exists in another record, then that record is returned instead of creating a new one.The given stream is consumed and not closed by this method. It is the responsibility of the caller to close the stream. A typical call pattern would be:
InputStream stream = ...; try { record = store.addRecord(stream); } finally { stream.close(); }- Specified by:
addRecordin interfaceDataStore- Parameters:
stream- binary stream- Returns:
- data record that contains the given stream
- Throws:
DataStoreException- if the data store could not be accessed
-
updateModifiedDateOnAccess
public void updateModifiedDateOnAccess(long before) Deprecated.Description copied from interface:DataStoreFrom now on, update the modified date of an object even when accessing it. Usually, the modified date is only updated when creating a new object, or when a new link is added to an existing object. When this setting is enabled, even getLength() will update the modified date.- Specified by:
updateModifiedDateOnAccessin interfaceDataStore- Parameters:
before- - update the modified date to the current time if it is older than this value
-
deleteAllOlderThan
Deprecated.Description copied from interface:DataStoreDelete objects that have a modified date older than the specified date.- Specified by:
deleteAllOlderThanin interfaceDataStore- Parameters:
min- the minimum time- Returns:
- the number of data records deleted
- Throws:
DataStoreException
-
getAllIdentifiers
Deprecated.Description copied from interface:DataStoreGet all identifiers.- Specified by:
getAllIdentifiersin interfaceDataStore- Returns:
- an iterator over all DataIdentifier objects
- Throws:
DataStoreException- if the list could not be read
-
init
Deprecated.Description copied from interface:DataStoreInitialized the data store- Specified by:
initin interfaceDataStore- Parameters:
homeDir- the home directory of the repository- Throws:
RepositoryException
-
getMinRecordLength
public int getMinRecordLength()Deprecated.Description copied from interface:DataStoreGet the minimum size of an object that should be stored in this data store. Depending on the overhead and configuration, each store may return a different value.- Specified by:
getMinRecordLengthin interfaceDataStore- Returns:
- the minimum size in bytes
-
close
Deprecated.Description copied from interface:DataStoreClose the data store- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDataStore- Throws:
DataStoreException- if a problem occurred
-
writeBlob
Deprecated.Description copied from interface:BlobStoreWrite a blob from an input stream. This method closes the input stream.- Specified by:
writeBlobin interfaceBlobStore- Parameters:
stream- the input stream- Returns:
- the blob id
- Throws:
IOException
-
writeBlob
Deprecated.Description copied from interface:BlobStoreWrite a blob from an input stream with specified options. This method closes the input stream.- Specified by:
writeBlobin interfaceBlobStore- Parameters:
stream- the input stream to writeoptions- the options to use- Returns:
- Throws:
IOException
-
readBlob
public int readBlob(String encodedBlobId, long pos, byte[] buff, int off, int length) throws IOException Deprecated.Description copied from interface:BlobStoreRead a number of bytes from a blob.- Specified by:
readBlobin interfaceBlobStore- Parameters:
encodedBlobId- the blob idpos- the position within the blobbuff- the target byte arrayoff- the offset within the target arraylength- the number of bytes to read- Returns:
- the number of bytes read
- Throws:
IOException
-
getBlobLength
Deprecated.Description copied from interface:BlobStoreGet the length of the blob.- Specified by:
getBlobLengthin interfaceBlobStore- Parameters:
encodedBlobId- the blob id- Returns:
- the length
- Throws:
IOException
-
getBlobId
Deprecated.Description copied from interface:BlobStoreReturns the blobId that referred by the given binary reference. Returnsnullif the reference is invalid, for example if it points to a blob that does not exist. -
getReference
Deprecated.Description copied from interface:BlobStoreReturns a secure reference to blob referred by blobid, ornullif no such reference is available.- Specified by:
getReferencein interfaceBlobStore- Parameters:
encodedBlobId- blobId referring the blob for which reference is required- Returns:
- binary reference, or
null
-
getInputStream
Deprecated.Description copied from interface:BlobStoreReturns a new stream for given blobId. The streams returned from multiple calls to this method are byte wise equals. That is, subsequent calls toreadreturn the same sequence of bytes as long as neither call throws an exception.- Specified by:
getInputStreamin interfaceBlobStore- Parameters:
encodedBlobId- the blob id- Returns:
- a new stream for given blobId
- Throws:
IOException
-
setBlockSize
public void setBlockSize(int x) Deprecated.Description copied from interface:GarbageCollectableBlobStoreSet the block size used by this blob store, if the blob store splits binaries into blocks. If not, this setting is ignored.- Specified by:
setBlockSizein interfaceGarbageCollectableBlobStore- Parameters:
x- the block size in bytes.
-
writeBlob
Deprecated.Description copied from interface:GarbageCollectableBlobStoreWrite a blob from a temporary file. The temporary file is removed afterwards. A file based blob stores might simply rename the file, so that no additional writes are necessary.- Specified by:
writeBlobin interfaceGarbageCollectableBlobStore- Parameters:
tempFileName- the temporary file name- Returns:
- the blob id
- Throws:
IOException
-
sweep
Deprecated.Description copied from interface:GarbageCollectableBlobStoreRemove all unused blocks.- Specified by:
sweepin interfaceGarbageCollectableBlobStore- Returns:
- the number of removed blocks
- Throws:
IOException
-
startMark
Deprecated.Description copied from interface:GarbageCollectableBlobStoreStart the mark phase.- Specified by:
startMarkin interfaceGarbageCollectableBlobStore- Throws:
IOException
-
clearInUse
public void clearInUse()Deprecated.Description copied from interface:DataStoreClear the in-use list. This is only used for testing to make the the garbage collection think that objects are no longer in use.- Specified by:
clearInUsein interfaceDataStore- Specified by:
clearInUsein interfaceGarbageCollectableBlobStore
-
clearCache
public void clearCache()Deprecated.Description copied from interface:GarbageCollectableBlobStoreClear the cache.- Specified by:
clearCachein interfaceGarbageCollectableBlobStore
-
getBlockSizeMin
public long getBlockSizeMin()Deprecated.Description copied from interface:GarbageCollectableBlobStoreGet the minimum block size (if there is any).- Specified by:
getBlockSizeMinin interfaceGarbageCollectableBlobStore- Returns:
- the block size
-
getAllChunkIds
Deprecated.Description copied from interface:GarbageCollectableBlobStoreGets all the identifiers.- Specified by:
getAllChunkIdsin interfaceGarbageCollectableBlobStore- Parameters:
maxLastModifiedTime- the max last modified time to consider for retrieval, with the special value '0' meaning no filtering by time- Returns:
- the identifiers
- Throws:
Exception- the exception
-
deleteChunks
Deprecated.Description copied from interface:GarbageCollectableBlobStoreDeletes the blobs with the given ids.- Specified by:
deleteChunksin interfaceGarbageCollectableBlobStore- Parameters:
chunkIds- the chunk idsmaxLastModifiedTime- the max last modified time to consider for retrieval, with the special value '0' meaning no filtering by time- Returns:
- true, if successful
- Throws:
Exception- the exception
-
countDeleteChunks
Deprecated.Description copied from interface:GarbageCollectableBlobStoreDeletes the blobs with the given ids.- Specified by:
countDeleteChunksin interfaceGarbageCollectableBlobStore- Parameters:
chunkIds- the chunk idsmaxLastModifiedTime- the max last modified time to consider for retrieval, with the special value '0' meaning no filtering by time- Returns:
- long the count of successful deletions
- Throws:
Exception- the exception
-
resolveChunks
Deprecated.Description copied from interface:GarbageCollectableBlobStoreResolve chunks stored in the blob store from the given Id. This will not return any chunks stored in-line in the id.- Specified by:
resolveChunksin interfaceGarbageCollectableBlobStore- Parameters:
blobId- the blob id- Returns:
- the iterator
- Throws:
IOException- Signals that an I/O exception has occurred.
-
addMetadataRecord
Deprecated.Description copied from interface:SharedDataStoreAdds the root record.- Specified by:
addMetadataRecordin interfaceSharedDataStore- Parameters:
stream- the streamname- the name of the root record- Throws:
DataStoreException- the data store exception
-
addMetadataRecord
Deprecated.Description copied from interface:SharedDataStoreAdds the root record.- Specified by:
addMetadataRecordin interfaceSharedDataStore- Parameters:
f- the filename- the name of the root record- Throws:
DataStoreException- the data store exception
-
getMetadataRecord
Deprecated.Description copied from interface:SharedDataStoreRetrieves the metadata record with the given name- Specified by:
getMetadataRecordin interfaceSharedDataStore- Parameters:
name- the name of the record- Returns:
-
metadataRecordExists
Deprecated.Description copied from interface:SharedDataStoreChecks if the metadata record with the name exists- Specified by:
metadataRecordExistsin interfaceSharedDataStore- Parameters:
name-- Returns:
-
getAllMetadataRecords
Deprecated.Description copied from interface:SharedDataStoreGets the all root records.- Specified by:
getAllMetadataRecordsin interfaceSharedDataStore- Returns:
- the all root records
-
deleteMetadataRecord
Deprecated.Description copied from interface:SharedDataStoreDeletes the root record represented by the given parameters.- Specified by:
deleteMetadataRecordin interfaceSharedDataStore- Parameters:
name- the name of the root record- Returns:
- success/failure
-
deleteAllMetadataRecords
Deprecated.Description copied from interface:SharedDataStoreDeletes all records matching the given prefix.- Specified by:
deleteAllMetadataRecordsin interfaceSharedDataStore- Parameters:
prefix- metadata type identifier
-
setRepositoryId
Deprecated.Description copied from interface:SharedDataStoreSets the repository id to identify repository in the DataStore- Specified by:
setRepositoryIdin interfaceSharedDataStore- Parameters:
repositoryId-- Throws:
DataStoreException
-
getRepositoryId
Deprecated.Description copied from interface:SharedDataStoreReturns the repository id (identifier for the repository in the DataStore)- Specified by:
getRepositoryIdin interfaceSharedDataStore- Returns:
- repository id
-
getAllRecords
Deprecated.Description copied from interface:SharedDataStoreRetrieved an iterator over all DataRecords.- Specified by:
getAllRecordsin interfaceSharedDataStore- Returns:
- iterator over DataRecords
- Throws:
DataStoreException
-
getRecordForId
Deprecated.Description copied from interface:SharedDataStoreRetrieves the record for the given identifier- Specified by:
getRecordForIdin interfaceSharedDataStore- Parameters:
identifier- the if of the record- Returns:
- data record
- Throws:
DataStoreException
-
getType
Deprecated.Description copied from interface:SharedDataStoreGets the type.- Specified by:
getTypein interfaceSharedDataStore- Returns:
- the type
-
addRecord
Deprecated.Description copied from interface:TypedDataStoreAdd a record with specified options.- Specified by:
addRecordin interfaceTypedDataStore- Parameters:
input-options-- Returns:
- Throws:
DataStoreException
-
toString
Deprecated. -
getDataStore
Deprecated. -
getCacheStats
Deprecated. -
setMaxCachedBinarySize
public void setMaxCachedBinarySize(int maxCachedBinarySize) Deprecated. -
setBlobStatsCollector
Deprecated. -
addTracker
Deprecated.Description copied from interface:BlobTrackingStoreRegisters a tracker in the data store.- Specified by:
addTrackerin interfaceBlobTrackingStore- Parameters:
tracker-
-
getTracker
Deprecated.Description copied from interface:BlobTrackingStoreGets the traker registered in the data store.- Specified by:
getTrackerin interfaceBlobTrackingStore- Returns:
- tracker
-
initiateBlobUpload
@Nullable public @Nullable org.apache.jackrabbit.oak.api.blob.BlobUpload initiateBlobUpload(long maxUploadSizeInBytes, int maxNumberOfURIs) throws IllegalArgumentException Deprecated.- Specified by:
initiateBlobUploadin interfaceorg.apache.jackrabbit.oak.api.blob.BlobAccessProvider- Throws:
IllegalArgumentException
-
initiateBlobUpload
@Nullable public @Nullable org.apache.jackrabbit.oak.api.blob.BlobUpload initiateBlobUpload(long maxUploadSizeInBytes, int maxNumberOfURIs, @NotNull @NotNull org.apache.jackrabbit.oak.api.blob.BlobUploadOptions options) throws IllegalArgumentException Deprecated.- Specified by:
initiateBlobUploadin interfaceorg.apache.jackrabbit.oak.api.blob.BlobAccessProvider- Throws:
IllegalArgumentException
-
completeBlobUpload
@Nullable public @Nullable Blob completeBlobUpload(@NotNull @NotNull String uploadToken) throws IllegalArgumentException Deprecated.- Specified by:
completeBlobUploadin interfaceorg.apache.jackrabbit.oak.api.blob.BlobAccessProvider- Throws:
IllegalArgumentException
-
getDownloadURI
@Nullable public @Nullable URI getDownloadURI(@NotNull @NotNull Blob blob, @NotNull @NotNull org.apache.jackrabbit.oak.api.blob.BlobDownloadOptions downloadOptions) Deprecated.- Specified by:
getDownloadURIin interfaceorg.apache.jackrabbit.oak.api.blob.BlobAccessProvider
-