DBTasksStorage

@interface DBTasksStorage : NSObject

Task storage for upload and download tasks.

Offers a convenient, thread-safe storage option for upload and download tasks so that they can be cancelled later.

  • Cancels all tasks stored in the object.

    Declaration

    Objective-C

    - (void)cancelAllTasks;

    Swift

    func cancelAllTasks()
  • Adds the upload task in a thread-safe manner.

    Note

    If cancelAllTasks has already been called, the task is not only not added, but it is cancelled as well.

    Declaration

    Objective-C

    - (void)addUploadTask:(DBUploadTask *)task;

    Swift

    func add(_ task: DBUploadTask<AnyObject, AnyObject>!)

    Parameters

    task

    The task to add.

  • Removes the upload task in a thread-safe manner.

    Declaration

    Objective-C

    - (void)removeUploadTask:(DBUploadTask *)task;

    Swift

    func remove(_ task: DBUploadTask<AnyObject, AnyObject>!)

    Parameters

    task

    The task to remove.

  • Adds the download to url task in a thread-safe manner.

    Note

    If cancelAllTasks has already been called, the task is not only not added, but it is cancelled as well.

    Declaration

    Objective-C

    - (void)addDownloadUrlTask:(DBDownloadUrlTask *)task;

    Swift

    func add(_ task: DBDownloadUrlTask<AnyObject, AnyObject>!)

    Parameters

    task

    The task to add.

  • Removes the download to url task in a thread-safe manner.

    Declaration

    Objective-C

    - (void)removeDownloadUrlTask:(DBDownloadUrlTask *)task;

    Swift

    func remove(_ task: DBDownloadUrlTask<AnyObject, AnyObject>!)

    Parameters

    task

    The task to remove.

  • Adds the download to data task in a thread-safe manner.

    Note

    If cancelAllTasks has already been called, the task is not only not added, but it is cancelled as well.

    Declaration

    Objective-C

    - (void)addDownloadDataTask:(DBDownloadDataTask *)task;

    Swift

    func add(_ task: DBDownloadDataTask<AnyObject, AnyObject>!)

    Parameters

    task

    The task to add.

  • Removes the download to data task in a thread-safe manner.

    Declaration

    Objective-C

    - (void)removeDownloadDataTask:(DBDownloadDataTask *)task;

    Swift

    func remove(_ task: DBDownloadDataTask<AnyObject, AnyObject>!)

    Parameters

    task

    The task to remove.

  • Determine whether there are tasks in progress.

    Declaration

    Objective-C

    - (BOOL)tasksInProgress;

    Swift

    func tasksInProgress() -> Bool

    Return Value

    Whether there are tasks in progress.