Support multiple accounts. Bug fixes. Improve concurrency.
[pithos-macos] / pithos-macos / PithosSyncDaemon.h
index 9492c3a..4c60618 100644 (file)
 // or implied, of GRNET S.A.
 
 #import <Foundation/Foundation.h>
+@class PithosAccount;
 @class ASIPithos;
 @class PithosActivityFacility;
 @class ASINetworkQueue;
 
 @interface PithosSyncDaemon : NSObject {
     NSString *directoryPath;
-    ASIPithos *pithos;
+    PithosAccount *pithosAccount;
     NSString *containerName;
-    NSTimeInterval timeInterval;
+    ASIPithos *pithos;
 
     NSString *blockHash;
     NSUInteger blockSize;
     NSString *tempDownloadsDirPath;
     NSString *tempTrashDirPath;
     
+    BOOL daemonActive;
+    
     NSUInteger syncOperationCount;
     BOOL newSyncRequested;
     NSDate *lastCompletedSync;
     BOOL syncIncomplete;
+    BOOL syncLate;
     
     ASINetworkQueue *networkQueue;
-    dispatch_queue_t queue;
-    NSTimer *timer;
+    NSOperationQueue *callbackQueue;
     
     PithosActivityFacility *activityFacility;
 }
 
+@property (nonatomic, retain) NSString *directoryPath;
+@property (nonatomic, retain) PithosAccount *pithosAccount;
+@property (nonatomic, retain) NSString *containerName;
+@property (nonatomic, retain) ASIPithos *pithos;
+
 @property (nonatomic, retain) NSString *blockHash;
 @property (nonatomic, assign) NSUInteger blockSize;
 @property (nonatomic, retain) NSDate *lastModified;
@@ -78,8 +86,7 @@
 @property (nonatomic, retain) NSMutableDictionary *storedLocalObjectStates;
 @property (nonatomic, retain) NSMutableDictionary *currentLocalObjectStates;
 
-@property (nonatomic, readonly) NSString *directoryPath;
-@property (nonatomic, readonly) NSString *containerDirectoryPath;
+@property (nonatomic, retain) NSString *containerDirectoryPath;
 @property (nonatomic, readonly) NSString *pithosStateFilePath;
 @property (nonatomic, readonly) NSString *tempDownloadsDirPath;
 @property (nonatomic, readonly) NSString *tempTrashDirPath;
 @property (nonatomic, retain) NSDate *lastCompletedSync;
 
 - (id)initWithDirectoryPath:(NSString *)aDirectoryPath 
-                     pithos:(ASIPithos *)aPithos 
+              pithosAccount:(PithosAccount *)aPithosAccount 
               containerName:(NSString *)aContainerName 
-               timeInterval:(NSTimeInterval)aTimeInterval 
             resetLocalState:(BOOL)resetLocalState;
+
+- (void)resetDaemon;
+- (void)startDaemon;
+
 - (void)sync;
+- (BOOL)isSyncing;
+- (void)syncLate;
 
 @end