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 Type
    Method
    Description
    void
    Clean up any stale locks that are still present.
    boolean
    Check 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.
    void
    Set an instance if IdFactory to be used for creating identities and extracting them from uploadUris.
  • Method Details

    • lockUploadByUri

      UploadLock lockUploadByUri(String requestUri) throws TusException, IOException
      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 locked
      IOException
    • cleanupStaleLocks

      void cleanupStaleLocks() throws IOException
      Clean up any stale locks that are still present.
      Throws:
      IOException - When cleaning a stale lock fails
    • isLocked

      boolean isLocked(UploadId id)
      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

      void setIdFactory(UploadIdFactory idFactory)
      Set an instance if IdFactory to be used for creating identities and extracting them from uploadUris.
      Parameters:
      idFactory - The UploadIdFactory to use within this locking service