forked from microsoft/appcenter-sdk-apple
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/fix-build-errors-with-xcode10.2
- Loading branch information
Showing
27 changed files
with
1,516 additions
and
750 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
AppCenterDataStorage/AppCenterDataStorage/Internal/Client/MSDataOperationProxy.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "MSBaseOptions.h" | ||
#import "MSDataStore.h" | ||
#import "MSDocumentStore.h" | ||
#import "MSTokensResponse.h" | ||
#import "MS_Reachability.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
typedef void (^MSCachedTokenCompletionHandler)(MSTokensResponse *_Nullable tokensResponse, NSError *_Nullable error); | ||
|
||
/** | ||
* Class responsible for the core logic between offline and remote calls. | ||
*/ | ||
@interface MSDataOperationProxy : NSObject | ||
|
||
/** | ||
* Data store. | ||
*/ | ||
@property(nonatomic, nonnull) id<MSDocumentStore> documentStore; | ||
|
||
/** | ||
* Network state helper. | ||
*/ | ||
@property(nonatomic) MS_Reachability *reachability; | ||
|
||
/** | ||
* Initialize a `MSDataOperationProxy` instance. | ||
* | ||
* @param documentStore The document store instance. | ||
* @param reachability Network state helper. | ||
* | ||
* @return A new `MSDataOperationProxy` instance. | ||
*/ | ||
- (instancetype)initWithDocumentStore:(id<MSDocumentStore>)documentStore reachability:(MS_Reachability *)reachability; | ||
|
||
/** | ||
* Perform an operation for a given partition/document | ||
* using a combination of the local store and/or CosmosDB remote calls. | ||
* | ||
* @param operation The operation (nil - read, CREATE, UPDATE, DELETE). Values are matching the pending operation column in the documents | ||
* store. | ||
* @param documentId The document identifier. | ||
* @param documentType The document type. | ||
* @param document The document (if the operation is CREATE or UPDATE). | ||
* @param baseOptions The base options from which to get the device time to live (if specified). | ||
* @param cachedTokenBlock A block returning the cached token. | ||
* @param remoteDocumentBlock A block returning the remote document. | ||
* @param completionHandler The completion handler called ultimately. | ||
*/ | ||
- (void)performOperation:(NSString *_Nullable)operation | ||
documentId:(NSString *)documentId | ||
documentType:(Class)documentType | ||
document:(id<MSSerializableDocument> _Nullable)document | ||
baseOptions:(MSBaseOptions *_Nullable)baseOptions | ||
cachedTokenBlock:(void (^)(MSCachedTokenCompletionHandler))cachedTokenBlock | ||
remoteDocumentBlock:(void (^)(MSDocumentWrapperCompletionHandler))remoteDocumentBlock | ||
completionHandler:(MSDocumentWrapperCompletionHandler)completionHandler; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.