Package org.nuxeo.ecm.core.storage.dbs
Class DBSCachingRepository
java.lang.Object
org.nuxeo.ecm.core.storage.dbs.DBSCachingRepository
- All Implemented Interfaces:
LockManager
,Repository
,DBSRepository
The DBS Cache layer used to cache some method call of real repository
- Since:
- 8.10
-
Field Summary
Modifier and TypeFieldDescriptionprotected final DBSClusterInvalidator
protected final DBSRepositoryDescriptor
protected final DBSInvalidationsPropagator
protected static final String
protected static final String
protected final io.dropwizard.metrics5.MetricRegistry
Fields inherited from interface org.nuxeo.ecm.core.model.Repository
CAPABILITY_QUERY_BLOB_KEYS, CAPABILITY_REPOSITORY
-
Constructor Summary
ConstructorDescriptionDBSCachingRepository
(DBSRepository repository, DBSRepositoryDescriptor descriptor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears any cache held by the lock manager.void
Closes the lock manager and releases resources.protected DBSClusterInvalidator
createClusterInvalidator
(DBSRepositoryDescriptor descriptor) Gets the list of blob keys paths of all possible blobs in all schemas.Gets the blob manager.getCache()
getCapability
(String name) Gets the value of the given capability for this repository.protected DBSClusterInvalidator
Gets a new connection to this repository.Gets the fulltext configuration for this repository.protected DBSInvalidationsPropagator
Gets the lock on a document.Gets the lock manager for this repository.getName()
protected DBSClusterInvalidator
initClusterInvalidator
(DBSRepositoryDescriptor descriptor) protected DBSInvalidationsPropagator
Invalidations need to be propagated between connection caches only if there is such a cache, which is the case only if transactions are used.boolean
Checks if database-managed document change tokens are enabled.boolean
Checks if fulltext indexing (and search) is disabled.boolean
Checks if fulltext search is disabled.boolean
Checks if fulltext is stored in a blob.void
markReferencedBlobs
(BiConsumer<String, String> markerCallback) Marks the blobs in use by passing them to the provided callback (taking the blob key and the repository name).newCache
(boolean metrics) protected <T> com.google.common.cache.Cache<String,
T> newCache
(DBSRepositoryDescriptor descriptor) newChildCache
(boolean metrics) protected void
removeLock
(String id, String owner) Removes the lock from a document.Sets a lock on a document.void
shutdown()
boolean
Checks whether this repository supports transactions.void
Update repository capabilities after a migration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.ecm.core.model.Repository
getActiveSessionsCount, hasCapability
-
Field Details
-
METRIC_CACHE_NAME
- See Also:
-
METRIC_CHILD_CACHE_NAME
- See Also:
-
cache
-
childCache
-
descriptor
-
invalidationsPropagator
-
clusterInvalidator
-
registry
protected final io.dropwizard.metrics5.MetricRegistry registry
-
-
Constructor Details
-
DBSCachingRepository
-
-
Method Details
-
getCache
-
getChildCache
-
getInvalidationsPropagator
-
getClusterInvalidator
-
newCache
-
newChildCache
-
removeCacheMetrics
protected void removeCacheMetrics() -
newCache
-
initInvalidationsPropagator
Invalidations need to be propagated between connection caches only if there is such a cache, which is the case only if transactions are used. -
initClusterInvalidator
-
createClusterInvalidator
-
shutdown
public void shutdown()- Specified by:
shutdown
in interfaceRepository
-
getConnection
Description copied from interface:DBSRepository
Gets a new connection to this repository.- Specified by:
getConnection
in interfaceDBSRepository
- Returns:
- a new connection
-
supportsTransactions
public boolean supportsTransactions()Description copied from interface:DBSRepository
Checks whether this repository supports transactions.- Specified by:
supportsTransactions
in interfaceDBSRepository
- Returns:
true
if the repository supports transactions- See Also:
-
getBlobManager
Description copied from interface:DBSRepository
Gets the blob manager.- Specified by:
getBlobManager
in interfaceDBSRepository
- Returns:
- the blob manager.
-
getFulltextConfiguration
Description copied from interface:Repository
Gets the fulltext configuration for this repository.- Specified by:
getFulltextConfiguration
in interfaceRepository
-
isFulltextDisabled
public boolean isFulltextDisabled()Description copied from interface:DBSRepository
Checks if fulltext indexing (and search) is disabled.- Specified by:
isFulltextDisabled
in interfaceDBSRepository
- Returns:
true
if fulltext indexing is disabled,false
if it is enabled
-
isFulltextStoredInBlob
public boolean isFulltextStoredInBlob()Description copied from interface:DBSRepository
Checks if fulltext is stored in a blob.- Specified by:
isFulltextStoredInBlob
in interfaceDBSRepository
- Returns:
true
if fulltext is stored in a blob,false
if it is stored as a regular string
-
isFulltextSearchDisabled
public boolean isFulltextSearchDisabled()Description copied from interface:DBSRepository
Checks if fulltext search is disabled.- Specified by:
isFulltextSearchDisabled
in interfaceDBSRepository
- Returns:
true
if fulltext search is disabled,false
if it is enabled
-
isChangeTokenEnabled
public boolean isChangeTokenEnabled()Description copied from interface:DBSRepository
Checks if database-managed document change tokens are enabled.- Specified by:
isChangeTokenEnabled
in interfaceDBSRepository
- Returns:
true
if the database maintains document change tokens
-
getLockManager
Description copied from interface:DBSRepository
Gets the lock manager for this repository.- Specified by:
getLockManager
in interfaceDBSRepository
- Returns:
- the lock manager
-
getLock
Description copied from interface:LockManager
Gets the lock on a document.If the document does not exist,
null
is returned.- Specified by:
getLock
in interfaceLockManager
- Parameters:
id
- the document id- Returns:
- the existing lock, or
null
when there is no lock
-
setLock
Description copied from interface:LockManager
Sets a lock on a document.If the document is already locked, returns its existing lock status (there is no re-locking,
LockManager.removeLock(java.lang.String, java.lang.String)
must be called first).- Specified by:
setLock
in interfaceLockManager
- Parameters:
id
- the document idlock
- the lock to set- Returns:
null
if locking succeeded, or the existing lock if locking failed
-
removeLock
Description copied from interface:LockManager
Removes the lock from a document.The previous lock is returned.
If
owner
isnull
then the lock is unconditionally removed.If
owner
is notnull
, it must match the existing lock owner for the lock to be removed. If it doesn't match, the returned lock will returntrue
forLock.getFailed()
.- Specified by:
removeLock
in interfaceLockManager
- Parameters:
id
- the document idowner
- the owner to check, ornull
for no check- Returns:
- the previous lock (may be
null
), with a failed flag if locking failed
-
closeLockManager
public void closeLockManager()Description copied from interface:LockManager
Closes the lock manager and releases resources.- Specified by:
closeLockManager
in interfaceLockManager
-
clearLockManagerCaches
public void clearLockManagerCaches()Description copied from interface:LockManager
Clears any cache held by the lock manager.- Specified by:
clearLockManagerCaches
in interfaceLockManager
-
getName
- Specified by:
getName
in interfaceRepository
-
getSession
- Specified by:
getSession
in interfaceRepository
-
markReferencedBlobs
Description copied from interface:Repository
Marks the blobs in use by passing them to the provided callback (taking the blob key and the repository name).- Specified by:
markReferencedBlobs
in interfaceRepository
-
getCapability
Description copied from interface:Repository
Gets the value of the given capability for this repository.- Specified by:
getCapability
in interfaceRepository
-
getBlobKeysPaths
Description copied from interface:DBSRepository
Gets the list of blob keys paths of all possible blobs in all schemas.Each "path" is a list of path components. Example:
[[content, data], [files, file, data], ...]
- Specified by:
getBlobKeysPaths
in interfaceDBSRepository
-
updateCapabilities
public void updateCapabilities()Description copied from interface:DBSRepository
Update repository capabilities after a migration. Internal use only.- Specified by:
updateCapabilities
in interfaceDBSRepository
-