Package me.desair.tus.server.upload
Interface UploadLockingService
- All Known Implementing Classes:
DiskLockingService,ThreadLocalCachedStorageAndLockingService
public interface UploadLockingService
Service interface that can lock a specific upload so that it cannot be modified by other
requests/threads.
-
Method Summary
Modifier and TypeMethodDescriptionvoidClean up any stale locks that are still present.booleanCheck if the upload with the given ID is currently locked.lockUploadByUri(String requestUri) If the given URI represents a valid upload, lock that upload for processing.voidsetIdFactory(UploadIdFactory idFactory) Set an instance if IdFactory to be used for creating identities and extracting them from uploadUris.
-
Method Details
-
lockUploadByUri
If the given URI represents a valid upload, lock that upload for processing.- Parameters:
requestUri- The URI that potentially represents an upload- Returns:
- The lock on the upload, or null if not lock was applied
- Throws:
TusException- If the upload is already lockedIOException
-
cleanupStaleLocks
Clean up any stale locks that are still present.- Throws:
IOException- When cleaning a stale lock fails
-
isLocked
Check if the upload with the given ID is currently locked.- Parameters:
id- The ID of the upload to check- Returns:
- True if the upload is locked, false otherwise
-
setIdFactory
Set an instance if IdFactory to be used for creating identities and extracting them from uploadUris.- Parameters:
idFactory- TheUploadIdFactoryto use within this locking service
-