-
-
Notifications
You must be signed in to change notification settings - Fork 878
Added PFFileStagingController to manage staging. #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Since the delete is asynchronous - there is a potential race condition between copying/writing file to staging and nuking the directory - which could cause files to be lost. What do you think if we would decouple everything related to staging files into |
1ba3d65
to
fcdeecd
Compare
Fix tests and pass back. |
- (instancetype)init NS_UNAVAILABLE; | ||
- (instancetype)initWithDataSource:(id<PFFileManagerProvider>)dataSource NS_DESIGNATED_INITIALIZER; | ||
|
||
+ (instancetype)stagingControllerWithDataSource:(id<PFFileManagerProvider>)dataSource; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Maybe use controllerWithDataSource:
to be consistent with other controllers?
fcdeecd
to
27ec4d5
Compare
} | ||
|
||
- (void)tearDown { | ||
[[NSFileManager defaultManager] removeItemAtPath:[self temporaryDirectory] error:NULL]; | ||
[[PFFileManager removeItemAtPathAsync:[self temporaryDirectory]] waitUntilFinished]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was causing multiprocess file lock controller deadlocks :)
Few nits and an important piece about |
e10791b
to
d9e170e
Compare
This should fix tests. |
} | ||
|
||
@end | ||
|
||
@implementation PFFileController | ||
|
||
@synthesize fileStagingController=_fileStagingController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supernit: Add spaces around =
to be inline with style in other places.
Previously, our file staging code was not centralized, wasn't very efficient, and most importantly made testing & migration difficult. Fixes half of #18.
d9e170e
to
65b870e
Compare
Looks great, please ship. |
Added PFFileStagingController to manage staging.
Previously, our file staging code was not centralized, wasn't very efficient, and most importantly made testing & migration difficult.
Fixes half of #18.