mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
3560f3be5c
TODO -[x] respect order of queue -[x] replacements -[x] those w/o completion handler -[x] basic send+log operation persists -[x] send+ui completion -[x] share extension -[x] update state jobs -[x] App Lifecyle -[x] settable -[x] Mark as ready on startup -[x] Fail appropriate jobs on startup NICE TO HAVE -[x] concurrent per senders -[ ] longer retry (e.g. 24hrs) -[ ] App Lifecyle -[x] retry failed jobs on startup? -[ ] reachability DONE -[x] basic passing test -[x] datamodel -[x] queue/classes
57 lines
1.9 KiB
Objective-C
57 lines
1.9 KiB
Objective-C
//
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "TSYapDatabaseObject.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
extern NSErrorDomain const SSKJobRecordErrorDomain;
|
|
|
|
typedef NS_ERROR_ENUM(SSKJobRecordErrorDomain, JobRecordError){
|
|
JobRecordError_AssertionError = 100,
|
|
JobRecordError_IllegalStateTransition,
|
|
};
|
|
|
|
typedef NS_ENUM(NSUInteger, SSKJobRecordStatus) {
|
|
SSKJobRecordStatus_Unknown,
|
|
SSKJobRecordStatus_Ready,
|
|
SSKJobRecordStatus_Running,
|
|
SSKJobRecordStatus_PermanentlyFailed,
|
|
SSKJobRecordStatus_Obsolete
|
|
};
|
|
|
|
#pragma mark -
|
|
|
|
@interface SSKJobRecord : TSYapDatabaseObject
|
|
|
|
@property (nonatomic) NSUInteger failureCount;
|
|
@property (nonatomic) NSString *label;
|
|
|
|
- (instancetype)initWithLabel:(NSString *)label NS_DESIGNATED_INITIALIZER;
|
|
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
|
|
|
- (instancetype)initWithUniqueId:(NSString *_Nullable)uniqueId NS_UNAVAILABLE;
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
|
|
@property (readonly, nonatomic) SSKJobRecordStatus status;
|
|
@property (nonatomic, readonly) UInt64 sortId;
|
|
|
|
- (BOOL)saveAsStartedWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
|
error:(NSError **)outError NS_SWIFT_NAME(saveAsStarted(transaction:));
|
|
|
|
- (void)saveAsPermanentlyFailedWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
|
NS_SWIFT_NAME(saveAsPermanentlyFailed(transaction:));
|
|
|
|
- (void)saveAsObsoleteWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
|
NS_SWIFT_NAME(saveAsObsolete(transaction:));
|
|
|
|
- (BOOL)saveRunningAsReadyWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
|
error:(NSError **)outError NS_SWIFT_NAME(saveRunningAsReady(transaction:));
|
|
|
|
- (BOOL)addFailureWithWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
|
error:(NSError **)outError NS_SWIFT_NAME(addFailure(transaction:));
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|