Clarify OWSOperation behavior (no behavioral changes)

pull/1/head
Michael Kirk 7 years ago
parent e05877a019
commit f277ae877c

@ -24,22 +24,26 @@ typedef NS_ENUM(NSInteger, OWSOperationState) {
// any of the errors were fatal. Fatal errors trump retryable errors. // any of the errors were fatal. Fatal errors trump retryable errors.
@interface OWSOperation : NSOperation @interface OWSOperation : NSOperation
@property (nullable) NSError *failingError; @property (readonly, nullable) NSError *failingError;
@property NSUInteger remainingRetries;
#pragma mark - Subclass Overrides // Defaults to 0, set to greater than 0 in init if you'd like the operation to be retryable.
@property NSUInteger remainingRetries;
// Called one time only #pragma mark - Mandatory Subclass Overrides
- (nullable NSError *)checkForPreconditionError;
// Called every retry, this is where the bulk of the operation's work should go. // Called every retry, this is where the bulk of the operation's work should go.
- (void)run; - (void)run;
#pragma mark - Optional Subclass Overrides
// Called one time only
- (nullable NSError *)checkForPreconditionError;
// Called at most one time. // Called at most one time.
- (void)didSucceed; - (void)didSucceed;
// Called at most one time, once retry is no longer possible. // Called at most one time, once retry is no longer possible.
- (void)didFailWithError:(NSError *)error; - (void)didFailWithError:(NSError *)error NS_SWIFT_NAME(didFail(error:));
#pragma mark - Success/Error - Do Not Override #pragma mark - Success/Error - Do Not Override

@ -13,6 +13,7 @@ NSString *const OWSOperationKeyIsFinished = @"isFinished";
@interface OWSOperation () @interface OWSOperation ()
@property (nullable) NSError *failingError;
@property (atomic) OWSOperationState operationState; @property (atomic) OWSOperationState operationState;
@property (nonatomic) OWSBackgroundTask *backgroundTask; @property (nonatomic) OWSBackgroundTask *backgroundTask;

Loading…
Cancel
Save