Class AbstractSharedCachingDataStore
java.lang.Object
org.apache.jackrabbit.core.data.AbstractDataStore
org.apache.jackrabbit.oak.plugins.blob.AbstractSharedCachingDataStore
- All Implemented Interfaces:
DataStore,MultiDataStoreAware,TypedDataStore,SharedDataStore
- Direct Known Subclasses:
CachingFileDataStore
public abstract class AbstractSharedCachingDataStore
extends AbstractDataStore
implements MultiDataStoreAware, SharedDataStore, TypedDataStore
Cache files locally and stage files locally for async uploads.
Configuration:
<DataStore class="org.apache.jackrabbit.oak.plugins.blob.AbstractCachingDataStore">
<param name="path"/>
<param name="cacheSize" value="68719476736"/>
<param name="stagingSplitPercentage" value="10"/>
<param name="uploadThreads" value="10"/>
<param name="stagingPurgeInterval" value="300"/>
<param name="stagingRetryInterval " value="600"/>
</DataStore>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jackrabbit.oak.plugins.blob.SharedDataStore
SharedDataStore.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.jackrabbit.oak.spi.blob.AbstractSharedBackendThe delegate backendprotected CompositeDataStoreCacheDataStore cacheprotected ExecutorServiceprotected org.apache.jackrabbit.guava.common.util.concurrent.ListeningExecutorServiceprotected ScheduledExecutorServiceFields inherited from class org.apache.jackrabbit.core.data.AbstractDataStore
DIGEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetadataRecord(File f, String name) Adds the root record.voidaddMetadataRecord(InputStream stream, String name) ------------------------ SharedDataStore methods -----------------------------------------addRecord(InputStream inputStream) addRecord(InputStream inputStream, org.apache.jackrabbit.oak.spi.blob.BlobOptions blobOptions) Add a record with specified options.void------------------------ unimplemented methods -------------------------------------------voidclose()protected abstract org.apache.jackrabbit.oak.spi.blob.AbstractSharedBackendvoiddeleteAllMetadataRecords(String prefix) Deletes all records matching the given prefix.intdeleteAllOlderThan(long l) booleandeleteMetadataRecord(String name) Deletes the root record represented by the given parameters.voiddeleteRecord(DataIdentifier dataIdentifier) booleanexists(DataIdentifier identifier) Look in the backend for a record matching the given identifier.In rare cases may include some duplicates in cases where async staged uploads complete during iteration.getAllMetadataRecords(String prefix) Gets the all root records.Retrieved an iterator over all DataRecords.protected CompositeDataStoreCachegetCache()getMetadataRecord(String name) Retrieves the metadata record with the given nameprotected byte[]getRecord(DataIdentifier identifier) getRecordForId(DataIdentifier identifier) Retrieves the record for the given identifier@Nullable DataRecordgetRecordIfStored(DataIdentifier dataIdentifier) getStats()getType()Gets the type.voidbooleanmetadataRecordExists(String name) Checks if the metadata record with the name existsvoidsetCacheSize(long cacheSize) void------------------------- setters ----------------------------------------------voidsetStagingPurgeInterval(int stagingPurgeInterval) voidsetStagingRetryInterval(int stagingRetryInterval) voidsetStagingSplitPercentage(int stagingSplitPercentage) voidsetStatisticsProvider(org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider) voidsetUploadThreads(int uploadThreads) voidupdateModifiedDateOnAccess(long l) Methods inherited from class org.apache.jackrabbit.core.data.AbstractDataStore
encodeHexString, getRecordFromReference, getReferenceFromIdentifierMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jackrabbit.core.data.DataStore
getMinRecordLengthMethods inherited from interface org.apache.jackrabbit.oak.plugins.blob.SharedDataStore
getRepositoryId, setRepositoryId
-
Field Details
-
cache
DataStore cache -
backend
protected org.apache.jackrabbit.oak.spi.blob.AbstractSharedBackend backendThe delegate backend -
listeningExecutor
protected org.apache.jackrabbit.guava.common.util.concurrent.ListeningExecutorService listeningExecutor -
schedulerExecutor
-
executor
-
-
Constructor Details
-
AbstractSharedCachingDataStore
public AbstractSharedCachingDataStore()
-
-
Method Details
-
init
- Specified by:
initin interfaceDataStore- Throws:
DataStoreException
-
createBackend
protected abstract org.apache.jackrabbit.oak.spi.blob.AbstractSharedBackend createBackend() -
getRecord
- Specified by:
getRecordin interfaceDataStore- Overrides:
getRecordin classAbstractDataStore- Throws:
DataStoreException
-
getRecordIfStored
@Nullable public @Nullable DataRecord getRecordIfStored(DataIdentifier dataIdentifier) throws DataStoreException - Specified by:
getRecordIfStoredin interfaceDataStore- Throws:
DataStoreException
-
addRecord
- Specified by:
addRecordin interfaceDataStore- Throws:
DataStoreException
-
addRecord
public DataRecord addRecord(InputStream inputStream, org.apache.jackrabbit.oak.spi.blob.BlobOptions blobOptions) throws DataStoreException Description copied from interface:TypedDataStoreAdd a record with specified options.- Specified by:
addRecordin interfaceTypedDataStore- Returns:
- Throws:
DataStoreException
-
getAllIdentifiers
In rare cases may include some duplicates in cases where async staged uploads complete during iteration.- Specified by:
getAllIdentifiersin interfaceDataStore- Returns:
- Iterator over all ids available
- Throws:
DataStoreException
-
deleteRecord
- Specified by:
deleteRecordin interfaceMultiDataStoreAware- Throws:
DataStoreException
-
close
- Specified by:
closein interfaceDataStore- Throws:
DataStoreException
-
exists
Look in the backend for a record matching the given identifier. Returns true if such a record exists.- Parameters:
identifier- - An identifier for the record.- Returns:
- true if a record for the provided identifier can be found.
-
getStats
-
getCache
-
setPath
------------------------- setters ---------------------------------------------- -
setCacheSize
public void setCacheSize(long cacheSize) -
setStagingSplitPercentage
public void setStagingSplitPercentage(int stagingSplitPercentage) -
setUploadThreads
public void setUploadThreads(int uploadThreads) -
setStagingPurgeInterval
public void setStagingPurgeInterval(int stagingPurgeInterval) -
setStagingRetryInterval
public void setStagingRetryInterval(int stagingRetryInterval) -
setStatisticsProvider
public void setStatisticsProvider(org.apache.jackrabbit.oak.stats.StatisticsProvider statisticsProvider) -
addMetadataRecord
------------------------ SharedDataStore methods ------------------------------------------ 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
-
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
-
getOrCreateReferenceKey
- Overrides:
getOrCreateReferenceKeyin classAbstractDataStore- Throws:
DataStoreException
-
clearInUse
public void clearInUse()------------------------ unimplemented methods -------------------------------------------- Specified by:
clearInUsein interfaceDataStore
-
updateModifiedDateOnAccess
public void updateModifiedDateOnAccess(long l) - Specified by:
updateModifiedDateOnAccessin interfaceDataStore
-
deleteAllOlderThan
- Specified by:
deleteAllOlderThanin interfaceDataStore- Throws:
DataStoreException
-