FIRStorageTask_Private.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <FirebaseStorage/FIRStorageReference.h>
  17. #import <FirebaseStorage/FIRStorageTaskSnapshot.h>
  18. #import "FirebaseStorage/Sources/FIRStorageConstants_Private.h"
  19. #import "FirebaseStorage/Sources/FIRStorageErrors.h"
  20. #import "FirebaseStorage/Sources/FIRStorageReference_Private.h"
  21. #import "FirebaseStorage/Sources/FIRStorageTaskSnapshot_Private.h"
  22. #import "FirebaseStorage/Sources/FIRStorageUtils.h"
  23. #import <GTMSessionFetcher/GTMSessionFetcher.h>
  24. #import <GTMSessionFetcher/GTMSessionFetcherService.h>
  25. NS_ASSUME_NONNULL_BEGIN
  26. @interface FIRStorageTask ()
  27. /**
  28. * State for the current task in progress.
  29. */
  30. @property(atomic) FIRStorageTaskState state;
  31. /**
  32. * FIRStorageMetadata for the task in progress, or nil if none present.
  33. */
  34. @property(strong, nonatomic, nullable) FIRStorageMetadata *metadata;
  35. /**
  36. * Error which occurred during task execution, or nil if no error occurred.
  37. */
  38. @property(strong, nonatomic, nullable) NSError *error;
  39. /**
  40. * NSProgress object which tracks the progess of an observable task.
  41. */
  42. @property(strong, nonatomic) NSProgress *progress;
  43. /**
  44. * Reference pointing to the location the task is being performed against.
  45. */
  46. @property(strong, nonatomic) FIRStorageReference *reference;
  47. /**
  48. * A serial queue for all storage operations.
  49. */
  50. @property(nonatomic, readonly) dispatch_queue_t dispatchQueue;
  51. @property(strong, readwrite, nonatomic, nonnull) FIRStorageTaskSnapshot *snapshot;
  52. @property(readonly, copy, nonatomic) NSURLRequest *baseRequest;
  53. @property(strong, atomic) GTMSessionFetcher *fetcher;
  54. @property(readonly, nonatomic) GTMSessionFetcherService *fetcherService;
  55. @property(readonly, copy) GTMSessionFetcherCompletionHandler fetcherCompletion;
  56. - (instancetype)init NS_UNAVAILABLE;
  57. /**
  58. * Creates a new FIRStorageTask initialized with a FIRStorageReference and GTMSessionFetcherService.
  59. * @param reference A FIRStorageReference the task will be performed on.
  60. * @param service A GTMSessionFetcherService which provides the fetchers and configuration for
  61. * requests.
  62. * @param queue The shared queue to use for all Storage operations.
  63. * @return A new FIRStorageTask representing the current task.
  64. */
  65. - (instancetype)initWithReference:(FIRStorageReference *)reference
  66. fetcherService:(GTMSessionFetcherService *)service
  67. dispatchQueue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER;
  68. /** Dispatches a block on the shared Storage queue. */
  69. - (void)dispatchAsync:(void (^)(void))block;
  70. @end
  71. NS_ASSUME_NONNULL_END