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.
@interface OWSOperation : NSOperation
@property (nullable) NSError *failingError;
@property NSUInteger remainingRetries;
@property (readonly, nullable) NSError *failingError;
#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
- (nullable NSError *)checkForPreconditionError;
#pragma mark - Mandatory Subclass Overrides
// Called every retry, this is where the bulk of the operation's work should go.
- (void)run;
#pragma mark - Optional Subclass Overrides
// Called one time only
- (nullable NSError *)checkForPreconditionError;
// Called at most one time.
- (void)didSucceed;
// 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

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

Loading…
Cancel
Save