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,org.apache.jackrabbit.oak.spi.blob.BlobStore,org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore
public class DataStoreBlobStore
extends Object
implements DataStore, org.apache.jackrabbit.oak.spi.blob.BlobStore, org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore, BlobTrackingStore, TypedDataStore, org.apache.jackrabbit.oak.api.blob.BlobAccessProvider
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) DataStoreBlobStore(DataStore delegate, boolean encodeLengthInId) DataStoreBlobStore(DataStore delegate, boolean encodeLengthInId, int cacheSizeInMB) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetadataRecord(File f, String name) Adds the root record.voidaddMetadataRecord(InputStream stream, String name) Adds the root record.addRecord(InputStream stream) addRecord(InputStream input, org.apache.jackrabbit.oak.spi.blob.BlobOptions options) Add a record with specified options.voidaddTracker(BlobTracker tracker) Registers a tracker in the data store.voidvoidvoidclose()@Nullable org.apache.jackrabbit.oak.api.BlobcompleteBlobUpload(@NotNull String uploadToken) longcountDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) voiddeleteAllMetadataRecords(String prefix) Deletes all records matching the given prefix.intdeleteAllOlderThan(long min) booleandeleteChunks(List<String> chunkIds, long maxLastModifiedTime) booleandeleteMetadataRecord(String name) Deletes the root record represented by the given parameters.protected StringextractBlobId(String encodedBlobId) getAllChunkIds(long maxLastModifiedTime) getAllMetadataRecords(String prefix) Gets the all root records.Retrieved an iterator over all DataRecords.longgetBlobLength(String encodedBlobId) longorg.apache.jackrabbit.oak.cache.CacheStatsprotected DataRecordgetDataRecord(String blobId) @Nullable URIgetDownloadURI(@NotNull org.apache.jackrabbit.oak.api.Blob blob, @NotNull org.apache.jackrabbit.oak.api.blob.BlobDownloadOptions downloadOptions) getInputStream(String encodedBlobId) getMetadataRecord(String name) Retrieves the metadata record with the given nameintgetRecord(DataIdentifier identifier) getRecordForId(DataIdentifier identifier) Retrieves the record for the given identifiergetRecordFromReference(String reference) getRecordIfStored(DataIdentifier identifier) getReference(@NotNull String encodedBlobId) Returns the repository id (identifier for the repository in the DataStore)protected InputStream@Nullable BlobTrackerGets the traker registered in the data store.getType()Gets the type.void@Nullable org.apache.jackrabbit.oak.api.blob.BlobUploadinitiateBlobUpload(long maxUploadSizeInBytes, int maxNumberOfURIs) @Nullable org.apache.jackrabbit.oak.api.blob.BlobUploadinitiateBlobUpload(long maxUploadSizeInBytes, int maxNumberOfURIs, @NotNull org.apache.jackrabbit.oak.api.blob.BlobUploadOptions options) booleanmetadataRecordExists(String name) Checks if the metadata record with the name existsintresolveChunks(String blobId) voidsetBlobStatsCollector(org.apache.jackrabbit.oak.spi.blob.stats.BlobStatsCollector stats) voidsetBlockSize(int x) voidsetMaxCachedBinarySize(int maxCachedBinarySize) voidsetRepositoryId(String repositoryId) Sets the repository id to identify repository in the DataStorevoidintsweep()toString()voidupdateModifiedDateOnAccess(long before) writeBlob(InputStream stream) writeBlob(InputStream stream, org.apache.jackrabbit.oak.spi.blob.BlobOptions options)
-
Field Details
-
delegate
-
stats
protected org.apache.jackrabbit.oak.spi.blob.stats.BlobStatsCollector stats -
cache
-
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZE- See Also:
-
MEM_CACHE_NAME
- See Also:
-
-
Constructor Details
-
DataStoreBlobStore
-
DataStoreBlobStore
-
DataStoreBlobStore
-
-
Method Details
-
getRecordIfStored
- Specified by:
getRecordIfStoredin interfaceDataStore- Throws:
DataStoreException
-
getRecord
- Specified by:
getRecordin interfaceDataStore- Throws:
DataStoreException
-
getRecordFromReference
- Specified by:
getRecordFromReferencein interfaceDataStore- Throws:
DataStoreException
-
addRecord
- Specified by:
addRecordin interfaceDataStore- Throws:
DataStoreException
-
updateModifiedDateOnAccess
public void updateModifiedDateOnAccess(long before) - Specified by:
updateModifiedDateOnAccessin interfaceDataStore
-
deleteAllOlderThan
- Specified by:
deleteAllOlderThanin interfaceDataStore- Throws:
DataStoreException
-
getAllIdentifiers
- Specified by:
getAllIdentifiersin interfaceDataStore- Throws:
DataStoreException
-
init
- Specified by:
initin interfaceDataStore- Throws:
RepositoryException
-
getMinRecordLength
public int getMinRecordLength()- Specified by:
getMinRecordLengthin interfaceDataStore
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceDataStore- Throws:
DataStoreException
-
writeBlob
- Specified by:
writeBlobin interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore- Throws:
IOException
-
writeBlob
public String writeBlob(InputStream stream, org.apache.jackrabbit.oak.spi.blob.BlobOptions options) throws IOException - Specified by:
writeBlobin interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore- Throws:
IOException
-
readBlob
public int readBlob(String encodedBlobId, long pos, byte[] buff, int off, int length) throws IOException - Specified by:
readBlobin interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore- Throws:
IOException
-
getBlobLength
- Specified by:
getBlobLengthin interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore- Throws:
IOException
-
getBlobId
- Specified by:
getBlobIdin interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore
-
getReference
- Specified by:
getReferencein interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore
-
getInputStream
- Specified by:
getInputStreamin interfaceorg.apache.jackrabbit.oak.spi.blob.BlobStore- Throws:
IOException
-
setBlockSize
public void setBlockSize(int x) - Specified by:
setBlockSizein interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore
-
writeBlob
- Specified by:
writeBlobin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore- Throws:
IOException
-
sweep
- Specified by:
sweepin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore- Throws:
IOException
-
startMark
- Specified by:
startMarkin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore- Throws:
IOException
-
clearInUse
public void clearInUse()- Specified by:
clearInUsein interfaceDataStore- Specified by:
clearInUsein interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore
-
clearCache
public void clearCache()- Specified by:
clearCachein interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore
-
getBlockSizeMin
public long getBlockSizeMin()- Specified by:
getBlockSizeMinin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore
-
getAllChunkIds
- Specified by:
getAllChunkIdsin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore- Throws:
Exception
-
deleteChunks
- Specified by:
deleteChunksin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore- Throws:
Exception
-
countDeleteChunks
- Specified by:
countDeleteChunksin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore- Throws:
Exception
-
resolveChunks
- Specified by:
resolveChunksin interfaceorg.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore- Throws:
IOException
-
addMetadataRecord
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
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
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
Description copied from interface:SharedDataStoreChecks if the metadata record with the name exists- Specified by:
metadataRecordExistsin interfaceSharedDataStore- Returns:
-
getAllMetadataRecords
Description copied from interface:SharedDataStoreGets the all root records.- Specified by:
getAllMetadataRecordsin interfaceSharedDataStore- Returns:
- the all root records
-
deleteMetadataRecord
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
Description copied from interface:SharedDataStoreDeletes all records matching the given prefix.- Specified by:
deleteAllMetadataRecordsin interfaceSharedDataStore- Parameters:
prefix- metadata type identifier
-
setRepositoryId
Description copied from interface:SharedDataStoreSets the repository id to identify repository in the DataStore- Specified by:
setRepositoryIdin interfaceSharedDataStore- Throws:
DataStoreException
-
getRepositoryId
Description copied from interface:SharedDataStoreReturns the repository id (identifier for the repository in the DataStore)- Specified by:
getRepositoryIdin interfaceSharedDataStore- Returns:
- repository id
-
getAllRecords
Description copied from interface:SharedDataStoreRetrieved an iterator over all DataRecords.- Specified by:
getAllRecordsin interfaceSharedDataStore- Returns:
- iterator over DataRecords
- Throws:
DataStoreException
-
getRecordForId
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
Description copied from interface:SharedDataStoreGets the type.- Specified by:
getTypein interfaceSharedDataStore- Returns:
- the type
-
addRecord
public DataRecord addRecord(InputStream input, org.apache.jackrabbit.oak.spi.blob.BlobOptions options) throws DataStoreException Description copied from interface:TypedDataStoreAdd a record with specified options.- Specified by:
addRecordin interfaceTypedDataStore- Returns:
- Throws:
DataStoreException
-
toString
-
getDataStore
-
getCacheStats
public org.apache.jackrabbit.oak.cache.CacheStats getCacheStats() -
setMaxCachedBinarySize
public void setMaxCachedBinarySize(int maxCachedBinarySize) -
setBlobStatsCollector
public void setBlobStatsCollector(org.apache.jackrabbit.oak.spi.blob.stats.BlobStatsCollector stats) -
addTracker
Description copied from interface:BlobTrackingStoreRegisters a tracker in the data store.- Specified by:
addTrackerin interfaceBlobTrackingStore
-
getTracker
Description copied from interface:BlobTrackingStoreGets the traker registered in the data store.- Specified by:
getTrackerin interfaceBlobTrackingStore- Returns:
- tracker
-
getStream
- Throws:
IOException
-
getDataRecord
- Throws:
DataStoreException
-
extractBlobId
-
initiateBlobUpload
@Nullable public @Nullable org.apache.jackrabbit.oak.api.blob.BlobUpload initiateBlobUpload(long maxUploadSizeInBytes, int maxNumberOfURIs) throws IllegalArgumentException - 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 - Specified by:
initiateBlobUploadin interfaceorg.apache.jackrabbit.oak.api.blob.BlobAccessProvider- Throws:
IllegalArgumentException
-
completeBlobUpload
@Nullable public @Nullable org.apache.jackrabbit.oak.api.Blob completeBlobUpload(@NotNull @NotNull String uploadToken) throws IllegalArgumentException - Specified by:
completeBlobUploadin interfaceorg.apache.jackrabbit.oak.api.blob.BlobAccessProvider- Throws:
IllegalArgumentException
-
getDownloadURI
@Nullable public @Nullable URI getDownloadURI(@NotNull @NotNull org.apache.jackrabbit.oak.api.Blob blob, @NotNull @NotNull org.apache.jackrabbit.oak.api.blob.BlobDownloadOptions downloadOptions) - Specified by:
getDownloadURIin interfaceorg.apache.jackrabbit.oak.api.blob.BlobAccessProvider
-