-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathEDQueue.h
More file actions
executable file
·53 lines (41 loc) · 1.36 KB
/
EDQueue.h
File metadata and controls
executable file
·53 lines (41 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// EDQueue.h
// queue
//
// Created by Andrew Sliwinski on 6/29/12.
// Copyright (c) 2012 Andrew Sliwinski. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, EDQueueResult) {
EDQueueResultSuccess = 0,
EDQueueResultFail,
EDQueueResultCritical
};
typedef void (^EDQueueCompletionBlock)(EDQueueResult result);
extern NSString *const EDQueueDidStart;
extern NSString *const EDQueueDidStop;
extern NSString *const EDQueueJobDidSucceed;
extern NSString *const EDQueueJobDidFail;
extern NSString *const EDQueueDidDrain;
@protocol EDQueueDelegate;
@interface EDQueue : NSObject
+ (EDQueue *)sharedInstance;
+ (NSString *)defaultPath;
- (id)initWithPath:(NSString *)path;
@property (nonatomic, weak) id<EDQueueDelegate> delegate;
@property (nonatomic, readonly) BOOL isRunning;
@property (nonatomic, readonly) BOOL isActive;
@property (nonatomic) NSUInteger retryLimit;
- (void)enqueueWithData:(id)data forTask:(NSString *)task;
- (void)start;
- (void)stop;
- (void)empty;
- (BOOL)jobExistsForTask:(NSString *)task;
- (BOOL)jobIsActiveForTask:(NSString *)task;
- (NSDictionary *)nextJobForTask:(NSString *)task;
@end
@protocol EDQueueDelegate <NSObject>
@optional
- (EDQueueResult)queue:(EDQueue *)queue processJob:(NSDictionary *)job;
- (void)queue:(EDQueue *)queue processJob:(NSDictionary *)job completion:(EDQueueCompletionBlock)block;
@end